@2112-lab/central-plant 0.1.2 → 0.1.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.
- package/dist/bundle/index.js +1 -15498
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -366
- package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -1448
- package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1292
- package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4374
- package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -465
- package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -117
- package/dist/cjs/src/analysis/analysis.js +1 -0
- package/dist/cjs/src/analysis/testing.js +1 -0
- package/dist/cjs/src/core/centralPlant.js +1 -0
- package/dist/cjs/src/core/debugLogger.js +1 -0
- package/dist/cjs/src/core/mathUtils.js +1 -0
- package/dist/cjs/src/core/nameUtils.js +1 -0
- package/dist/cjs/src/data/export.js +1 -0
- package/dist/cjs/src/data/import.js +1 -0
- package/dist/cjs/src/data/numerics.js +1 -0
- package/dist/cjs/src/helpers/sceneHelper.js +1 -0
- package/dist/cjs/src/index.js +1 -79
- package/dist/cjs/src/managers/components/animationManager.js +1 -0
- package/dist/cjs/src/managers/components/componentManager.js +1 -0
- package/dist/cjs/src/managers/components/pathfindingManager.js +1 -0
- package/dist/cjs/src/managers/controls/TransformControls.js +1 -0
- package/dist/cjs/src/managers/controls/cameraControlsManager.js +1 -0
- package/dist/cjs/src/managers/controls/dragDropManager.js +1 -0
- package/dist/cjs/src/managers/controls/keyboardControlsManager.js +1 -0
- package/dist/cjs/src/managers/controls/transformControlsManager.js +1 -0
- package/dist/cjs/src/managers/environment/environmentManager.js +1 -0
- package/dist/cjs/src/managers/environment/textureConfig.js +1 -0
- package/dist/cjs/src/managers/scene/sceneExportManager.js +1 -0
- package/dist/cjs/src/managers/scene/sceneInitializationManager.js +1 -0
- package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1 -0
- package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +1 -0
- package/dist/cjs/src/managers/system/disposalManager.js +1 -0
- package/dist/cjs/src/managers/system/hotReloadManager.js +1 -0
- package/dist/cjs/src/managers/system/performanceMonitor.js +1 -0
- package/dist/cjs/src/rendering/modelPreloader.js +1 -0
- package/dist/cjs/src/rendering/rendering2D.js +1 -0
- package/dist/cjs/src/rendering/rendering3D.js +1 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -339
- package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -1444
- package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1287
- package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4370
- package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -461
- package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -113
- package/dist/esm/src/analysis/analysis.js +1 -0
- package/dist/esm/src/analysis/testing.js +1 -0
- package/dist/esm/src/core/centralPlant.js +1 -0
- package/dist/esm/src/core/debugLogger.js +1 -0
- package/dist/esm/src/core/mathUtils.js +1 -0
- package/dist/esm/src/core/nameUtils.js +1 -0
- package/dist/esm/src/data/export.js +1 -0
- package/dist/esm/src/data/import.js +1 -0
- package/dist/esm/src/data/numerics.js +1 -0
- package/dist/esm/src/helpers/sceneHelper.js +1 -0
- package/dist/esm/src/index.js +1 -70
- package/dist/esm/src/managers/components/animationManager.js +1 -0
- package/dist/esm/src/managers/components/componentManager.js +1 -0
- package/dist/esm/src/managers/components/pathfindingManager.js +1 -0
- package/dist/esm/src/managers/controls/TransformControls.js +1 -0
- package/dist/esm/src/managers/controls/cameraControlsManager.js +1 -0
- package/dist/esm/src/managers/controls/dragDropManager.js +1 -0
- package/dist/esm/src/managers/controls/keyboardControlsManager.js +1 -0
- package/dist/esm/src/managers/controls/transformControlsManager.js +1 -0
- package/dist/esm/src/managers/environment/environmentManager.js +1 -0
- package/dist/esm/src/managers/environment/textureConfig.js +1 -0
- package/dist/esm/src/managers/scene/sceneExportManager.js +1 -0
- package/dist/esm/src/managers/scene/sceneInitializationManager.js +1 -0
- package/dist/esm/src/managers/scene/sceneOperationsManager.js +1 -0
- package/dist/esm/src/managers/scene/sceneTooltipsManager.js +1 -0
- package/dist/esm/src/managers/system/disposalManager.js +1 -0
- package/dist/esm/src/managers/system/hotReloadManager.js +1 -0
- package/dist/esm/src/managers/system/performanceMonitor.js +1 -0
- package/dist/esm/src/rendering/modelPreloader.js +1 -0
- package/dist/esm/src/rendering/rendering2D.js +1 -0
- package/dist/esm/src/rendering/rendering3D.js +1 -0
- package/dist/index.d.ts +52 -255
- package/package.json +3 -6
- package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +0 -1543
- package/dist/cjs/src/animationManager.js +0 -121
- package/dist/cjs/src/componentManager.js +0 -151
- package/dist/cjs/src/debugLogger.js +0 -176
- package/dist/cjs/src/disposalManager.js +0 -185
- package/dist/cjs/src/environmentManager.js +0 -1308
- package/dist/cjs/src/hotReloadManager.js +0 -252
- package/dist/cjs/src/keyboardControlsManager.js +0 -206
- package/dist/cjs/src/nameUtils.js +0 -106
- package/dist/cjs/src/pathfindingManager.js +0 -503
- package/dist/cjs/src/performanceMonitor.js +0 -718
- package/dist/cjs/src/sceneExportManager.js +0 -292
- package/dist/cjs/src/sceneInitializationManager.js +0 -540
- package/dist/cjs/src/textureConfig.js +0 -624
- package/dist/cjs/src/transformControlsManager.js +0 -851
- package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +0 -1537
- package/dist/esm/src/animationManager.js +0 -112
- package/dist/esm/src/componentManager.js +0 -123
- package/dist/esm/src/debugLogger.js +0 -167
- package/dist/esm/src/disposalManager.js +0 -155
- package/dist/esm/src/environmentManager.js +0 -1282
- package/dist/esm/src/hotReloadManager.js +0 -244
- package/dist/esm/src/keyboardControlsManager.js +0 -196
- package/dist/esm/src/nameUtils.js +0 -99
- package/dist/esm/src/pathfindingManager.js +0 -479
- package/dist/esm/src/performanceMonitor.js +0 -712
- package/dist/esm/src/sceneExportManager.js +0 -286
- package/dist/esm/src/sceneInitializationManager.js +0 -513
- package/dist/esm/src/textureConfig.js +0 -595
- package/dist/esm/src/transformControlsManager.js +0 -827
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../managers/controls/transformControlsManager.js"),n=require("../managers/system/hotReloadManager.js"),i=require("../managers/system/disposalManager.js"),a=require("../managers/scene/sceneExportManager.js"),s=require("../managers/components/componentManager.js"),r=require("../managers/scene/sceneInitializationManager.js"),o=require("../managers/environment/environmentManager.js"),u=require("../managers/controls/keyboardControlsManager.js"),l=require("../managers/components/pathfindingManager.js"),c=require("../managers/scene/sceneOperationsManager.js"),h=require("../managers/components/animationManager.js"),d=require("../managers/controls/cameraControlsManager.js"),v=require("../managers/scene/sceneTooltipsManager.js"),f=require("./nameUtils.js"),m=require("./debugLogger.js"),p=require("../rendering/modelPreloader.js"),g=require("../managers/controls/dragDropManager.js"),y=require("../helpers/sceneHelper.js"),w=function(){return e.createClass(function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e.classCallCheck(this,t),this.sceneViewer=n,this.managers={},this.utilities={},this.isInitialized=!1,this.importedSceneData=null,this.metadata={},this.transformHistory={lastTransform:null},this.setDefaultSceneMetadata(),this.initializeUtilities(),n&&(this.initializeManagers(),this.isInitialized=!0)},[{key:"setSceneViewer",value:function(e){this.sceneViewer=e,!this.isInitialized&&e&&(this.initializeManagers(),this.isInitialized=!0)}},{key:"initializeManagers",value:function(){this.sceneViewer&&(this.managers.hotReloadManager=new n.HotReloadManager(this.sceneViewer),this.managers.disposalManager=new i.DisposalManager(this.sceneViewer),this.managers.sceneExportManager=new a.SceneExportManager(this.sceneViewer),this.managers.componentManager=new s.ComponentManager(this.sceneViewer),this.managers.sceneInitializationManager=new r.SceneInitializationManager(this.sceneViewer),this.managers.environmentManager=new o.EnvironmentManager(this.sceneViewer),this.managers.keyboardControlsManager=new u.KeyboardControlsManager(this.sceneViewer),this.managers.pathfindingManager=new l.PathfindingManager(this.sceneViewer),this.managers.sceneOperationsManager=new c.SceneOperationsManager(this.sceneViewer),this.managers.animationManager=new h.AnimationManager(this.sceneViewer),this.managers.cameraControlsManager=new d.CameraControlsManager(this.sceneViewer))}},{key:"initializeUtilities",value:function(){this.utilities.createTransformControls=t.createTransformControls,this.utilities.generateUuidFromName=f.generateUuidFromName,this.utilities.getHardcodedUuid=f.getHardcodedUuid,this.utilities.logger=m.logger,this.utilities.transformLogger=m.transformLogger,this.utilities.pathfinderLogger=m.pathfinderLogger,this.utilities.modelLogger=m.modelLogger,this.utilities.modelPreloader=p.default,this.utilities.SceneHelper=y.SceneHelper,this.utilities.DragDropManager=g.default}},{key:"attachToComponent",value:function(){var e=this;this.sceneViewer&&(this.isInitialized||this.initializeManagers(),Object.keys(this.managers).forEach(function(t){e.sceneViewer[t]=e.managers[t]}),Object.keys(this.utilities).forEach(function(t){e.sceneViewer[t]=e.utilities[t]}))}},{key:"initializePostSceneManagers",value:function(){this.sceneViewer.$refs.container&&this.sceneViewer.camera&&this.sceneViewer.scene&&(this.managers.tooltipsManager=new v.SceneTooltipsManager(this.sceneViewer.$refs.container,this.sceneViewer.camera,this.sceneViewer.scene),this.sceneViewer.tooltipsManager=this.managers.tooltipsManager),this.sceneViewer.scene&&this.sceneViewer.camera&&(this.managers.dragDropManager=new g.default({scene:this.sceneViewer.scene,camera:this.sceneViewer.camera,transformManager:this.sceneViewer.transformManager,modelPreloader:this.utilities.modelPreloader,componentManager:this.sceneViewer.componentManager}),this.sceneViewer.dragDropManager=this.managers.dragDropManager),this.sceneViewer.scene&&this.sceneViewer.camera&&this.sceneViewer.renderer&&(this.utilities.sceneHelper=new y.SceneHelper({scene:this.sceneViewer.scene,camera:this.sceneViewer.camera,renderer:this.sceneViewer.renderer,controls:this.sceneViewer.controls,transformManager:this.sceneViewer.transformManager,componentManager:this.sceneViewer.componentManager,pathfindingManager:this.sceneViewer.pathfindingManager,currentSceneData:this.sceneViewer.currentSceneData,logger:this.utilities.logger}),this.sceneViewer.sceneHelper=this.utilities.sceneHelper)}},{key:"updateSceneHelperData",value:function(e){this.utilities.sceneHelper&&"function"==typeof this.utilities.sceneHelper.updateSceneData&&this.utilities.sceneHelper.updateSceneData(e)}},{key:"setImportedSceneData",value:function(t){this.importedSceneData=e.objectSpread2({},t),this.setDefaultImportedSceneMetadata(t),this.utilities.sceneHelper&&"function"==typeof this.utilities.sceneHelper.updateSceneData&&this.utilities.sceneHelper.updateSceneData(t)}},{key:"getImportedSceneData",value:function(){return this.importedSceneData}},{key:"getImportedConnections",value:function(){var e;return(null===(e=this.importedSceneData)||void 0===e?void 0:e.connections)||[]}},{key:"getImportedSceneObjects",value:function(){var e;return(null===(e=this.importedSceneData)||void 0===e||null===(e=e.scene)||void 0===e?void 0:e.object)||null}},{key:"clearImportedSceneData",value:function(){this.importedSceneData=null}},{key:"setMetadata",value:function(e,t){this.metadata[e]=t}},{key:"getMetadata",value:function(e){return this.metadata[e]}},{key:"getAllMetadata",value:function(){return e.objectSpread2({},this.metadata)}},{key:"removeMetadata",value:function(e){delete this.metadata[e]}},{key:"clearAllMetadata",value:function(){this.metadata={}}},{key:"clearAllData",value:function(){this.metadata={},this.transformHistory.lastTransform=null}},{key:"recordTransform",value:function(e){var t,n;if(e&&e.object){e.previousValues;var i={type:e.type,object:e.object,values:e.values,previousValues:e.previousValues,timestamp:(new Date).toISOString(),objectId:(null===(t=e.object)||void 0===t?void 0:t.uuid)||(null===(n=e.object)||void 0===n?void 0:n.id)||"unknown"};this.transformHistory.lastTransform=i}}},{key:"getLastTransform",value:function(){return this.transformHistory.lastTransform}},{key:"getTransformHistory",value:function(){return e.objectSpread2({},this.transformHistory)}},{key:"clearTransformHistory",value:function(){this.transformHistory.lastTransform=null}},{key:"hasMetadata",value:function(e){return e in this.metadata}},{key:"setDefaultSceneMetadata",value:function(){var e=this,t={sceneInfo:{name:"Untitled Central Plant Scene",description:"A central plant facility scene",version:"1.0.0",created:(new Date).toISOString(),lastModified:(new Date).toISOString(),author:"Engineering Team"},projectSettings:{units:"metric",scale:1,gridSize:1,snapToGrid:!0,showGrid:!0,showAxes:!0},viewportSettings:{defaultViewMode:"perspective",backgroundType:"skybox",showEnvironment:!0,autoRotate:!1,cameraPosition:{x:10,y:10,z:10},cameraTarget:{x:0,y:0,z:0}},componentSettings:{defaultComponentScale:1,showBoundingBoxes:!1,showConnectionPaths:!0,highlightOnHover:!0,selectionOutlineColor:"#00ff00"},spatialBoundaries:{min:{x:-60,y:-16,z:-60},max:{x:60,y:16,z:60},center:{x:0,y:4,z:0}},systemInfo:{centralPlantVersion:"2.0.0",buildDate:(new Date).toISOString(),platform:"undefined"!=typeof window?window.navigator.platform:"Unknown",userAgent:"undefined"!=typeof window?window.navigator.userAgent:"Unknown"}};Object.keys(t).forEach(function(n){e.hasMetadata(n)||e.setMetadata(n,t[n])})}},{key:"setDefaultImportedSceneMetadata",value:function(t){var n,i,a,s=(new Date).toISOString(),r=(null===(n=t.connections)||void 0===n?void 0:n.length)||0,o=(null===(i=t.scene)||void 0===i||null===(i=i.object)||void 0===i||null===(i=i.children)||void 0===i?void 0:i.length)||0,u={};null!==(a=t.scene)&&void 0!==a&&null!==(a=a.object)&&void 0!==a&&a.children&&t.scene.object.children.forEach(function(e){var t,n=(null===(t=e.userData)||void 0===t?void 0:t.componentType)||"unknown";u[n]=(u[n]||0)+1});var l={importInfo:{importTimestamp:s,originalFileName:null,fileSize:null,importMethod:"file-upload",importVersion:"1.0.0"},sceneAnalysis:{totalComponents:o,totalConnections:r,componentTypes:u,sceneComplexity:this.calculateSceneComplexity(r,o),hasValidStructure:this.validateImportedSceneStructure(t)},dataQuality:{hasConnections:r>0,hasComponents:o>0,hasValidScene:!!t.scene,missingData:this.identifyMissingData(t),warnings:this.generateImportWarnings(t)},processingStats:{processedAt:s,processingDuration:null,memoryUsage:this.estimateMemoryUsage(t),cacheStatus:"pending"}};if(this.setMetadata("lastImport",l),this.hasMetadata("sceneInfo")){var c=this.getMetadata("sceneInfo");this.setMetadata("sceneInfo",e.objectSpread2(e.objectSpread2({},c),{},{lastModified:s,importSource:"file-import",dataSourceType:"json"}))}}},{key:"calculateSceneComplexity",value:function(e,t){var n=e+t;return n<=10?"simple":n<=50?"moderate":n<=200?"complex":"very-complex"}},{key:"validateImportedSceneStructure",value:function(e){return!!(e&&e.scene&&e.scene.object&&Array.isArray(e.connections))}},{key:"identifyMissingData",value:function(e){var t,n=[];return e.connections&&0!==e.connections.length||n.push("No connection data found"),null!==(t=e.scene)&&void 0!==t&&null!==(t=t.object)&&void 0!==t&&t.children&&0!==e.scene.object.children.length||n.push("No component data found"),e.metadata||n.push("No metadata found"),e.version||n.push("No version information"),n}},{key:"generateImportWarnings",value:function(e){var t,n,i=[],a=(null===(t=e.scene)||void 0===t||null===(t=t.object)||void 0===t||null===(t=t.children)||void 0===t?void 0:t.length)||0;a>100&&i.push("Large scene detected (".concat(a," components) - may impact performance"));var s=(null===(n=e.connections)||void 0===n?void 0:n.length)||0;return a>0&&0===s&&i.push("Components found but no connections - scene may be incomplete"),e.version&&parseFloat(e.version)<1&&i.push("Scene data version is older than current - some features may not work correctly"),i}},{key:"estimateMemoryUsage",value:function(e){var t=JSON.stringify(e).length,n=(t/1024/1024).toFixed(2);return{jsonSizeBytes:t,estimatedMB:parseFloat(n),category:n<1?"small":n<10?"medium":"large"}}},{key:"updateMetadataCategory",value:function(t,n){if(this.hasMetadata(t)){var i=this.getMetadata(t);this.setMetadata(t,e.objectSpread2(e.objectSpread2({},i),n))}else this.setMetadata(t,n)}},{key:"undoTransform",value:function(){var e=this.getLastTransform();if(!e)return!1;try{var t,n=e.object,i=e.type,a=e.previousValues;if(!n||!a)return!1;if(this.debugTransformState(n,"Before Undo"),this.sceneViewer&&this.sceneViewer.scene){var s=!1;if(this.sceneViewer.scene.traverse(function(e){e===n&&(s=!0)}),!s)return!1}switch(i){case"translate":case"position":a.position?(void 0!==a.position.x&&(n.position.x=a.position.x),void 0!==a.position.y&&(n.position.y=a.position.y),void 0!==a.position.z&&(n.position.z=a.position.z)):(void 0!==a.x&&(n.position.x=a.x),void 0!==a.y&&(n.position.y=a.y),void 0!==a.z&&(n.position.z=a.z));break;case"rotate":case"rotation":a.rotation?(void 0!==a.rotation.x&&(n.rotation.x=a.rotation.x),void 0!==a.rotation.y&&(n.rotation.y=a.rotation.y),void 0!==a.rotation.z&&(n.rotation.z=a.rotation.z)):(void 0!==a.x&&(n.rotation.x=a.x),void 0!==a.y&&(n.rotation.y=a.y),void 0!==a.z&&(n.rotation.z=a.z));break;case"scale":a.scale?(void 0!==a.scale.x&&(n.scale.x=a.scale.x),void 0!==a.scale.y&&(n.scale.y=a.scale.y),void 0!==a.scale.z&&(n.scale.z=a.scale.z)):(void 0!==a.x&&(n.scale.x=a.x),void 0!==a.y&&(n.scale.y=a.y),void 0!==a.z&&(n.scale.z=a.z));break;default:return!1}n.updateMatrix(),n.updateMatrixWorld(!0);var r=null===(t=this.sceneViewer)||void 0===t?void 0:t.transformManager;if(r&&r.transformControls){var o=r.transformControls;o.object===n&&(o.detach(),r.ensureSceneAttachment&&r.ensureSceneAttachment(!0),o.attach(n),r.selectedObject=n,r.updateBoundingBox&&r.updateBoundingBox(),r.boundingBoxCache&&r.boundingBoxCache.has(n)&&r.boundingBoxCache.delete(n))}if(this.sceneViewer&&this.sceneViewer.sceneOperationsManager&&this.sceneViewer.currentSceneData)try{this.sceneViewer.onTransformEnd(n)}catch(e){}if("undefined"!=typeof window){var u=new CustomEvent("sceneUpdateComplete",{detail:{timestamp:Date.now(),action:"undo-transform",objectId:n.uuid||n.id||"unknown"}});window.dispatchEvent(u)}return this.clearTransformHistory(),this.ensureObjectSelectable(n),this.debugTransformState(n,"After Undo"),!0}catch(e){return!1}}},{key:"ensureObjectSelectable",value:function(e){if(!e||!this.sceneViewer)return!1;try{var t=this.sceneViewer.transformManager;return!!t&&(t.recoverTransformControls?t.recoverTransformControls(e):(e.updateMatrixWorld(!0),t.boundingBoxCache&&t.boundingBoxCache.has(e)&&t.boundingBoxCache.delete(e),t.ensureSceneAttachment&&t.ensureSceneAttachment(!0),t.selectedObject===e&&(t.deselectObject(),requestAnimationFrame(function(){t.selectObjectForTransformOnly(e)})),!0))}catch(e){return!1}}},{key:"debugTransformState",value:function(e){}},{key:"fixTransformControlsSelection",value:function(){if(!this.sceneViewer||!this.sceneViewer.transformManager)return!1;var e=this.sceneViewer.transformManager;if(e.recoverTransformControls&&e.recoverTransformControls())return!0;try{var t=e.currentMode,n=e.currentSpace;return e.transformControls&&(e.transformControls.detach(),e.scene.remove(e.transformControls),e.transformControls.dispose(),e.transformControls=null),e.createTransformControls(),e.setupEventListeners(),e.setMode(t),e.setSpace(n),!0}catch(e){return!1}}},{key:"isObjectInScene",value:function(e){if(!this.sceneViewer||!this.sceneViewer.scene)return!1;var t=!1;return this.sceneViewer.scene.traverse(function(n){n===e&&(t=!0)}),t}}])}();exports.CentralPlant=w,exports.default=w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"i",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=function(){return e.createClass(function r(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SceneViewer",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";e.classCallCheck(this,r),this.namespace=i,this.debugLevel=t,this.isProduction="production"===process.env.NODE_ENV,this.enabled=!this.isProduction,this.levels={error:0,warn:1,info:2,debug:3,verbose:4},this.currentLevel=this.levels[t]||this.levels.info},[{key:"setLevel",value:function(e){return this.currentLevel=this.levels[e]||this.levels.info,this}},{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"_shouldLog",value:function(e){return this.enabled&&this.levels[e]<=this.currentLevel}},{key:"_formatMessage",value:function(e,r){for(var i="[".concat(this.namespace,":").concat(e.toUpperCase(),"]"),t=arguments.length,n=new Array(t>2?t-2:0),s=2;s<t;s++)n[s-2]=arguments[s];return[i,r].concat(n)}},{key:"error",value:function(r){if(this.t("error")){for(var i,t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];(i=console).error.apply(i,e.toConsumableArray(this.o.apply(this,["error",r].concat(n))))}}},{key:"warn",value:function(r){if(this.t("warn")){for(var i,t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];(i=console).warn.apply(i,e.toConsumableArray(this.o.apply(this,["warn",r].concat(n))))}}},{key:"info",value:function(r){if(this.t("info")){for(var i,t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];(i=console).log.apply(i,e.toConsumableArray(this.o.apply(this,["info",r].concat(n))))}}},{key:"debug",value:function(r){if(this.t("debug")){for(var i,t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];(i=console).debug.apply(i,e.toConsumableArray(this.o.apply(this,["debug",r].concat(n))))}}},{key:"verbose",value:function(r){if(this.t("verbose")){for(var i,t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];(i=console).debug.apply(i,e.toConsumableArray(this.o.apply(this,["verbose",r].concat(n))))}}},{key:"phase",value:function(e,r){for(var i=arguments.length,t=new Array(i>2?i-2:0),n=2;n<i;n++)t[n-2]=arguments[n];this.info.apply(this,["🔍 PHASE ".concat(e,": ").concat(r)].concat(t))}},{key:"success",value:function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),t=1;t<r;t++)i[t-1]=arguments[t];this.info.apply(this,["✅ ".concat(e)].concat(i))}},{key:"failure",value:function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),t=1;t<r;t++)i[t-1]=arguments[t];this.error.apply(this,["❌ ".concat(e)].concat(i))}},{key:"loading",value:function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),t=1;t<r;t++)i[t-1]=arguments[t];this.debug.apply(this,["🔄 ".concat(e)].concat(i))}},{key:"timing",value:function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),t=1;t<r;t++)i[t-1]=arguments[t];this.debug.apply(this,["⏱️ ".concat(e)].concat(i))}}])}(),i=new r("SceneViewer","info"),t=new r("Transform","warn"),n=new r("Pathfinder","info"),s=new r("Models","info");new r("Materials","warn"),exports.DebugLogger=r,exports.logger=i,exports.modelLogger=s,exports.pathfinderLogger=n,exports.transformLogger=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var t,n=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=n.createClass(function t(){n.classCallCheck(this,t)});t=r,n.defineProperty(r,"PI",Math.PI),n.defineProperty(r,"TWO_PI",2*Math.PI),n.defineProperty(r,"HALF_PI",Math.PI/2),n.defineProperty(r,"DEG_TO_RAD",Math.PI/180),n.defineProperty(r,"RAD_TO_DEG",180/Math.PI),n.defineProperty(r,"EPSILON",1e-10),n.defineProperty(r,"angle",{toRadians:function(n){return n*t.DEG_TO_RAD},toDegrees:function(n){return n*t.RAD_TO_DEG},normalize:function(n){for(;n<0;)n+=t.TWO_PI;for(;n>=t.TWO_PI;)n-=t.TWO_PI;return n},normalizeSignedAngle:function(n){return(n=t.angle.normalize(n))>Math.PI?n-t.TWO_PI:n},distance:function(n,r){var e=t.angle.normalizeSignedAngle(r-n);return Math.abs(e)},lerp:function(n,r,e){var u=t.angle.normalizeSignedAngle(r-n);return t.angle.normalize(n+u*e)}}),n.defineProperty(r,"interpolation",{linear:function(t,n,r){return t+(n-t)*r},smoothstep:function(n,r,e){var u=e*e*(3-2*e);return t.interpolation.linear(n,r,u)},smootherstep:function(n,r,e){var u=e*e*e*(e*(6*e-15)+10);return t.interpolation.linear(n,r,u)},cosine:function(t,n,r){var e=r*Math.PI,u=.5*(1-Math.cos(e));return t*(1-u)+n*u},cubic:function(t,n,r,e,u){var a=u*u;return.5*(2*n+(-t+r)*u+(2*t-5*n+4*r-e)*a+(3*n-t-3*r+e)*(a*u))}}),n.defineProperty(r,"easing",{easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},easeInSine:function(n){return 1-Math.cos(n*t.HALF_PI)},easeOutSine:function(n){return Math.sin(n*t.HALF_PI)},easeInOutSine:function(n){return.5*(1-Math.cos(t.PI*n))},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1)))},easeInCirc:function(t){return 1-Math.sqrt(1-t*t)},easeOutCirc:function(t){return Math.sqrt(1- --t*t)},easeInOutCirc:function(t){return(t*=2)<1?.5*(1-Math.sqrt(1-t*t)):(t-=2,.5*(Math.sqrt(1-t*t)+1))},easeInElastic:function(n){if(0===n)return 0;if(1===n)return 1;return-Math.pow(2,10*(n-=1))*Math.sin((n-.075)*t.TWO_PI/.3)},easeOutElastic:function(n){if(0===n)return 0;if(1===n)return 1;return Math.pow(2,-10*n)*Math.sin((n-.075)*t.TWO_PI/.3)+1}}),n.defineProperty(r,"geometry",{triangleArea:function(t,n,r){return.5*Math.abs((n[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(n[1]-t[1]))},polygonArea:function(t){for(var n=0,r=t.length,e=0;e<r;e++){var u=(e+1)%r;n+=t[e][0]*t[u][1],n-=t[u][0]*t[e][1]}return Math.abs(n)/2},pointInTriangle:function(n,r,e,u){var a=t.geometry.triangleArea(r,e,u),i=t.geometry.triangleArea(n,e,u),o=t.geometry.triangleArea(r,n,u),c=t.geometry.triangleArea(r,e,n);return Math.abs(a-(i+o+c))<t.EPSILON},polygonCentroid:function(t){for(var n=0,r=0,e=0,u=t.length,a=0;a<u;a++){var i=(a+1)%u,o=t[a][0]*t[i][1]-t[i][0]*t[a][1];e+=o,n+=(t[a][0]+t[i][0])*o,r+=(t[a][1]+t[i][1])*o}return[n/=6*(e/=2),r/=6*e]}}),n.defineProperty(r,"random",{float:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t+Math.random()*(n-t)},int:function(n,r){return Math.floor(t.random.float(n,r+1))},boolean:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5;return Math.random()<t},choice:function(n){return n[t.random.int(0,n.length-1)]},shuffle:function(t){for(var r=n.toConsumableArray(t),e=r.length-1;e>0;e--){var u=Math.floor(Math.random()*(e+1)),a=[r[u],r[e]];r[e]=a[0],r[u]=a[1]}return r},unitCircle:function(){var n=t.random.float(0,t.TWO_PI);return[Math.cos(n),Math.sin(n)]},insideUnitCircle:function(){var r=t.random.unitCircle(),e=n.slicedToArray(r,2),u=e[0],a=e[1],i=Math.sqrt(Math.random());return[u*i,a*i]},unitSphere:function(){var n=Math.random(),r=Math.random(),e=t.TWO_PI*n,u=Math.acos(2*r-1);return[Math.sin(u)*Math.cos(e),Math.sin(u)*Math.sin(e),Math.cos(u)]}}),n.defineProperty(r,"color",{hslToRgb:function(t,n,r){t/=360;var e,u,a,i=(1-Math.abs(2*r-1))*n,o=i*(1-Math.abs(6*t%2-1)),c=r-i/2;return t<1/6?(e=i,u=o,a=0):t<2/6?(e=o,u=i,a=0):t<.5?(e=0,u=i,a=o):t<4/6?(e=0,u=o,a=i):t<5/6?(e=o,u=0,a=i):(e=i,u=0,a=o),[Math.round(255*(e+c)),Math.round(255*(u+c)),Math.round(255*(a+c))]},rgbToHsl:function(t,n,r){t/=255,n/=255,r/=255;var e=Math.max(t,n,r),u=Math.min(t,n,r),a=(e+u)/2;if(e===u)return[0,0,a];var i,o=e-u,c=a>.5?o/(2-e-u):o/(e+u);switch(e){case t:i=(n-r)/o+(n<r?6:0);break;case n:i=(r-t)/o+2;break;case r:i=(t-n)/o+4}return[360*(i/=6),c,a]},lerp:function(n,r,e){return[Math.round(t.interpolation.linear(n[0],r[0],e)),Math.round(t.interpolation.linear(n[1],r[1],e)),Math.round(t.interpolation.linear(n[2],r[2],e))]}}),n.defineProperty(r,"utils",{clamp:function(t,n,r){return Math.max(n,Math.min(r,t))},map:function(t,n,r,e,u){return e+(t-n)*(u-e)/(r-n)},isPowerOfTwo:function(t){return!(t&t-1)},nextPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log2(t)))},gcd:function(n,r){return 0===r?n:t.utils.gcd(r,n%r)},lcm:function(n,r){return Math.abs(n*r)/t.utils.gcd(n,r)},approxEqual:function(n,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.EPSILON;return Math.abs(n-r)<e},round:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=Math.pow(10,n);return Math.round(t*r)/r}}),exports.MathUtils=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function n(n){if(!n)return null;var r=n.toUpperCase().replace(/\s+COMPONENT$/i,"").replace(/\s+/g,"-").replace(/[^A-Z0-9\-]/g,"");return r=r.replace(/-COMPONENT$/,"")}Object.defineProperty(exports,"u",{value:!0}),exports.findObjectByHardcodedUuid=function(r,u){if(!r||!u)return null;var e=null;return r.traverse(function(r){var l;if(!e)if(r.uuid!==u)if((null===(l=r.userData)||void 0===l?void 0:l.originalUuid)!==u){if(r.name&&n(r.name)===u)return void(e=r)}else e=r;else e=r}),e},exports.generateUuidFromName=n,exports.getHardcodedUuid=function(r){var u;return r?null!==(u=r.userData)&&void 0!==u&&u.originalUuid?r.userData.originalUuid:r.uuid&&!r.uuid.includes("-")&&r.uuid.length>10?r.uuid:r.name?n(r.name):null:null};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js");require("three");var t=require("../../node_modules/three/examples/jsm/exporters/GLTFExporter.js"),r=require("../../node_modules/three/examples/jsm/exporters/OBJExporter.js"),n=require("../../node_modules/three/examples/jsm/exporters/STLExporter.js"),o=require("../../node_modules/three/examples/jsm/exporters/PLYExporter.js"),i=require("../core/debugLogger.js"),a=function(){return e.createClass(function i(){e.classCallCheck(this,i),this.exporters={gltf:new t.GLTFExporter,obj:new r.OBJExporter,stl:new n.STLExporter,ply:new o.PLYExporter},this.supportedFormats={models:["gltf","glb","obj","stl","ply","dae"],scenes:["json"],images:["png","jpg","jpeg","webp"],data:["json","csv","xml"]},this.exportHistory=[]},[{key:"exportModel",value:(f=e.asyncToGenerator(e.regenerator().m(function t(r,n){var o,a,u,s,c,l,f,p,v,d,m=arguments;return e.regenerator().w(function(t){for(;;)switch(t.n){case 0:o=m.length>2&&void 0!==m[2]?m[2]:{},a=performance.now(),i.logger.info("🔄 Exporting model to ".concat(n.toUpperCase(),"...")),t.p=1,s=e.objectSpread2({binary:"glb"===n,embedImages:!0,includeCustomExtensions:!1},o),v=n.toLowerCase(),t.n="gltf"===v||"glb"===v?2:"obj"===v?4:"stl"===v?6:8;break;case 2:return t.n=3,this.exportGLTF(r,s);case 3:case 5:case 7:return u=t.v,t.a(3,9);case 4:return t.n=5,this.exportOBJ(r,s);case 6:return t.n=7,this.exportSTL(r,s);case 8:throw new Error("Unsupported format: ".concat(n));case 9:return c=performance.now()-a,l={timestamp:(new Date).toISOString(),format:n.toLowerCase(),objectName:r.name||"Unnamed Object",exportTime:c,options:s,success:!0},this.exportHistory.push(l),i.logger.info("✅ Model exported successfully to ".concat(n.toUpperCase()," in ").concat(c.toFixed(2),"ms")),t.a(2,{data:u,format:n,exportTime:c,filename:this.generateFilename(r.name||"model",n)});case 10:throw t.p=10,d=t.v,f=performance.now()-a,p={timestamp:(new Date).toISOString(),format:n.toLowerCase(),objectName:r.name||"Unnamed Object",exportTime:f,options:o,success:!1,error:d.message},this.exportHistory.push(p),i.logger.error("❌ Failed to export model to ".concat(n.toUpperCase(),":"),d),d;case 11:return t.a(2)}},t,this,[[1,10]])})),function(e,t){return f.apply(this,arguments)})},{key:"exportGLTF",value:(l=e.asyncToGenerator(e.regenerator().m(function t(r){var n,o=this,i=arguments;return e.regenerator().w(function(e){for(;;)if(0===e.n)return n=i.length>1&&void 0!==i[1]?i[1]:{},e.a(2,new Promise(function(e,t){o.exporters.gltf.parse(r,function(t){return e(t)},t,n)}))},t)})),function(e){return l.apply(this,arguments)})},{key:"exportOBJ",value:(c=e.asyncToGenerator(e.regenerator().m(function t(r){var n=this;return e.regenerator().w(function(e){for(;;)if(0===e.n)return e.a(2,new Promise(function(e){e(n.exporters.obj.parse(r))}))},t)})),function(e){return c.apply(this,arguments)})},{key:"exportSTL",value:(s=e.asyncToGenerator(e.regenerator().m(function t(r){var n,o=this,i=arguments;return e.regenerator().w(function(e){for(;;)if(0===e.n)return n=i.length>1&&void 0!==i[1]?i[1]:{},e.a(2,new Promise(function(e){e(o.exporters.stl.parse(r,n))}))},t)})),function(e){return s.apply(this,arguments)})},{key:"exportPLY",value:(u=e.asyncToGenerator(e.regenerator().m(function t(r){var n,o=this,i=arguments;return e.regenerator().w(function(e){for(;;)if(0===e.n)return n=i.length>1&&void 0!==i[1]?i[1]:{},e.a(2,new Promise(function(e){e(o.exporters.ply.parse(r,n))}))},t)})),function(e){return u.apply(this,arguments)})},{key:"exportSceneConfig",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.logger.info("🔄 Exporting scene configuration...");try{var o={metadata:e.objectSpread2({version:"1.0.0",generator:"Export",timestamp:(new Date).toISOString()},n),scene:this.serializeObject(t),connections:e.toConsumableArray(r),cameras:this.extractCameras(t),lights:this.extractLights(t)};return i.logger.info("✅ Scene configuration exported successfully"),o}catch(e){throw i.logger.error("❌ Failed to export scene configuration:",e),e}}},{key:"serializeObject",value:function(t){var r=this,n={uuid:t.uuid,name:t.name,type:t.type,position:t.position.toArray(),rotation:t.rotation.toArray(),scale:t.scale.toArray(),visible:t.visible,castShadow:t.castShadow,receiveShadow:t.receiveShadow,userData:e.objectSpread2({},t.userData),children:[]};return t.geometry&&(n.geometry={type:t.geometry.type,uuid:t.geometry.uuid,attributes:this.serializeGeometryAttributes(t.geometry)}),t.material&&(n.material=this.serializeMaterial(t.material)),t.children.forEach(function(e){n.children.push(r.serializeObject(e))}),n}},{key:"serializeGeometryAttributes",value:function(e){var t={};return Object.keys(e.attributes).forEach(function(r){var n=e.attributes[r];t[r]={type:n.constructor.name,itemSize:n.itemSize,count:n.count,normalized:n.normalized}}),t}},{key:"serializeMaterial",value:function(e){var t={type:e.type,uuid:e.uuid,name:e.name,color:e.color?e.color.getHex():null,transparent:e.transparent,opacity:e.opacity,side:e.side,visible:e.visible};void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.clearcoat&&(t.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(t.clearcoatRoughness=e.clearcoatRoughness);return["map","normalMap","roughnessMap","metalnessMap","aoMap","emissiveMap"].forEach(function(r){var n;e[r]&&(t[r]={uuid:e[r].uuid,name:e[r].name,image:(null===(n=e[r].image)||void 0===n?void 0:n.src)||null})}),t}},{key:"extractCameras",value:function(e){var t=[];return e.traverse(function(e){if(e.isCamera){var r={uuid:e.uuid,name:e.name,type:e.type,position:e.position.toArray(),rotation:e.rotation.toArray(),fov:e.fov,aspect:e.aspect,near:e.near,far:e.far};t.push(r)}}),t}},{key:"extractLights",value:function(e){var t=[];return e.traverse(function(e){if(e.isLight){var r={uuid:e.uuid,name:e.name,type:e.type,position:e.position.toArray(),color:e.color.getHex(),intensity:e.intensity};void 0!==e.distance&&(r.distance=e.distance),void 0!==e.decay&&(r.decay=e.decay),void 0!==e.angle&&(r.angle=e.angle),void 0!==e.penumbra&&(r.penumbra=e.penumbra),void 0!==e.castShadow&&(r.castShadow=e.castShadow),t.push(r)}}),t}},{key:"exportToCSV",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e||0===e.length)return"";t||(t=Object.keys(e[0]));var r=[];return r.push(t.join(",")),e.forEach(function(e){var n=t.map(function(t){var r=e[t];return"string"==typeof r&&(r.includes(",")||r.includes('"'))?'"'.concat(r.replace(/"/g,'""'),'"'):r});r.push(n.join(","))}),r.join("\n")}},{key:"exportToXML",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"root",o=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=" ".repeat(n),a="";return Object.keys(t).forEach(function(u){var s=t[u];"object"!==e.typeof(s)||null===s||Array.isArray(s)?Array.isArray(s)?s.forEach(function(t){a+="".concat(i,"<").concat(u,">"),"object"===e.typeof(t)?a+="\n"+o(t,n+1)+i:a+=r.escapeXML(t),a+="</".concat(u,">\n")}):a+="".concat(i,"<").concat(u,">").concat(r.escapeXML(s),"</").concat(u,">\n"):(a+="".concat(i,"<").concat(u,">\n"),a+=o(s,n+1),a+="".concat(i,"</").concat(u,">\n"))}),a};return'<?xml version="1.0" encoding="UTF-8"?>\n'+"<".concat(n,">\n")+o(t,1)+"</".concat(n,">")}},{key:"downloadFile",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/octet-stream";r=e instanceof ArrayBuffer||"string"==typeof e?new Blob([e],{type:n}):new Blob([JSON.stringify(e,null,2)],{type:"application/json"});var o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=t,a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o),i.logger.info("✅ File downloaded: ".concat(t))}},{key:"exportBatch",value:(a=e.asyncToGenerator(e.regenerator().m(function t(r){var n,o,a,u,s,c,l,f;return e.regenerator().w(function(t){for(;;)switch(t.n){case 0:i.logger.info("🔄 Starting batch export of ".concat(r.length," objects...")),n=[],o=[],a=e.createForOfIteratorHelper(r),t.p=1,a.s();case 2:if((u=a.n()).done){t.n=7;break}return s=u.value,t.p=3,t.n=4,this.exportModel(s.object,s.format,s.options);case 4:c=t.v,n.push(c),t.n=6;break;case 5:t.p=5,l=t.v,o.push({object:s.object.name||"Unnamed Object",format:s.format,error:l.message});case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,f=t.v,a.e(f);case 9:return t.p=9,a.f(),t.f(9);case 10:return i.logger.info("✅ Batch export complete: ".concat(n.length," successful, ").concat(o.length," failed")),t.a(2,{results:n,errors:o})}},t,this,[[3,5],[1,8,9,10]])})),function(e){return a.apply(this,arguments)})},{key:"generateFilename",value:function(e,t){var r=(new Date).toISOString().replace(/[:.]/g,"-").slice(0,-5),n=e.replace(/[^a-zA-Z0-9_-]/g,"_");return"".concat(n,"_").concat(r,".").concat(t.toLowerCase())}},{key:"escapeXML",value:function(e){return null==e?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}},{key:"isFormatSupported",value:function(e,t){var r;return(null===(r=this.supportedFormats[t])||void 0===r?void 0:r.includes(e.toLowerCase()))||!1}},{key:"getExportHistory",value:function(){return this.exportHistory}},{key:"clearHistory",value:function(){this.exportHistory=[]}},{key:"getSupportedFormats",value:function(){return e.objectSpread2({},this.supportedFormats)}},{key:"dispose",value:function(){this.clearHistory(),i.logger.info("Export disposed")}}]);var a,u,s,c,l,f}();exports.Export=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("three"),t=require("../../node_modules/three/examples/jsm/loaders/GLTFLoader.js"),n=require("../../node_modules/three/examples/jsm/loaders/DRACOLoader.js"),o=require("../core/debugLogger.js");function s(e){if(e&&e.t)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var i=s(r),u=function(){return e.createClass(function r(){e.classCallCheck(this,r),this.gltfLoader=new t.GLTFLoader,this.dracoLoader=new n.DRACOLoader,this.textureLoader=new i.TextureLoader,this.dracoLoader.setDecoderPath("/draco/"),this.gltfLoader.setDRACOLoader(this.dracoLoader),this.supportedFormats={models:[".glb",".gltf"],textures:[".jpg",".jpeg",".png",".hdr",".exr"],scenes:[".json"],configs:[".json",".yaml",".yml"]}},[{key:"importModel",value:(c=e.asyncToGenerator(e.regenerator().m(function r(t){var n,s,i,u,c,a,l,f,d,p,h,m,v,g,b,w=this,y=arguments;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:return s=(n=y.length>1&&void 0!==y[1]?y[1]:{}).scale,i=void 0===s?1:s,u=n.position,c=void 0===u?[0,0,0]:u,a=n.rotation,l=void 0===a?[0,0,0]:a,f=n.castShadow,d=void 0===f||f,p=n.receiveShadow,h=void 0===p||p,r.p=1,o.logger.info("🔄 Importing model: ".concat(t)),r.n=2,new Promise(function(e,r){w.gltfLoader.load(t,e,function(e){var r=(e.loaded/e.total*100).toFixed(1);o.logger.debug("Loading progress: ".concat(r,"%"))},r)});case 2:return g=r.v,1!==i&&g.scene.scale.setScalar(i),(m=g.scene.position).set.apply(m,e.toConsumableArray(c)),(v=g.scene.rotation).set.apply(v,e.toConsumableArray(l)),g.scene.traverse(function(e){e.isMesh&&(e.castShadow=d,e.receiveShadow=h)}),o.logger.info("✅ Model imported successfully: ".concat(t)),r.a(2,{scene:g.scene,animations:g.animations,cameras:g.cameras,asset:g.asset});case 3:throw r.p=3,b=r.v,o.logger.error("❌ Failed to import model ".concat(t,":"),b),b;case 4:return r.a(2)}},r,null,[[1,3]])})),function(e){return c.apply(this,arguments)})},{key:"importTextures",value:(u=e.asyncToGenerator(e.regenerator().m(function r(t){var n,s,i,u,c=this;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=Array.isArray(t)?t:[t],e.p=1,s=n.map(function(e){return new Promise(function(r,t){c.textureLoader.load(e,r,void 0,t)})}),e.n=2,Promise.all(s);case 2:return i=e.v,o.logger.info("✅ Imported ".concat(i.length," texture(s)")),e.a(2,Array.isArray(t)?i:i[0]);case 3:throw e.p=3,u=e.v,o.logger.error("❌ Failed to import textures:",u),u;case 4:return e.a(2)}},r,null,[[1,3]])})),function(e){return u.apply(this,arguments)})},{key:"importSceneConfig",value:(s=e.asyncToGenerator(e.regenerator().m(function r(t){var n,s,i,u,c,a;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,o.logger.info("🔄 Importing scene config: ".concat(t)),e.n=1,fetch(t);case 1:if((n=e.v).ok){e.n=2;break}throw new Error("HTTP ".concat(n.status,": ").concat(n.statusText));case 2:return e.n=3,n.json();case 3:for(s=e.v,i=0,u=["scene","connections"];i<u.length;i++)s[c=u[i]]||o.logger.warn("⚠️ Missing required property: ".concat(c));return o.logger.info("✅ Scene config imported: ".concat(t)),e.a(2,s);case 4:throw e.p=4,a=e.v,o.logger.error("❌ Failed to import scene config ".concat(t,":"),a),a;case 5:return e.a(2)}},r,null,[[0,4]])})),function(e){return s.apply(this,arguments)})},{key:"importBatch",value:(r=e.asyncToGenerator(e.regenerator().m(function r(t){var n,s,i,u,c,a,l,f,d;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:o.logger.info("🔄 Starting batch import of ".concat(t.length," files")),n=[],s=[],i=e.createForOfIteratorHelper(t),r.p=1,i.s();case 2:if((u=i.n()).done){r.n=14;break}c=u.value,r.p=3,a=void 0,l=c.type,r.n="model"===l?4:"texture"===l?6:"scene"===l?8:10;break;case 4:return r.n=5,this.importModel(c.url,c.options);case 5:return a=r.v,r.a(3,11);case 6:return r.n=7,this.importTextures(c.url);case 7:return a=r.v,r.a(3,11);case 8:return r.n=9,this.importSceneConfig(c.url);case 9:return a=r.v,r.a(3,11);case 10:throw new Error("Unknown import type: ".concat(c.type));case 11:n.push({url:c.url,type:c.type,data:a}),r.n=13;break;case 12:r.p=12,f=r.v,s.push({url:c.url,type:c.type,error:f}),o.logger.error("❌ Failed to import ".concat(c.url,":"),f);case 13:r.n=2;break;case 14:r.n=16;break;case 15:r.p=15,d=r.v,i.e(d);case 16:return r.p=16,i.f(),r.f(16);case 17:return o.logger.info("✅ Batch import complete: ".concat(n.length," successful, ").concat(s.length," failed")),r.a(2,{results:n,errors:s})}},r,this,[[3,12],[1,15,16,17]])})),function(e){return r.apply(this,arguments)})},{key:"isFormatSupported",value:function(e,r){var t,n="."+e.split(".").pop().toLowerCase();return(null===(t=this.supportedFormats[r])||void 0===t?void 0:t.includes(n))||!1}},{key:"getFormatInfo",value:function(r){for(var t="."+r.split(".").pop().toLowerCase(),n=0,o=Object.entries(this.supportedFormats);n<o.length;n++){var s=e.slicedToArray(o[n],2),i=s[0];if(s[1].includes(t))return{category:i,extension:t,supported:!0}}return{category:"unknown",extension:t,supported:!1}}},{key:"dispose",value:function(){this.dracoLoader.dispose&&this.dracoLoader.dispose(),o.logger.info("Import disposed")}}]);var r,s,u,c}();exports.Import=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var r=require("../../_virtual/_rollupPluginBabelHelpers.js"),n=function(){return r.createClass(function n(){var t=this;r.classCallCheck(this,n),r.defineProperty(this,"vector",{add:function(r,n){return r.map(function(r,t){return r+(n[t]||0)})},subtract:function(r,n){return r.map(function(r,t){return r-(n[t]||0)})},scale:function(r,n){return r.map(function(r){return r*n})},dot:function(r,n){return r.reduce(function(r,t,e){return r+t*(n[e]||0)},0)},cross:function(r,n){return[r[1]*n[2]-r[2]*n[1],r[2]*n[0]-r[0]*n[2],r[0]*n[1]-r[1]*n[0]]},magnitude:function(r){return Math.sqrt(r.reduce(function(r,n){return r+n*n},0))},normalize:function(r){var n=t.vector.magnitude(r);return n>0?r.map(function(r){return r/n}):r.slice()},distance:function(r,n){return t.vector.magnitude(t.vector.subtract(r,n))},lerp:function(r,n,t){return r.map(function(r,e){return r+t*((n[e]||0)-r)})}}),r.defineProperty(this,"matrix",{identity:function(r){for(var n=Array(r).fill().map(function(){return Array(r).fill(0)}),t=0;t<r;t++)n[t][t]=1;return n},multiply:function(r,n){for(var t=r.length,e=n[0].length,o=Array(t).fill().map(function(){return Array(e).fill(0)}),u=0;u<t;u++)for(var i=0;i<e;i++)for(var a=0;a<r[0].length;a++)o[u][i]+=r[u][a]*n[a][i];return o},multiplyVector:function(r,n){return r.map(function(r){return r.reduce(function(r,t,e){return r+t*(n[e]||0)},0)})},determinant:function(r){var n=r.length;if(2===n)return r[0][0]*r[1][1]-r[0][1]*r[1][0];if(3===n)return r[0][0]*(r[1][1]*r[2][2]-r[1][2]*r[2][1])-r[0][1]*(r[1][0]*r[2][2]-r[1][2]*r[2][0])+r[0][2]*(r[1][0]*r[2][1]-r[1][1]*r[2][0]);throw new Error("Determinant calculation only supported for 2x2 and 3x3 matrices")},transpose:function(r){return r[0].map(function(n,t){return r.map(function(r){return r[t]})})}}),r.defineProperty(this,"analysis",{newtonRaphson:function(r,n,e){for(var o=e,u=0;u<t.maxIterations;){var i=r(o),a=n(o);if(Math.abs(a)<t.precision)throw new Error("Derivative too small, cannot continue");var c=o-i/a;if(Math.abs(c-o)<t.convergenceThreshold)return{root:c,iterations:u+1,converged:!0,error:Math.abs(r(c))};o=c,u++}return{root:o,iterations:u,converged:!1,error:Math.abs(r(o))}},bisection:function(r,n,e){if(r(n)*r(e)>=0)throw new Error("Function must have opposite signs at bounds");for(var o=n,u=e,i=0;i<t.maxIterations;){var a=(o+u)/2,c=r(a);if(Math.abs(c)<t.convergenceThreshold||Math.abs(u-o)<t.convergenceThreshold)return{root:a,iterations:i+1,converged:!0,error:Math.abs(c)};r(o)*c<0?u=a:o=a,i++}return{root:(o+u)/2,iterations:i,converged:!1,error:Math.abs(r((o+u)/2))}},simpson:function(r,n,t){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;e%2!=0&&e++;for(var o=(t-n)/e,u=r(n)+r(t),i=1;i<e;i++){u+=(i%2==0?2:4)*r(n+i*o)}return o/3*u},derivative:function(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8;return(r(n+t)-r(n-t))/(2*t)}}),r.defineProperty(this,"stats",{mean:function(r){return r.reduce(function(r,n){return r+n},0)/r.length},median:function(n){var t=r.toConsumableArray(n).sort(function(r,n){return r-n}),e=Math.floor(t.length/2);return t.length%2==0?(t[e-1]+t[e])/2:t[e]},stdDev:function(r){var n=t.stats.mean(r),e=r.reduce(function(r,t){return r+Math.pow(t-n,2)},0)/r.length;return Math.sqrt(e)},correlation:function(r,n){for(var e=Math.min(r.length,n.length),o=t.stats.mean(r.slice(0,e)),u=t.stats.mean(n.slice(0,e)),i=0,a=0,c=0,f=0;f<e;f++){var s=r[f]-o,v=n[f]-u;i+=s*v,a+=s*s,c+=v*v}var h=Math.sqrt(a*c);return 0!==h?i/h:0},linearRegression:function(r,n){for(var e=Math.min(r.length,n.length),o=t.stats.mean(r.slice(0,e)),u=t.stats.mean(n.slice(0,e)),i=0,a=0,c=0;c<e;c++){var f=r[c]-o;i+=f*(n[c]-u),a+=f*f}for(var s=0!==a?i/a:0,v=u-s*o,h=0,l=0,d=0;d<e;d++){var M=s*r[d]+v;h+=Math.pow(n[d]-M,2),l+=Math.pow(n[d]-u,2)}return{slope:s,intercept:v,rSquared:0!==l?1-h/l:0,predict:function(r){return s*r+v}}}}),r.defineProperty(this,"utils",{clamp:function(r,n,t){return Math.max(n,Math.min(t,r))},map:function(r,n,t,e,o){return e+(r-n)*(o-e)/(t-n)},approxEqual:function(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.precision;return Math.abs(r-n)<e},round:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=Math.pow(10,n);return Math.round(r*t)/t},range:function(r,n){for(var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,e=[],o=r;o<=n;o+=t)e.push(o);return e},linspace:function(r,n,t){var e=(n-r)/(t-1);return Array.from({length:t},function(n,t){return r+t*e})}}),this.precision=1e-10,this.maxIterations=1e3,this.convergenceThreshold=1e-6},[{key:"setPrecision",value:function(r){this.precision=r}},{key:"setMaxIterations",value:function(r){this.maxIterations=r}},{key:"setConvergenceThreshold",value:function(r){this.convergenceThreshold=r}}])}();exports.Numerics=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("three"),i=require("../core/nameUtils.js");function n(e){if(e&&e.t)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,Object.freeze(t)}var s=n(t),o=function(){return e.createClass(function t(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.classCallCheck(this,t),this.scene=i.scene||null,this.camera=i.camera||null,this.renderer=i.renderer||null,this.controls=i.controls||null,this.transformManager=i.transformManager||null,this.componentManager=i.componentManager||null,this.pathfindingManager=i.pathfindingManager||null,this.currentSceneData=i.currentSceneData||null,this.logger=i.logger||console,this.isInitialized=!1,this.selectedObject=null,this.sceneObjects=[],this.logger.info("🔧 SceneHelper initialized")},[{key:"initialize",value:function(e){this.scene=e.scene,this.camera=e.camera,this.renderer=e.renderer,this.controls=e.controls,this.transformManager=e.transformManager,this.componentManager=e.componentManager,this.pathfindingManager=e.pathfindingManager,this.currentSceneData=e.currentSceneData,this.isInitialized=!0,this.logger.info("✅ SceneHelper initialized with scene components")}},{key:"updateSceneData",value:function(e){this.currentSceneData=e}},{key:"isReady",value:function(){return this.isInitialized&&this.scene&&this.camera&&this.renderer}},{key:"getSceneObjects",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.scene)return this.logger.warn("⚠️ Scene not available for object retrieval"),[];var n=t.includeComponents,s=void 0===n||n,o=t.includeConnectors,r=void 0===o||o,l=t.includeGateways,u=void 0===l||l,a=t.includeHelpers,c=void 0!==a&&a,h=t.includeInvisible,v=void 0!==h&&h,f=t.componentTypesFilter,d=void 0===f?null:f,b=[];return this.scene.traverse(function(t){if(t.userData){var n=t.userData.componentType,o=t.visible;(v||o)&&("component"!==n||s)&&("connector"!==n||r)&&("gateway"!==n||u)&&("helper"!==n||c)&&(d&&Array.isArray(d)&&!d.includes(n)||t.name&&(t.name.includes("helper")||t.name.includes("Helper")||t.name.includes("controls")||"CameraGimbal"===t.name||"GridHelper"===t.type||"AxesHelper"===t.type)||b.push({uuid:i.getHardcodedUuid(t),name:t.name||"Unnamed Object",type:t.type,object:t,componentType:n,position:t.position.clone(),rotation:t.rotation.clone(),scale:t.scale.clone(),visible:o,userData:e.objectSpread2({},t.userData)}))}}),b}},{key:"getSceneObjectsHierarchy",value:function(){if(!this.scene)return this.logger.warn("⚠️ Scene not available for hierarchy retrieval"),[];var e=function(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.name&&(t.name.includes("helper")||t.name.includes("Helper")||t.name.includes("controls")||"CameraGimbal"===t.name)||"GridHelper"===t.type||"AxesHelper"===t.type)return null;var o=null===(n=t.userData)||void 0===n?void 0:n.componentType;if(!("Scene"===t.type||"component"===o||"connector"===o||"gateway"===o)&&"Scene"!==t.type)return null;var r={uuid:i.getHardcodedUuid(t),name:t.name||"Unnamed Object",type:t.type,object:t,componentType:o||"other",level:s,visible:t.visible,children:[]};return t.children&&t.children.length>0&&t.children.forEach(function(t){var i=e(t,s+1);i&&r.children.push(i)}),r},t=[];return this.scene.children&&this.scene.children.length>0&&this.scene.children.forEach(function(i){var n=e(i,0);n&&t.push(n)}),t}},{key:"findObjectByUuid",value:function(e){if(!this.scene||!e)return null;var t=null;return this.scene.traverse(function(n){i.getHardcodedUuid(n)!==e||(t=n)}),t}},{key:"findObjectsByName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.scene||!e)return[];var i=[];return this.scene.traverse(function(n){n.name&&((t?n.name===e:n.name.toLowerCase().includes(e.toLowerCase()))&&i.push(n))}),i}},{key:"findObjectsByComponentType",value:function(e){if(!this.scene||!e)return[];var t=[];return this.scene.traverse(function(i){var n;(null===(n=i.userData)||void 0===n?void 0:n.componentType)===e&&t.push(i)}),t}},{key:"isSelectableObject",value:function(e){var t;if(!e||!e.parent)return!1;var i=null===(t=e.userData)||void 0===t?void 0:t.componentType,n="component"===i,s="connector"===i,o="gateway"===i;return(e.isMesh||e.isObject3D)&&e.visible&&(n||s||o)}},{key:"selectObject",value:function(e){return e&&this.isSelectableObject(e)?(this.selectedObject=e,this.transformManager&&this.transformManager.selectObject(e),this.logger.info("✅ Object selected: ".concat(e.name," (").concat(e.uuid,")")),!0):(this.logger.warn("⚠️ Cannot select invalid object"),!1)}},{key:"deselectObject",value:function(){this.transformManager&&this.transformManager.deselectObject(),this.selectedObject=null,this.logger.info("✅ Object deselected")}},{key:"getSelectedObject",value:function(){return this.selectedObject}},{key:"getSelectedTransform",value:function(){return this.transformManager&&this.selectedObject?this.transformManager.getTransformData():null}},{key:"focusOnObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&this.camera&&this.controls){var i=t.distance,n=void 0===i?10:i,o=t.animate,r=void 0===o||o,l=t.duration,u=void 0===l?1e3:l,a=new s.Vector3;e.getWorldPosition(a);var c=a.clone().add(new s.Vector3(n,n,n));r&&this.controls.transitionTo?this.controls.transitionTo(c,a,u):(this.camera.position.copy(c),this.camera.lookAt(a),this.controls.target&&(this.controls.target.copy(a),this.controls.update())),this.logger.info("🎥 Camera focused on object: ".concat(e.name))}else this.logger.warn("⚠️ Cannot focus on object: missing components")}},{key:"fitAllObjectsInView",value:function(){if(this.camera&&this.controls){var e=new s.Box3,t=this.getSceneObjects({includeHelpers:!1});if(0!==t.length){t.forEach(function(t){var i=t.object;e.expandByObject(i)});var i=e.getCenter(new s.Vector3),n=e.getSize(new s.Vector3),o=Math.max(n.x,n.y,n.z)/(2*Math.tan(Math.PI*this.camera.fov/360));this.camera.position.copy(i),this.camera.position.z+=1.5*o,this.controls.target&&(this.controls.target.copy(i),this.controls.update()),this.logger.info("🎥 Camera fitted to ".concat(t.length," objects"))}else this.logger.warn("⚠️ No objects to fit in view")}else this.logger.warn("⚠️ Cannot fit objects in view: missing camera or controls")}},{key:"getComponentsWithDimensions",value:function(){if(!this.currentSceneData)return[];var e=[];return this.scene.traverse(function(t){t.userData&&"component"===t.userData.componentType&&t.userData.dimensions&&e.push({name:t.name||"Unnamed Component",uuid:i.getHardcodedUuid(t),position:t.position.clone(),rotation:t.rotation.clone(),dimensions:t.userData.dimensions,boundingBox:t.userData.adaptedBoundingBox,libraryId:t.userData.libraryId,object:t})}),e}},{key:"getSceneStats",value:function(){if(!this.scene)return{};var e={totalObjects:0,components:0,connectors:0,gateways:0,meshes:0,materials:0,textures:0,lights:0,cameras:0};return this.scene.traverse(function(t){var i,n,s;e.totalObjects++,"component"===(null===(i=t.userData)||void 0===i?void 0:i.componentType)&&e.components++,"connector"===(null===(n=t.userData)||void 0===n?void 0:n.componentType)&&e.connectors++,"gateway"===(null===(s=t.userData)||void 0===s?void 0:s.componentType)&&e.gateways++,t.isMesh&&e.meshes++,t.isLight&&e.lights++,t.isCamera&&e.cameras++,t.material&&e.materials++}),e}},{key:"debugSceneInfo",value:function(){var e,t=this.getSceneStats(),i=this.getSceneObjects();this.logger.info("🔍 Scene Debug Information:"),this.logger.info(" Statistics:",t),this.logger.info(" Objects:",i.length),this.logger.info(" Selected:",(null===(e=this.selectedObject)||void 0===e?void 0:e.name)||"None"),this.logger.info(" Scene Data:",this.currentSceneData?"Available":"Not Available")}},{key:"hasVisibleObjects",value:function(){var e=this;if(!this.scene)return!1;var t=!1;return this.scene.traverse(function(i){var n;i.visible&&null!==(n=i.userData)&&void 0!==n&&n.componentType&&i!==e.scene&&(t=!0)}),t}},{key:"dispose",value:function(){this.scene=null,this.camera=null,this.renderer=null,this.controls=null,this.transformManager=null,this.componentManager=null,this.pathfindingManager=null,this.currentSceneData=null,this.selectedObject=null,this.sceneObjects=[],this.isInitialized=!1,this.logger.info("🧹 SceneHelper disposed")}}])}();exports.SceneHelper=o,exports.default=o;
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var animationManager = require('./animationManager.js');
|
|
6
|
-
var componentManager = require('./componentManager.js');
|
|
7
|
-
var debugLogger = require('./debugLogger.js');
|
|
8
|
-
var disposalManager = require('./disposalManager.js');
|
|
9
|
-
var environmentManager = require('./environmentManager.js');
|
|
10
|
-
var hotReloadManager = require('./hotReloadManager.js');
|
|
11
|
-
var keyboardControlsManager = require('./keyboardControlsManager.js');
|
|
12
|
-
var nameUtils = require('./nameUtils.js');
|
|
13
|
-
var pathfindingManager = require('./pathfindingManager.js');
|
|
14
|
-
var performanceMonitor = require('./performanceMonitor.js');
|
|
15
|
-
var sceneExportManager = require('./sceneExportManager.js');
|
|
16
|
-
var sceneInitializationManager = require('./sceneInitializationManager.js');
|
|
17
|
-
var textureConfig = require('./textureConfig.js');
|
|
18
|
-
var transformControlsManager = require('./transformControlsManager.js');
|
|
19
|
-
|
|
20
|
-
// Import all utility modules
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Central API object that provides access to all utility modules
|
|
24
|
-
* @type {Object}
|
|
25
|
-
* @property {Object} animation - Animation management utilities
|
|
26
|
-
* @property {Object} component - Component management utilities
|
|
27
|
-
* @property {Object} debug - Debugging and logging utilities
|
|
28
|
-
* @property {Object} disposal - Resource disposal utilities
|
|
29
|
-
* @property {Object} environment - 3D environment management utilities
|
|
30
|
-
* @property {Object} hotReload - Hot reload handling utilities
|
|
31
|
-
* @property {Object} keyboardControls - Keyboard controls management
|
|
32
|
-
* @property {Object} name - Name and UUID management utilities
|
|
33
|
-
* @property {Object} pathfinding - Pathfinding utilities
|
|
34
|
-
* @property {Object} performance - Performance monitoring utilities
|
|
35
|
-
* @property {Object} sceneExport - Scene export utilities
|
|
36
|
-
* @property {Object} sceneInitialization - Scene initialization utilities
|
|
37
|
-
* @property {Object} texture - Texture management utilities
|
|
38
|
-
* @property {Object} transformControls - Transform controls utilities
|
|
39
|
-
*/
|
|
40
|
-
var CentralPlantUtils = {
|
|
41
|
-
animation: animationManager,
|
|
42
|
-
component: componentManager,
|
|
43
|
-
debug: debugLogger,
|
|
44
|
-
disposal: disposalManager,
|
|
45
|
-
environment: environmentManager,
|
|
46
|
-
hotReload: hotReloadManager,
|
|
47
|
-
keyboardControls: keyboardControlsManager,
|
|
48
|
-
name: nameUtils,
|
|
49
|
-
pathfinding: pathfindingManager,
|
|
50
|
-
performance: performanceMonitor,
|
|
51
|
-
sceneExport: sceneExportManager,
|
|
52
|
-
sceneInitialization: sceneInitializationManager,
|
|
53
|
-
texture: textureConfig,
|
|
54
|
-
transformControls: transformControlsManager
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
exports.animationManager = animationManager;
|
|
58
|
-
exports.componentManager = componentManager;
|
|
59
|
-
exports.debugLogger = debugLogger;
|
|
60
|
-
exports.logger = debugLogger.logger;
|
|
61
|
-
exports.modelLogger = debugLogger.modelLogger;
|
|
62
|
-
exports.pathfinderLogger = debugLogger.pathfinderLogger;
|
|
63
|
-
exports.transformLogger = debugLogger.transformLogger;
|
|
64
|
-
exports.disposalManager = disposalManager;
|
|
65
|
-
exports.environmentManager = environmentManager;
|
|
66
|
-
exports.hotReloadManager = hotReloadManager;
|
|
67
|
-
exports.keyboardControlsManager = keyboardControlsManager;
|
|
68
|
-
exports.findObjectByHardcodedUuid = nameUtils.findObjectByHardcodedUuid;
|
|
69
|
-
exports.generateUuidFromName = nameUtils.generateUuidFromName;
|
|
70
|
-
exports.getHardcodedUuid = nameUtils.getHardcodedUuid;
|
|
71
|
-
exports.nameUtils = nameUtils;
|
|
72
|
-
exports.pathfindingManager = pathfindingManager;
|
|
73
|
-
exports.getSceneExportManager = sceneExportManager.getSceneExportManager;
|
|
74
|
-
exports.sceneExportManager = sceneExportManager;
|
|
75
|
-
exports.sceneInitializationManager = sceneInitializationManager;
|
|
76
|
-
exports.textureConfig = textureConfig;
|
|
77
|
-
exports.getTransformControlsManager = transformControlsManager.getTransformControlsManager;
|
|
78
|
-
exports.transformControlsManager = transformControlsManager;
|
|
79
|
-
exports["default"] = CentralPlantUtils;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"o",{value:!0});var e=require("./core/centralPlant.js"),r=require("./core/debugLogger.js"),s=require("./core/nameUtils.js"),a=require("./core/mathUtils.js"),n=require("./managers/scene/sceneInitializationManager.js"),o=require("./managers/scene/sceneOperationsManager.js"),t=require("./managers/scene/sceneExportManager.js"),i=require("./managers/scene/sceneTooltipsManager.js"),p=require("./managers/components/componentManager.js"),g=require("./managers/components/animationManager.js"),x=require("./managers/components/pathfindingManager.js"),m=require("./managers/controls/transformControlsManager.js"),u=require("./managers/controls/keyboardControlsManager.js"),j=require("./managers/controls/cameraControlsManager.js"),q=require("./managers/controls/dragDropManager.js"),c=require("./managers/environment/environmentManager.js"),l=require("./managers/environment/textureConfig.js"),d=require("./managers/system/hotReloadManager.js"),M=require("./managers/system/disposalManager.js"),y=require("./managers/system/performanceMonitor.js"),v=require("./rendering/modelPreloader.js"),f=require("./rendering/rendering2D.js"),C=require("./rendering/rendering3D.js"),b=require("./data/import.js"),h=require("./data/export.js"),D=require("./data/numerics.js"),O=require("./analysis/analysis.js"),P=require("./analysis/testing.js");exports.CentralPlant=e.CentralPlant,exports.DebugLogger=r.DebugLogger,exports.logger=r.logger,exports.modelLogger=r.modelLogger,exports.pathfinderLogger=r.pathfinderLogger,exports.transformLogger=r.transformLogger,exports.findObjectByHardcodedUuid=s.findObjectByHardcodedUuid,exports.generateUuidFromName=s.generateUuidFromName,exports.getHardcodedUuid=s.getHardcodedUuid,exports.MathUtils=a.MathUtils,exports.SceneInitializationManager=n.SceneInitializationManager,exports.SceneOperationsManager=o.SceneOperationsManager,exports.SceneExportManager=t.SceneExportManager,exports.SceneTooltipsManager=i.SceneTooltipsManager,exports.ComponentManager=p.ComponentManager,exports.AnimationManager=g.AnimationManager,exports.PathfindingManager=x.PathfindingManager,exports.createTransformControls=m.createTransformControls,exports.KeyboardControlsManager=u.KeyboardControlsManager,exports.CameraControlsManager=j.CameraControlsManager,exports.DragDropManager=q.default,exports.EnvironmentManager=c.EnvironmentManager,exports.loadTextureSetAndCreateMaterial=l.loadTextureSetAndCreateMaterial,exports.HotReloadManager=d.HotReloadManager,exports.DisposalManager=M.DisposalManager,exports.PerformanceMonitor=y.PerformanceMonitor,exports.modelPreloader=v.default,exports.Rendering2D=f,exports.Rendering3D=C,exports.ImportUtils=b,exports.ExportUtils=h,exports.Numerics=D,exports.Analysis=O,exports.Testing=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("../../../_virtual/_rollupPluginBabelHelpers.js"),e=require("../../core/debugLogger.js"),i=function(){return t.createClass(function e(i){t.classCallCheck(this,e),this.sceneViewer=i,this.lastFrameTime=0,this.targetFPS=60,this.frameInterval=1e3/this.targetFPS,this.animationId=null},[{key:"startAnimation",value:function(){var t=this,i=this.sceneViewer,n=function(e){i.isDestroyed||(t.animationId=requestAnimationFrame(n),e-t.lastFrameTime<t.frameInterval||(t.lastFrameTime=e,!i.isDestroyed&&i.controls&&i.renderer&&i.scene&&i.camera&&t.updateFrame()))};n(0),e.logger.info("Animation loop started")}},{key:"updateFrame",value:function(){var t=this.sceneViewer;t.controls.update(),t.performanceMonitor&&(t.performanceMonitor.update(),t.performanceMonitor.updateSceneStats(t.scene)),t.renderer.render(t.scene,t.camera),t.tooltipsManager&&t.tooltipsManager.render()}},{key:"stopAnimation",value:function(){this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null,e.logger.info("Animation loop stopped"))}},{key:"setTargetFPS",value:function(t){this.targetFPS=t,this.frameInterval=1e3/this.targetFPS,e.logger.info("Target FPS set to: ".concat(t))}},{key:"getCurrentFPS",value:function(){var t=this.sceneViewer;return t.performanceMonitor?t.performanceMonitor.getCurrentFPS():null}},{key:"dispose",value:function(){this.stopAnimation(),this.lastFrameTime=0,e.logger.info("AnimationManager disposed")}}])}();exports.AnimationManager=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"i",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js");require("three");var n=require("../../core/nameUtils.js"),r=require("../../rendering/modelPreloader.js"),i=function(){return e.createClass(function n(r){e.classCallCheck(this,n),this.sceneViewer=r},[{key:"addComponentToScene",value:(i=e.asyncToGenerator(e.regenerator().m(function n(i){var o,t,u,a,l,d,c,s,v,f,m=this;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:if(n.p=0,i.libraryId&&i.modelKey){n.n=1;break}return n.a(2,!1);case 1:return t=i.libraryId+"-"+Date.now()+"-"+Math.random().toString(36).substr(2,9),u={},n.p=2,n.n=3,fetch("./library/component-dictionary.json");case 3:return a=n.v,n.n=4,a.json();case 4:u=n.v,n.n=6;break;case 5:return n.p=5,n.v,n.a(2,!1);case 6:if(l=u[i.libraryId]){n.n=7;break}return n.a(2,!1);case 7:if(d=i.position||{x:0,y:0,z:0},c=r.default.getCachedModelWithDimensions(l.modelKey,i.libraryId)){n.n=11;break}return n.p=8,n.n=9,new Promise(function(e,n){m.sceneViewer.gltfLoader.load("./library/models/".concat(l.modelKey),e,void 0,n)});case 9:s=n.v,c=s.scene,c=r.default.addDimensionsToModel(c,i.libraryId),n.n=11;break;case 10:return n.p=10,n.v,n.a(2,!1);case 11:return(v=c.clone()).uuid=t,v.name=(i.uuid||i.libraryId)+" Component",v.position.set(d.x,d.y,d.z),v.userData=e.objectSpread2({libraryId:i.libraryId,componentType:"component",forExport:!0,originalUuid:t},(null===(o=c.userData)||void 0===o?void 0:o.dimensions)&&{dimensions:c.userData.dimensions}),l.boundingBox&&(v.userData.dimensions={x:l.boundingBox.x,y:l.boundingBox.y,z:l.boundingBox.z}),l.adaptedBoundingBox&&(v.userData.adaptedBoundingBox={x:l.adaptedBoundingBox.x,y:l.adaptedBoundingBox.y,z:l.adaptedBoundingBox.z}),v.traverse(function(e){e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material&&(e.material.envMapIntensity=1),e.name&&e.name.toLowerCase().includes("connector")&&(e.userData||(e.userData={}),e.userData.forExport=!0,e.userData.componentType="connector"))}),this.sceneViewer.scene.add(v),"undefined"!=typeof window&&(f=new CustomEvent("componentAdded",{detail:{component:v,libraryId:i.libraryId,uuid:t,position:v.position,dimensions:v.userData.dimensions}}),window.dispatchEvent(f)),this.sceneViewer.enableTransformControls&&this.sceneViewer.enableTransformControls(),n.a(2,!0);case 12:return n.p=12,n.v,n.a(2,!1)}},n,this,[[8,10],[2,5],[0,12]])})),function(e){return i.apply(this,arguments)})},{key:"removeComponentFromScene",value:function(e){try{var r=n.findObjectByHardcodedUuid(this.sceneViewer.scene,e);if(!r)return!1;if(r.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(function(e){return e.dispose()}):e.material.dispose())}),this.sceneViewer.scene.remove(r),"undefined"!=typeof window){var i,o=new CustomEvent("componentRemoved",{detail:{uuid:e,name:r.name,libraryId:null===(i=r.userData)||void 0===i?void 0:i.libraryId}});window.dispatchEvent(o)}return!0}catch(e){return!1}}},{key:"getSceneComponents",value:function(){var e=[];return this.sceneViewer.scene.traverse(function(n){var r,i;"component"===(null===(r=n.userData)||void 0===r?void 0:r.componentType)&&e.push({uuid:(null===(i=n.userData)||void 0===i?void 0:i.originalUuid)||n.uuid,name:n.name,libraryId:n.userData.libraryId,position:{x:n.position.x,y:n.position.y,z:n.position.z},rotation:{x:n.rotation.x,y:n.rotation.y,z:n.rotation.z},scale:{x:n.scale.x,y:n.scale.y,z:n.scale.z}})}),e}},{key:"updateComponent",value:function(e,r){try{var i,o,t,u,a,l,d,c,s,v=n.findObjectByHardcodedUuid(this.sceneViewer.scene,e);if(!v)return!1;if(r.position)v.position.set(null!==(i=r.position.x)&&void 0!==i?i:v.position.x,null!==(o=r.position.y)&&void 0!==o?o:v.position.y,null!==(t=r.position.z)&&void 0!==t?t:v.position.z);if(r.rotation)v.rotation.set(null!==(u=r.rotation.x)&&void 0!==u?u:v.rotation.x,null!==(a=r.rotation.y)&&void 0!==a?a:v.rotation.y,null!==(l=r.rotation.z)&&void 0!==l?l:v.rotation.z);if(r.scale)v.scale.set(null!==(d=r.scale.x)&&void 0!==d?d:v.scale.x,null!==(c=r.scale.y)&&void 0!==c?c:v.scale.y,null!==(s=r.scale.z)&&void 0!==s?s:v.scale.z);return r.name&&(v.name=r.name),!0}catch(e){return!1}}}]);var i}();exports.ComponentManager=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js"),n=require("three"),t=require("../../../node_modules/@2112-lab/pathfinder/dist/index.esm.js"),r=require("../../core/debugLogger.js"),i=require("../../core/nameUtils.js");function o(e){if(e&&e.t)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var a=o(n),u=function(){return e.createClass(function n(t){e.classCallCheck(this,n),this.sceneViewer=t,this.pathfinder=null,this.crosscubeTextureSet=null,this.pathfinderVersionInfo=null,this.pathfinderConfig={grid:{size:.5,safetyMargin:0,minSegmentLength:.5,timeout:1e3}}},[{key:"getPathfinderVersionInfo",value:(l=e.asyncToGenerator(e.regenerator().m(function n(){var t;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:if(!this.pathfinderVersionInfo){e.n=1;break}return e.a(2,this.pathfinderVersionInfo);case 1:return t={version:"1.0.17",detectionMethod:"hardcoded-fallback",timestamp:(new Date).toISOString()},this.pathfinderVersionInfo=t,e.a(2,t)}},n,this)})),function(){return l.apply(this,arguments)})},{key:"logPathfinderVersion",value:(c=e.asyncToGenerator(e.regenerator().m(function n(){var t,i,o,a=arguments;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:"Unknown Context",e.p=1,e.n=2,this.getPathfinderVersionInfo();case 2:i=e.v,r.pathfinderLogger.info("[".concat(t,"] Pathfinder Module Information:"),{version:i.version,detectionMethod:i.detectionMethod,context:t,timestamp:i.timestamp,pathfinderInstance:!!this.pathfinder}),e.n=4;break;case 3:e.p=3,o=e.v,r.pathfinderLogger.error("[".concat(t,"] Failed to get pathfinder version:"),o);case 4:return e.a(2)}},n,this,[[1,3]])})),function(){return c.apply(this,arguments)})},{key:"getPathColor",value:function(e){var n=["#468e49","#245e29","#2e80d2","#1d51a1"];return n[e%n.length]}},{key:"_executePathfinding",value:(s=e.asyncToGenerator(e.regenerator().m(function n(r,i){var o,u,s,c,l,v,f,d=this,h=arguments;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return u=(o=h.length>2&&void 0!==h[2]?h[2]:{}).createGateways,s=void 0!==u&&u,c=o.context,l=void 0===c?"Pathfinding":c,e.n=1,this.logPathfinderVersion(l);case 1:return this.pathfinder=new t.Pathfinder(this.pathfinderConfig),this.sceneViewer.pathfinder=this.pathfinder,r.object.children=r.object.children.filter(function(e){return"computed"!==e.userData.origin}),v=this.pathfinder.findPaths(r,i),s&&v.gateways&&v.gateways.forEach(function(e){if(e.position){var n=new a.Mesh(new a.SphereGeometry(.15,16,16),new a.MeshStandardMaterial({color:16777215,roughness:.7,metalness:.3,emissive:0}));n.position.copy(e.position),n.name=e.id,n.uuid=e.id,n.userData={componentType:"gateway",forExport:!0,gatewayId:e.id,originalUuid:e.id,origin:"computed",connections:e.connections},d.sceneViewer.scene.add(n)}}),f=this.mergeColinearPaths(v.paths),this.createPipePaths(f,this.crosscubeTextureSet),e.a(2,v)}},n,this)})),function(e,n){return s.apply(this,arguments)})},{key:"initializePathfinder",value:(u=e.asyncToGenerator(e.regenerator().m(function n(t,r){var i;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return this.crosscubeTextureSet=r,e.n=1,this.i(t.scene,t.connections,{createGateways:!0,context:"Scene Loading"});case 1:return(i=e.v).rewiredConnections,e.a(2,i)}},n,this)})),function(e,n){return u.apply(this,arguments)})},{key:"removeComputedObjects",value:function(){var e=this.sceneViewer,n=[];e.scene.traverse(function(e){if(e.name&&e.name.includes("Polyline")){var t=!1,r=[];if(e.traverse(function(e){e.userData&&e.userData.isPipeSegment&&e.userData.isManuallyPositioned&&(t=!0,r.push(e))}),t){var i=[];e.traverse(function(e){(e.userData&&e.userData.isPipeSegment&&!e.userData.isManuallyPositioned||e.userData&&e.userData.isPipeElbow)&&i.push(e)}),i.forEach(function(n){e.remove(n),n.geometry&&n.geometry.dispose(),n.material&&(Array.isArray(n.material)?n.material.forEach(function(e){return e.dispose()}):n.material.dispose())}),0===e.children.length&&n.push(e)}else n.push(e)}e.userData&&"computed"===e.userData.origin&&n.push(e)});for(var t=0,r=n;t<r.length;t++){var i=r[t];e.scene.remove(i),i.geometry&&i.geometry.dispose(),i.material&&(Array.isArray(i.material)?i.material.forEach(function(e){return e.dispose()}):i.material.dispose())}}},{key:"createPipeMaterial",value:function(n,t){if(n){var r=e.objectSpread2(e.objectSpread2({},n.config.materialProps),{},{color:this.getPathColor(t),map:n.textures.diffuse,normalMap:n.textures.normal,roughnessMap:n.textures.roughness,metalness:.2,roughness:.9,clearcoat:.2,clearcoatRoughness:.2,envMapIntensity:.6,reflectivity:.4});r.normalScale&&Array.isArray(r.normalScale)&&(r.normalScale=e.construct(a.Vector2,e.toConsumableArray(r.normalScale)));var i=new a.MeshPhysicalMaterial(r);return[i.map,i.normalMap,i.roughnessMap].filter(Boolean).forEach(function(e){e.wrapS=e.wrapT=a.RepeatWrapping,e.repeat.set(2*n.config.repeat.x,2*n.config.repeat.y)}),i}return new a.MeshPhysicalMaterial({color:this.getPathColor(t),metalness:.9,roughness:.7,clearcoat:.1,clearcoatRoughness:.3,envMapIntensity:1.5,reflectivity:.3})}},{key:"createPipePaths",value:function(e,n){var t=this,r=this.sceneViewer;e.forEach(function(e,i){if(e.path&&e.path.length>=2){var o=new a.Object3D;o.name="Polyline ".concat(e.from,"-").concat(e.to);for(var u=t.createPipeMaterial(n,i),s=e.path.map(function(e){return e instanceof a.Vector3?e.clone():Array.isArray(e)?(new a.Vector3).fromArray(e):void 0!==e.x&&void 0!==e.y&&void 0!==e.z?new a.Vector3(e.x,e.y,e.z):new a.Vector3(0,0,0)}),c=function(n){var c=s[n],l=s[n+1],v=(new a.Vector3).subVectors(l,c),f=v.length();if(f<1e-6)return 0;var d=!1;if(r.scene.traverse(function(t){t.userData&&t.userData.isPipeSegment&&t.userData.isManuallyPositioned&&t.userData.segmentId==="pipe-segment-".concat(e.from,"-").concat(e.to,"-").concat(n)&&(d=!0)}),d)return 0;var h=new a.CylinderGeometry(.1,.1,f,8,1,!1),y=new a.Mesh(h,u);y.position.copy(c).add(l).multiplyScalar(.5);var m=new a.Quaternion,p=new a.Vector3(0,1,0);m.setFromUnitVectors(p,v.clone().normalize()),y.quaternion.copy(m),y.castShadow=!0,y.receiveShadow=!0;var g="pipe-segment-".concat(e.from,"-").concat(e.to,"-").concat(n);if(y.name="Pipe Segment ".concat(n+1,": ").concat(e.from,"-").concat(e.to),y.userData={isPipeSegment:!0,segmentId:g,segmentIndex:n,pathFrom:e.from,pathTo:e.to,pathIndex:i,length:f.toFixed(2),component:{type:"PipeSegment",attributes:{length:{key:"Length",value:f.toFixed(2),unit:"m"}}}},o.add(y),n<s.length-2){var w=s[n+1].clone().sub(s[n]).normalize(),k=s[n+2].clone().sub(s[n+1]).normalize(),b=w.angleTo(k);if(b>Math.PI/36){var x=t.createElbowGeometry(s[n],s[n+1],s[n+2],.1);if(x){var P=new a.Mesh(x,u);P.castShadow=!0,P.receiveShadow=!0;var M="pipe-elbow-".concat(e.from,"-").concat(e.to,"-").concat(n);P.name="Pipe Elbow ".concat(n+1,": ").concat(e.from,"-").concat(e.to),P.userData={isPipeElbow:!0,elbowId:M,elbowIndex:n,pathFrom:e.from,pathTo:e.to,pathIndex:i,angle:(180*b/Math.PI).toFixed(1),component:{type:"PipeElbow",attributes:{angle:{key:"Bend Angle",value:(180*b/Math.PI).toFixed(1),unit:"°"}}}},o.add(P)}}}},l=0;l<s.length-1;l++)c(l);o.name="Polyline",r.scene.add(o)}})}},{key:"handleManualSegmentTransformation",value:function(e,n){if(e&&e.userData&&e.userData.isPipeSegment){var t=this.calculateSegmentEndpoints(e),r=this.createSegmentConnectors(e,t);this.addConnectorsToScene(r),this.convertConnectedGatewaysToManual(r,n);var i=this.findOriginalConnection(e,n.connections);i&&(this.restructureConnections(i,r,n),e.userData.isManuallyPositioned=!0,e.userData.manualConnectors=r.map(function(e){return e.uuid}),this.addManualSegmentToSceneData(e))}}},{key:"convertConnectedGatewaysToManual",value:function(e,n){var t,r,i=this,o=this.sceneViewer,a=[],u=null!==(t=e[0])&&void 0!==t&&null!==(t=t.userData)&&void 0!==t&&t.manualSegmentUuid?o.scene.getObjectByProperty("uuid",e[0].userData.manualSegmentUuid):null;u&&null!==(r=u.userData)&&void 0!==r&&r.isPipeSegment&&([u.userData.pathFrom,u.userData.pathTo].forEach(function(e){var t,r,u=null;(o.scene.traverse(function(n){var t;n.uuid!==e&&(null===(t=n.userData)||void 0===t?void 0:t.originalUuid)!==e||(u=n)}),u)&&("gateway"===(null===(t=u.userData)||void 0===t?void 0:t.componentType)&&"computed"===(null===(r=u.userData)||void 0===r?void 0:r.origin)&&(i.convertGatewayToManual(u,n),a.push(u)))}),a.length)}},{key:"convertGatewayToManual",value:function(e,n){var t;e.userData.origin="declared";for(var r=0;r<n.scene.object.children.length;r++){var i,o,a=n.scene.object.children[r];if(a.uuid===e.uuid||a.uuid===(null===(i=e.userData)||void 0===i?void 0:i.originalUuid)||e.uuid===(null===(o=a.userData)||void 0===o?void 0:o.originalUuid)){a.userData||(a.userData={}),a.userData.origin="declared";break}}if(null!==(t=e.userData)&&void 0!==t&&t.connections&&n.connections){var u=e.userData.connections,s=n.connections;u.removed&&Array.isArray(u.removed)&&(n.connections=s.filter(function(e){var n=u.removed.some(function(n){return n.from===e.from&&n.to===e.to||n.from===e.to&&n.to===e.from});return!n})),u.added&&Array.isArray(u.added)&&u.added.forEach(function(e){n.connections.some(function(n){return n.from===e.from&&n.to===e.to||n.from===e.to&&n.to===e.from})||n.connections.push(e)})}}},{key:"findOriginalConnection",value:function(e,n){var t=e.userData,r=t.pathFrom,i=t.pathTo,o=n.find(function(e){return e.from===r&&e.to===i||e.from===i&&e.to===r});if(o)return o;var a=this.sceneViewer,u=null,s=null;if(a.scene.traverse(function(e){var n,t;e.uuid!==r&&(null===(n=e.userData)||void 0===n?void 0:n.originalUuid)!==r||(u=e),e.uuid!==i&&(null===(t=e.userData)||void 0===t?void 0:t.originalUuid)!==i||(s=e)}),u&&s&&(o=n.find(function(e){return e.from===u.uuid&&e.to===s.uuid||e.from===s.uuid&&e.to===u.uuid})))return o;var c=n.filter(function(e){var n,t,o=e.from===r||e.from===i,u=e.to===r||e.to===i,s="gateway"===(null===(n=a.scene.getObjectByProperty("uuid",e.from))||void 0===n||null===(n=n.userData)||void 0===n?void 0:n.componentType),c="gateway"===(null===(t=a.scene.getObjectByProperty("uuid",e.to))||void 0===t||null===(t=t.userData)||void 0===t?void 0:t.componentType);return o||u||s||c});return c.length>0?c[0]:null}},{key:"calculateSegmentEndpoints",value:function(e){var n=e.geometry.parameters.height||1,t=new a.Vector3,r=new a.Vector3,i=new a.Vector3(0,1,0);return i.applyQuaternion(e.quaternion),t.copy(e.position).sub(i.clone().multiplyScalar(n/2)),r.copy(e.position).add(i.clone().multiplyScalar(n/2)),{start:t,end:r}}},{key:"createSegmentConnectors",value:function(e,n){var t=e.userData.segmentId,r=[],i=new a.Mesh(new a.SphereGeometry(.2,16,16),new a.MeshStandardMaterial({color:65280,roughness:.7,metalness:.3,emissive:13056}));i.position.copy(n.start),i.uuid="".concat(t,"-connector-start"),i.name="Manual Segment Start Connector: ".concat(e.name),i.userData={componentType:"connector",forExport:!0,isManualSegmentConnector:!0,segmentId:t,connectorType:"start",manualSegmentUuid:e.uuid};var o=new a.Mesh(new a.SphereGeometry(.2,16,16),new a.MeshStandardMaterial({color:16711680,roughness:.7,metalness:.3,emissive:3342336}));return o.position.copy(n.end),o.uuid="".concat(t,"-connector-end"),o.name="Manual Segment End Connector: ".concat(e.name),o.userData={componentType:"connector",forExport:!0,isManualSegmentConnector:!0,segmentId:t,connectorType:"end",manualSegmentUuid:e.uuid},r.push(i,o),r}},{key:"addConnectorsToScene",value:function(n){var t=this.sceneViewer;n.forEach(function(n){if(t.scene.add(n),t.currentSceneData&&t.currentSceneData.scene&&t.currentSceneData.scene.object){var r={uuid:n.uuid,name:n.name,type:n.type,userData:e.objectSpread2({},n.userData),position:{x:n.position.x,y:n.position.y,z:n.position.z},rotation:{x:n.rotation.x,y:n.rotation.y,z:n.rotation.z},scale:{x:n.scale.x,y:n.scale.y,z:n.scale.z},geometry:"CONNECTOR-GEO"};t.currentSceneData.scene.object.children.push(r)}})}},{key:"addManualSegmentToSceneData",value:function(n){var t=this.sceneViewer;if(t.currentSceneData&&t.currentSceneData.scene&&t.currentSceneData.scene.object){var r={uuid:n.uuid,name:n.name,type:n.type,userData:e.objectSpread2({},n.userData),position:{x:n.position.x,y:n.position.y,z:n.position.z},rotation:{x:n.rotation.x,y:n.rotation.y,z:n.rotation.z},scale:{x:n.scale.x,y:n.scale.y,z:n.scale.z}};t.currentSceneData.scene.object.children.push(r)}}},{key:"restructureConnections",value:function(n,t,r){var i=e.slicedToArray(t,2),o=i[0],a=i[1],u=r.connections.findIndex(function(e){return e.from===n.from&&e.to===n.to||e.from===n.to&&e.to===n.from});if(-1!==u){r.connections.splice(u,1);var s={from:n.from,to:o.uuid},c={from:a.uuid,to:n.to};r.connections.push(s,c),this.sceneViewer.currentSceneData&&(this.sceneViewer.currentSceneData.connections=e.toConsumableArray(r.connections))}}},{key:"createElbowGeometry",value:function(e,n,t,r){try{var i=3*r,o=this.createElbowCurve(e,n,t,i);return new a.TubeGeometry(o,12,r,8,!1)}catch(e){return null}}},{key:"createElbowCurve",value:function(e,n,t,r){var i=n.clone().sub(e).normalize(),o=t.clone().sub(n).normalize(),u=.001*r,s=n.clone().sub(i.clone().multiplyScalar(u)),c=n.clone().add(o.clone().multiplyScalar(u)),l=n.clone();return new a.QuadraticBezierCurve3(s,l,c)}},{key:"recomputeWorldBoundingBoxes",value:function(n){this.sceneViewer.scene.traverse(function(t){if(t.isMesh){var r=null,o=function(n){var r,a=e.createForOfIteratorHelper(n);try{for(a.s();!(r=a.n()).done;){var u,s,c=r.value;if(c.uuid===t.uuid||c.uuid===(null===(u=t.userData)||void 0===u?void 0:u.originalUuid)||t.uuid===(null===(s=c.userData)||void 0===s?void 0:s.originalUuid))return c;if(t.name&&c.name){var l=i.generateUuidFromName(t.name),v=i.generateUuidFromName(c.name);if(l===v||l===c.uuid||v===t.uuid)return c}if(t.name&&c.name&&t.name===c.name)return c;if(c.children){var f=o(c.children);if(f)return f}}}catch(e){a.e(e)}finally{a.f()}return null};if(r=o(n.scene.object.children)){var u=(new a.Box3).setFromObject(t);r.userData||(r.userData={}),r.userData.worldBoundingBox={min:u.min.toArray(),max:u.max.toArray()},r.userData.origin||(r.userData.origin=t.userData.origin),r.userData.direction||(r.userData.direction=t.userData.direction),r.userData.group||(r.userData.group=t.userData.group),r.userData.connections||(r.userData.connections=t.userData.connections),t.userData.associatedJsonObject=r}}})}},{key:"updatePathfindingWithConnections",value:(o=e.asyncToGenerator(e.regenerator().m(function n(t){var r,i;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:if((r=this.sceneViewer).currentSceneData){n.n=1;break}return n.a(2,!1);case 1:return this.removeComputedObjects(),(i=JSON.parse(JSON.stringify(r.currentSceneData))).connections=e.toConsumableArray(t),n.n=2,this.i(i.scene,i.connections,{createGateways:!1,context:"Connections Update"});case 2:return r.currentSceneData=i,n.a(2,!0)}},n,this)})),function(e){return o.apply(this,arguments)})},{key:"updatePathfindingAfterTransform",value:(n=e.asyncToGenerator(e.regenerator().m(function n(t){return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return this.removeComputedObjects(),e.n=1,this.i(t.scene,t.connections,{createGateways:!0,context:"Transform Update"});case 1:return e.a(2)}},n,this)})),function(e){return n.apply(this,arguments)})},{key:"dispose",value:function(){this.removeComputedObjects(),this.pathfinder=null,this.crosscubeTextureSet=null,this.pathfinderVersionInfo=null,r.logger.info("PathfindingManager disposed")}},{key:"mergeColinearPaths",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.001,t=JSON.parse(JSON.stringify(e));return t.forEach(function(e){if(e.path&&!(e.path.length<=2)){var t=e.path.map(function(e){return e instanceof a.Vector3?e.clone():Array.isArray(e)?(new a.Vector3).fromArray(e):void 0!==e.x&&void 0!==e.y&&void 0!==e.z?new a.Vector3(e.x,e.y,e.z):new a.Vector3(0,0,0)});if(!(t.length<=2)){for(var r=[t[0]],i=0,o=function(){var e=t[i],o=t[i+1],u=(new a.Vector3).subVectors(o,e);if(u.length()<1e-6)return i++,1;u.normalize();for(var s=i+2;s<t.length;){var c=t[s],l=(new a.Vector3).subVectors(c,e);if(l.length()<1e-6)s++;else{l.normalize();var v=u.dot(l);if(!(Math.abs(v-1)<n))break;o=c,s++}}o.equals(e)||r.push(o);var f=t.findIndex(function(e,n){return n>i&&e.equals(o)});-1===f?i++:i=f};i<t.length-1;)o();var u=r.map(function(n){return Array.isArray(e.path[0])?[n.x,n.y,n.z]:void 0!==e.path[0].x?{x:n.x,y:n.y,z:n.z}:n});e.path=u;t.length,r.length}}}),t}}]);var n,o,u,s,c,l}();exports.PathfindingManager=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("../../../_virtual/_rollupPluginBabelHelpers.js"),e=require("three"),i=new e.Raycaster,h=new e.Vector3,n=new e.Vector3,s=new e.Quaternion,a={X:new e.Vector3(1,0,0),Y:new e.Vector3(0,1,0),Z:new e.Vector3(0,0,1)},r={type:"change"},w={type:"mouseDown"},o={type:"mouseUp",mode:null},l={type:"objectChange"},u=function(u){function d(i,h){var n;t.classCallCheck(this,d),n=t.callSuper(this,d),void 0===h&&(h=document),n.isTransformControls=!0,n.visible=!1,n.domElement=h,n.domElement.style.touchAction="none";var s=new W;n.i=s,n.add(s);var a=new j;n.h=a,n.add(a);var w=n;function o(t,e){var i=e;Object.defineProperty(w,t,{get:function(){return void 0!==i?i:e},set:function(e){i!==e&&(i=e,a[t]=e,s[t]=e,w.dispatchEvent({type:t+"-changed",value:e}),w.dispatchEvent(r))}}),w[t]=e,a[t]=e,s[t]=e}o("camera",i),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0),o("showXY",!0),o("showYZ",!0),o("showXZ",!0),n.clickDelay=null,n.lastInteractionTime=0;var l=new e.Vector3,u=new e.Vector3,X=new e.Quaternion,Y=new e.Quaternion,Z=new e.Vector3,y=new e.Quaternion,k=new e.Vector3,m=new e.Vector3,E=new e.Vector3,b=new e.Vector3;return o("worldPosition",l),o("worldPositionStart",u),o("worldQuaternion",X),o("worldQuaternionStart",Y),o("cameraPosition",Z),o("cameraQuaternion",y),o("pointStart",k),o("pointEnd",m),o("rotationAxis",E),o("rotationAngle",0),o("eye",b),n.o=new e.Vector3,n.l=new e.Vector3,n.u=new e.Vector3,n.M=new e.Vector3,n.v=new e.Vector3,n.p=new e.Quaternion,n.k=new e.Quaternion,n.m=new e.Vector3,n.S=new e.Vector3,n.T=new e.Quaternion,n.D=new e.Vector3,n.A=new e.Vector3,n.W=new e.Quaternion,n.j=new e.Vector3,n.P=c.bind(n),n.R=v.bind(n),n._=M.bind(n),n.C=p.bind(n),n.I=f.bind(n),n.domElement.addEventListener("pointerdown",n.R),n.domElement.addEventListener("pointermove",n._),n.domElement.addEventListener("pointerup",n.I),n}return t.inherits(d,u),t.createClass(d,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent||this.object.parent.matrixWorld.decompose(this.v,this.p,this.m),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.D),this.k.copy(this.p).invert(),this.T.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.M),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),t.superPropGet(d,"updateMatrixWorld",this,3)([this])}},{key:"pointerHover",value:function(t){if(void 0!==this.object&&!0!==this.dragging){if(this.clickDelay&&this.clickDelay.doubleClickDelay)if(Date.now()-this.lastInteractionTime<this.clickDelay.doubleClickDelay)return;i.setFromCamera(t,this.camera);var e=X(this.i.picker[this.mode],i);this.axis=e?e.object.name:null}}},{key:"pointerDown",value:function(t){if(void 0!==this.object&&!0!==this.dragging&&0===t.button){if(this.clickDelay&&this.clickDelay.doubleClickDelay){var e=Date.now();if(e-this.lastInteractionTime<this.clickDelay.doubleClickDelay)return;this.lastInteractionTime=e}if(null!==this.axis){i.setFromCamera(t,this.camera);var h=X(this.h,i,!0);h&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this.A.copy(this.object.position),this.W.copy(this.object.quaternion),this.j.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.S),this.pointStart.copy(h.point).sub(this.worldPositionStart)),this.dragging=!0,w.mode=this.mode,this.dispatchEvent(w)}}}},{key:"pointerMove",value:function(t){var e=this.axis,w=this.mode,o=this.object,u=this.space;if("scale"===w?u="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(u="world"),void 0!==o&&null!==e&&!1!==this.dragging&&-1===t.button){i.setFromCamera(t,this.camera);var c=X(this.h,i,!0);if(c){if(this.pointEnd.copy(c.point).sub(this.worldPositionStart),"translate"===w)this.o.copy(this.pointEnd).sub(this.pointStart),"local"===u&&"XYZ"!==e&&this.o.applyQuaternion(this.T),-1===e.indexOf("X")&&(this.o.x=0),-1===e.indexOf("Y")&&(this.o.y=0),-1===e.indexOf("Z")&&(this.o.z=0),"local"===u&&"XYZ"!==e?this.o.applyQuaternion(this.W).divide(this.m):this.o.applyQuaternion(this.k).divide(this.m),o.position.copy(this.o).add(this.A),this.translationSnap&&("local"===u&&(o.position.applyQuaternion(s.copy(this.W).invert()),-1!==e.search("X")&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this.W)),"world"===u&&(o.parent&&o.position.add(h.setFromMatrixPosition(o.parent.matrixWorld)),-1!==e.search("X")&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(h.setFromMatrixPosition(o.parent.matrixWorld))));else if("scale"===w){if(-1!==e.search("XYZ")){var M=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(M*=-1),n.set(M,M,M)}else h.copy(this.pointStart),n.copy(this.pointEnd),h.applyQuaternion(this.T),n.applyQuaternion(this.T),n.divide(h),-1===e.search("X")&&(n.x=1),-1===e.search("Y")&&(n.y=1),-1===e.search("Z")&&(n.z=1);o.scale.copy(this.j).multiply(n),this.scaleSnap&&(-1!==e.search("X")&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===w){this.o.copy(this.pointEnd).sub(this.pointStart);var v=20/this.worldPosition.distanceTo(h.setFromMatrixPosition(this.camera.matrixWorld));"E"===e?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.l.copy(this.pointStart).normalize(),this.u.copy(this.pointEnd).normalize(),this.rotationAngle*=this.u.cross(this.l).dot(this.eye)<0?1:-1):"XYZE"===e?(this.rotationAxis.copy(this.o).cross(this.eye).normalize(),this.rotationAngle=this.o.dot(h.copy(this.rotationAxis).cross(this.eye))*v):"X"!==e&&"Y"!==e&&"Z"!==e||(this.rotationAxis.copy(a[e]),h.copy(a[e]),"local"===u&&h.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.o.dot(h.cross(this.eye).normalize())*v),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===u&&"E"!==e&&"XYZE"!==e?(o.quaternion.copy(this.W),o.quaternion.multiply(s.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.k),o.quaternion.copy(s.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this.W).normalize())}this.dispatchEvent(r),this.dispatchEvent(l)}}}},{key:"pointerUp",value:function(t){0===t.button&&(this.dragging&&null!==this.axis&&(o.mode=this.mode,this.dispatchEvent(o)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this.R),this.domElement.removeEventListener("pointermove",this._),this.domElement.removeEventListener("pointermove",this.C),this.domElement.removeEventListener("pointerup",this.I),this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}},{key:"attach",value:function(t){return this.object=t,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this.A),this.object.quaternion.copy(this.W),this.object.scale.copy(this.j),this.dispatchEvent(r),this.dispatchEvent(l),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return i}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(t){this.mode=t}},{key:"setTranslationSnap",value:function(t){this.translationSnap=t}},{key:"setRotationSnap",value:function(t){this.rotationSnap=t}},{key:"setScaleSnap",value:function(t){this.scaleSnap=t}},{key:"setSize",value:function(t){this.size=t}},{key:"setSpace",value:function(t){this.space=t}},{key:"setDelay",value:function(t){this.clickDelay=t}},{key:"updateInteractionTime",value:function(){this.lastInteractionTime=Date.now()}}])}(e.Object3D);function c(t){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};var e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}function M(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this.P(t))}}function v(t){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this.C),this.pointerHover(this.P(t)),this.pointerDown(this.P(t)))}function p(t){this.enabled&&this.pointerMove(this.P(t))}function f(t){this.enabled&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this.C),this.pointerUp(this.P(t)))}function X(t,e,i){for(var h=e.intersectObject(t,!0),n=0;n<h.length;n++)if(h[n].object.visible||i)return h[n];return!1}var d=new e.Euler,Y=new e.Vector3(0,1,0),Z=new e.Vector3(0,0,0),y=new e.Matrix4,k=new e.Quaternion,m=new e.Quaternion,E=new e.Vector3,b=new e.Matrix4,S=new e.Vector3(1,0,0),x=new e.Vector3(0,1,0),g=new e.Vector3(0,0,1),T=new e.Vector3,D=new e.Vector3,A=new e.Vector3,W=function(i){function n(){var i;t.classCallCheck(this,n),(i=t.callSuper(this,n)).isTransformControlsGizmo=!0,i.type="TransformControlsGizmo";var h=new e.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new e.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),a=h.clone();a.opacity=.15;var r=s.clone();r.opacity=.5;var w=h.clone();w.color.setHex(16711680);var o=h.clone();o.color.setHex(65280);var l=h.clone();l.color.setHex(255);var u=h.clone();u.color.setHex(16711680),u.opacity=.5;var c=h.clone();c.color.setHex(65280),c.opacity=.5;var M=h.clone();M.color.setHex(255),M.opacity=.5;var v=h.clone();v.opacity=.25;var p=h.clone();p.color.setHex(16776960),p.opacity=.25,h.clone().color.setHex(16776960);var f=h.clone();f.color.setHex(7895160);var X=new e.CylinderGeometry(0,.04,.1,12);X.translate(0,.05,0);var d=new e.BoxGeometry(.08,.08,.08);d.translate(0,.04,0);var Y=new e.BufferGeometry;Y.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,0,0],3));var Z=new e.CylinderGeometry(.0075,.0075,.5,3);function y(t,i){var h=new e.TorusGeometry(t,.0075,3,64,i*Math.PI*2);return h.rotateY(Math.PI/2),h.rotateX(Math.PI/2),h}Z.translate(0,.25,0);var k,m={X:[[new e.Mesh(X,w),[.5,0,0],[0,0,-Math.PI/2]],[new e.Mesh(X,w),[-.5,0,0],[0,0,Math.PI/2]],[new e.Mesh(Z,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(X,o),[0,.5,0]],[new e.Mesh(X,o),[0,-.5,0],[Math.PI,0,0]],[new e.Mesh(Z,o)]],Z:[[new e.Mesh(X,l),[0,0,.5],[Math.PI/2,0,0]],[new e.Mesh(X,l),[0,0,-.5],[-Math.PI/2,0,0]],[new e.Mesh(Z,l),null,[Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.1,0),v.clone()),[0,0,0]]],XY:[[new e.Mesh(new e.BoxGeometry(.15,.15,.01),M.clone()),[.15,.15,0]]],YZ:[[new e.Mesh(new e.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},E={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[.3,0,0],[0,0,-Math.PI/2]],[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,.3,0]],[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,-.3,0],[0,0,Math.PI]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,0,.3],[Math.PI/2,0,0]],[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.2,0),a)]],XY:[[new e.Mesh(new e.BoxGeometry(.2,.2,.01),a),[.15,.15,0]]],YZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new e.Mesh(new e.OctahedronGeometry(.01,2),r),null,null,null,"helper"]],END:[[new e.Mesh(new e.OctahedronGeometry(.01,2),r),null,null,null,"helper"]],DELTA:[[new e.Line((k=new e.BufferGeometry,k.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,1,1],3)),k),r),null,null,null,"helper"]],X:[[new e.Line(Y,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(Y,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(Y,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},S={XYZE:[[new e.Mesh(y(.5,1),f),null,[0,Math.PI/2,0]]],X:[[new e.Mesh(y(.5,.5),w)]],Y:[[new e.Mesh(y(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new e.Mesh(y(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new e.Mesh(y(.75,1),p),null,[0,Math.PI/2,0]]]},x={AXIS:[[new e.Line(Y,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},g={XYZE:[[new e.Mesh(new e.SphereGeometry(.25,10,8),a)]],X:[[new e.Mesh(new e.TorusGeometry(.5,.1,4,24),a),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new e.Mesh(new e.TorusGeometry(.5,.1,4,24),a),[0,0,0],[Math.PI/2,0,0]]],Z:[[new e.Mesh(new e.TorusGeometry(.5,.1,4,24),a),[0,0,0],[0,0,-Math.PI/2]]],E:[[new e.Mesh(new e.TorusGeometry(.75,.1,2,24),a)]]},T={X:[[new e.Mesh(d,w),[.5,0,0],[0,0,-Math.PI/2]],[new e.Mesh(Z,w),[0,0,0],[0,0,-Math.PI/2]],[new e.Mesh(d,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new e.Mesh(d,o),[0,.5,0]],[new e.Mesh(Z,o)],[new e.Mesh(d,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new e.Mesh(d,l),[0,0,.5],[Math.PI/2,0,0]],[new e.Mesh(Z,l),[0,0,0],[Math.PI/2,0,0]],[new e.Mesh(d,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new e.Mesh(new e.BoxGeometry(.15,.15,.01),M),[.15,.15,0]]],YZ:[[new e.Mesh(new e.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.BoxGeometry(.1,.1,.1),v.clone())]]},D={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[.3,0,0],[0,0,-Math.PI/2]],[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,.3,0]],[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,-.3,0],[0,0,Math.PI]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,0,.3],[Math.PI/2,0,0]],[new e.Mesh(new e.CylinderGeometry(.2,0,.6,4),a),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new e.Mesh(new e.BoxGeometry(.2,.2,.01),a),[.15,.15,0]]],YZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),a),[0,0,0]]]},A={X:[[new e.Line(Y,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(Y,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(Y,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function W(t){var i=new e.Object3D;for(var h in t)for(var n=t[h].length;n--;){var s=t[h][n][0].clone(),a=t[h][n][1],r=t[h][n][2],w=t[h][n][3],o=t[h][n][4];s.name=h,s.tag=o,a&&s.position.set(a[0],a[1],a[2]),r&&s.rotation.set(r[0],r[1],r[2]),w&&s.scale.set(w[0],w[1],w[2]),s.updateMatrix();var l=s.geometry.clone();l.applyMatrix4(s.matrix),s.geometry=l,s.renderOrder=1/0,s.position.set(0,0,0),s.rotation.set(0,0,0),s.scale.set(1,1,1),i.add(s)}return i}return i.gizmo={},i.picker={},i.helper={},i.add(i.gizmo.translate=W(m)),i.add(i.gizmo.rotate=W(S)),i.add(i.gizmo.scale=W(T)),i.add(i.picker.translate=W(E)),i.add(i.picker.rotate=W(g)),i.add(i.picker.scale=W(D)),i.add(i.helper.translate=W(b)),i.add(i.helper.rotate=W(x)),i.add(i.helper.scale=W(A)),i.picker.translate.visible=!1,i.picker.rotate.visible=!1,i.picker.scale.visible=!1,i}return t.inherits(n,i),t.createClass(n,[{key:"updateMatrixWorld",value:function(e){var i=this,a="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:m;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;var r=[];r=(r=(r=r.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var w=function(){var t,e=r[o];if(e.visible=!0,e.rotation.set(0,0,0),e.position.copy(i.worldPosition),t=i.camera.isOrthographicCamera?(i.camera.top-i.camera.bottom)/i.camera.zoom:i.worldPosition.distanceTo(i.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*i.camera.fov/360)/i.camera.zoom,7),e.scale.set(1,1,1).multiplyScalar(t*i.size/4),"helper"===e.tag)return e.visible=!1,"AXIS"===e.name?(e.visible=!!i.axis,"X"===i.axis&&(s.setFromEuler(d.set(0,0,0)),e.quaternion.copy(a).multiply(s),Math.abs(Y.copy(S).applyQuaternion(a).dot(i.eye))>.9&&(e.visible=!1)),"Y"===i.axis&&(s.setFromEuler(d.set(0,0,Math.PI/2)),e.quaternion.copy(a).multiply(s),Math.abs(Y.copy(x).applyQuaternion(a).dot(i.eye))>.9&&(e.visible=!1)),"Z"===i.axis&&(s.setFromEuler(d.set(0,Math.PI/2,0)),e.quaternion.copy(a).multiply(s),Math.abs(Y.copy(g).applyQuaternion(a).dot(i.eye))>.9&&(e.visible=!1)),"XYZE"===i.axis&&(s.setFromEuler(d.set(0,Math.PI/2,0)),Y.copy(i.rotationAxis),e.quaternion.setFromRotationMatrix(y.lookAt(Z,Y,x)),e.quaternion.multiply(s),e.visible=i.dragging),"E"===i.axis&&(e.visible=!1)):"START"===e.name?(e.position.copy(i.worldPositionStart),e.visible=i.dragging):"END"===e.name?(e.position.copy(i.worldPosition),e.visible=i.dragging):"DELTA"===e.name?(e.position.copy(i.worldPositionStart),e.quaternion.copy(i.worldQuaternionStart),h.set(1e-10,1e-10,1e-10).add(i.worldPositionStart).sub(i.worldPosition).multiplyScalar(-1),h.applyQuaternion(i.worldQuaternionStart.clone().invert()),e.scale.copy(h),e.visible=i.dragging):(e.quaternion.copy(a),i.dragging?e.position.copy(i.worldPositionStart):e.position.copy(i.worldPosition),i.axis&&(e.visible=-1!==i.axis.search(e.name))),1;if(e.quaternion.copy(a),"translate"===i.mode||"scale"===i.mode){var n=.99;"X"===e.name&&Math.abs(Y.copy(S).applyQuaternion(a).dot(i.eye))>n&&(e.scale.set(1e-10,1e-10,1e-10),e.visible=!1),"Y"===e.name&&Math.abs(Y.copy(x).applyQuaternion(a).dot(i.eye))>n&&(e.scale.set(1e-10,1e-10,1e-10),e.visible=!1),"Z"===e.name&&Math.abs(Y.copy(g).applyQuaternion(a).dot(i.eye))>n&&(e.scale.set(1e-10,1e-10,1e-10),e.visible=!1),"XY"===e.name&&Math.abs(Y.copy(g).applyQuaternion(a).dot(i.eye))<.2&&(e.scale.set(1e-10,1e-10,1e-10),e.visible=!1),"YZ"===e.name&&Math.abs(Y.copy(S).applyQuaternion(a).dot(i.eye))<.2&&(e.scale.set(1e-10,1e-10,1e-10),e.visible=!1),"XZ"===e.name&&Math.abs(Y.copy(x).applyQuaternion(a).dot(i.eye))<.2&&(e.scale.set(1e-10,1e-10,1e-10),e.visible=!1)}else"rotate"===i.mode&&(k.copy(a),Y.copy(i.eye).applyQuaternion(s.copy(a).invert()),-1!==e.name.search("E")&&e.quaternion.setFromRotationMatrix(y.lookAt(i.eye,Z,x)),"X"===e.name&&(s.setFromAxisAngle(S,Math.atan2(-Y.y,Y.z)),s.multiplyQuaternions(k,s),e.quaternion.copy(s)),"Y"===e.name&&(s.setFromAxisAngle(x,Math.atan2(Y.x,Y.z)),s.multiplyQuaternions(k,s),e.quaternion.copy(s)),"Z"===e.name&&(s.setFromAxisAngle(g,Math.atan2(Y.y,Y.x)),s.multiplyQuaternions(k,s),e.quaternion.copy(s)));e.visible=e.visible&&(-1===e.name.indexOf("X")||i.showX),e.visible=e.visible&&(-1===e.name.indexOf("Y")||i.showY),e.visible=e.visible&&(-1===e.name.indexOf("Z")||i.showZ),e.visible=e.visible&&(-1===e.name.indexOf("E")||i.showX&&i.showY&&i.showZ),e.visible=e.visible&&("XY"!==e.name||i.showXY),e.visible=e.visible&&("YZ"!==e.name||i.showYZ),e.visible=e.visible&&("XZ"!==e.name||i.showXZ),e.material.q=e.material.q||e.material.color.clone(),e.material.H=e.material.H||e.material.opacity,e.material.color.copy(e.material.q),e.material.opacity=e.material.H,i.enabled&&i.axis&&(e.name===i.axis||i.axis.split("").some(function(t){return e.name===t}))&&(e.material.color.setHex(16776960),e.material.opacity=1)},o=0;o<r.length;o++)w();t.superPropGet(n,"updateMatrixWorld",this,3)([e])}}])}(e.Object3D),j=function(i){function n(){var i;return t.classCallCheck(this,n),(i=t.callSuper(this,n,[new e.PlaneGeometry(1e5,1e5,2,2),new e.MeshBasicMaterial({visible:!1,wireframe:!0,side:e.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})])).isTransformControlsPlane=!0,i.type="TransformControlsPlane",i}return t.inherits(n,i),t.createClass(n,[{key:"updateMatrixWorld",value:function(e){var i=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(i="local"),T.copy(S).applyQuaternion("local"===i?this.worldQuaternion:m),D.copy(x).applyQuaternion("local"===i?this.worldQuaternion:m),A.copy(g).applyQuaternion("local"===i?this.worldQuaternion:m),Y.copy(D),this.mode){case"translate":case"scale":switch(this.axis){case"X":Y.copy(this.eye).cross(T),E.copy(T).cross(Y);break;case"Y":Y.copy(this.eye).cross(D),E.copy(D).cross(Y);break;case"Z":Y.copy(this.eye).cross(A),E.copy(A).cross(Y);break;case"XY":E.copy(A);break;case"YZ":E.copy(T);break;case"XZ":Y.copy(A),E.copy(D);break;case"XYZ":case"E":E.set(0,0,0)}break;default:E.set(0,0,0)}0===E.length()?this.quaternion.copy(this.cameraQuaternion):(b.lookAt(h.set(0,0,0),E,Y),this.quaternion.setFromRotationMatrix(b)),t.superPropGet(n,"updateMatrixWorld",this,3)([e])}}])}(e.Mesh);exports.TransformControls=u,exports.TransformControlsGizmo=W,exports.TransformControlsPlane=j;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("../../../_virtual/_rollupPluginBabelHelpers.js");require("../../core/debugLogger.js");var e=function(){return t.createClass(function e(r){t.classCallCheck(this,e),this.sceneViewer=r,this.autoRotateSpeed=1,this.i=!1},[{key:"toggleCameraRotation",value:function(){var t=this.sceneViewer;if(!t.controls||!t.sceneInitializationManager)return!1;var e=t.sceneInitializationManager.toggleAutoRotation();return this.i=e,e&&t.controls.autoRotateSpeed!==this.autoRotateSpeed&&(t.controls.autoRotateSpeed=this.autoRotateSpeed),e}},{key:"isAutoRotating",value:function(){return this.sceneViewer.controls&&(this.i=this.sceneViewer.controls.autoRotate),this.i}},{key:"setAutoRotation",value:function(t){var e=this.sceneViewer;if(e.sceneInitializationManager){var r=e.sceneInitializationManager.toggleAutoRotation(t);return this.i=r,r}return!1}}])}();exports.CameraControlsManager=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("../../../_virtual/_rollupPluginBabelHelpers.js");function e(t){if(t&&t.t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var i=e(require("three")),n=function(){return t.createClass(function e(i){t.classCallCheck(this,e),this.scene=i.scene,this.camera=i.camera,this.transformManager=i.transformManager,this.modelPreloader=i.modelPreloader,this.componentManager=i.componentManager,this.currentDragComponentData=null,this.dragPreviewSize=null,this.isCreatingDragPreview=!1,this.dragPreviewMesh=null,this.dragPreviewBoundingBox=null,this.dragTargetPosition=null,this.isDragOverScene=!1,this.onComponentDragStart=this.onComponentDragStart.bind(this),this.onComponentDragEnd=this.onComponentDragEnd.bind(this),this.onDragEnter=this.onDragEnter.bind(this),this.onDragLeave=this.onDragLeave.bind(this),this.onDragOver=this.onDragOver.bind(this),this.onDrop=this.onDrop.bind(this)},[{key:"onComponentDragStart",value:(o=t.asyncToGenerator(t.regenerator().m(function e(i,n){return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:return this.currentDragComponentData=i,t.n=1,this.calculateDragPreviewSize(i);case 1:return t.a(2,!0)}},e,this)})),function(t,e){return o.apply(this,arguments)})},{key:"onComponentDragEnd",value:function(){return this.currentDragComponentData=null,this.dragPreviewSize=null,this.isCreatingDragPreview=!1,this.clearDragPreview(),this.cleanupDragPreview(),this.dragTargetPosition=null,this.isDragOverScene=!1,!0}},{key:"onDragEnter",value:(u=t.asyncToGenerator(t.regenerator().m(function e(i,n){var r;return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(i.preventDefault(),this.isDragOverScene=!0,!this.currentDragComponentData)try{(r=i.dataTransfer.getData("application/json"))&&(this.currentDragComponentData=JSON.parse(r))}catch(t){}if(this.dragPreviewSize||!this.currentDragComponentData){t.n=1;break}return t.n=1,this.calculateDragPreviewSize(this.currentDragComponentData);case 1:if(this.dragPreviewMesh||!this.currentDragComponentData||this.isCreatingDragPreview){t.n=4;break}return this.isCreatingDragPreview=!0,t.p=2,t.n=3,this.createDragPreview();case 3:return t.p=3,this.isCreatingDragPreview=!1,t.f(3);case 4:case 5:return t.a(2)}},e,this,[[2,,3,4]])})),function(t,e){return u.apply(this,arguments)})},{key:"onDragLeave",value:function(t,e){e.contains(t.relatedTarget)||(this.isDragOverScene=!1,this.clearDragPreview())}},{key:"onDragOver",value:(h=t.asyncToGenerator(t.regenerator().m(function e(i,n){var r,s,a,h;return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(i.preventDefault(),i.dataTransfer.dropEffect="copy",this.currentDragComponentData){t.n=4;break}if(t.p=1,!(r=i.dataTransfer.getData("application/json"))){t.n=2;break}if(this.currentDragComponentData=JSON.parse(r),this.dragPreviewSize){t.n=2;break}return t.n=2,this.calculateDragPreviewSize(this.currentDragComponentData);case 2:t.n=4;break;case 3:t.p=3,t.v;case 4:if(!(s=this.calculateDropPosition(i,n))){t.n=6;break}return this.dragTargetPosition=s,t.n=5,this.updateDragPreview(s);case 5:this.dragPreviewMesh&&this.dragPreviewMesh.userData.isFallback&&(a=this.checkBoundingBoxOverlap(),h=a?16711680:65280,this.dragPreviewMesh.material.color.set(h));case 6:return t.a(2)}},e,this,[[1,3]])})),function(t,e){return h.apply(this,arguments)})},{key:"onDrop",value:(a=t.asyncToGenerator(t.regenerator().m(function e(i,n){var r,s,a,h,u,o,c=arguments;return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(r=c.length>2&&void 0!==c[2]?c[2]:{},i.preventDefault(),this.isDragOverScene=!1,t.p=1,s=i.dataTransfer.getData("application/json")){t.n=2;break}return r.onPlacementCanceled&&r.onPlacementCanceled({reason:"invalid-data",message:"No component data found in drop event"}),t.a(2,!1);case 2:t.p=2,a=JSON.parse(s),t.n=4;break;case 3:return t.p=3,t.v,r.onPlacementCanceled&&r.onPlacementCanceled({reason:"parse-error",message:"Could not parse component data"}),t.a(2,!1);case 4:if(a&&a.libraryId&&a.modelKey){t.n=5;break}return r.onPlacementCanceled&&r.onPlacementCanceled({reason:"invalid-data",message:"Component data missing required fields"}),t.a(2,!1);case 5:if(h=this.calculateDropPosition(i,n)){t.n=6;break}return r.onPlacementCanceled&&r.onPlacementCanceled({reason:"position-error",message:"Could not calculate drop position",componentData:a}),t.a(2,!1);case 6:if(a.position={x:h.x,y:h.y,z:h.z},u=this.checkBoundingBoxOverlap(),o=!1,!u){t.n=7;break}return r.onPlacementCanceled&&r.onPlacementCanceled({reason:"overlap",componentData:a}),t.a(2,!1);case 7:if(!r.onAddComponent){t.n=9;break}return t.n=8,r.onAddComponent(a);case 8:o=t.v,t.n=11;break;case 9:if(!this.componentManager){t.n=11;break}return t.n=10,this.componentManager.addComponentToScene(a);case 10:o=t.v;case 11:return o&&r.onComponentAdded&&r.onComponentAdded({componentData:a,position:h}),t.a(2,o);case 12:return t.p=12,t.v,t.a(2,!1);case 13:return t.p=13,this.clearDragPreview(),this.cleanupDragPreview(),this.currentDragComponentData=null,this.dragPreviewSize=null,this.dragTargetPosition=null,this.isDragOverScene=!1,t.f(13);case 14:return t.a(2)}},e,this,[[2,3],[1,12,13,14]])})),function(t,e){return a.apply(this,arguments)})},{key:"calculateDropPosition",value:function(t,e){if(!this.camera||!e)return null;try{var n,r=e.getBoundingClientRect(),s=(t.clientX-r.left)/r.width*2-1,a=-(t.clientY-r.top)/r.height*2+1,h=new i.Raycaster;h.setFromCamera({x:s,y:a},this.camera);var u=1/((null===(n=this.transformManager)||void 0===n||null===(n=n.snapValues)||void 0===n?void 0:n.translation)||.5),o=null;if(this.scene.traverse(function(t){var e;t.isMesh&&null!==(e=t.userData)&&void 0!==e&&e.isBaseGround&&(o=t)}),o){var c=h.intersectObject(o,!1);if(c.length>0){var l=c[0];return{x:Math.round(l.point.x*u)/u,y:Math.max(0,l.point.y),z:Math.round(l.point.z*u)/u}}}var f=new i.Plane(new i.Vector3(0,1,0),0),v=new i.Vector3;return h.ray.intersectPlane(f,v)&&v?{x:Math.round(v.x*u)/u,y:0,z:Math.round(v.z*u)/u}:{x:0,y:0,z:0}}catch(t){}return null}},{key:"calculateDragPreviewSize",value:(s=t.asyncToGenerator(t.regenerator().m(function e(i){var n,r,s,a,h,u;return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:return n=1,r=1,s=1,t.p=1,t.p=2,t.n=3,this.getModelBoundingBox(i);case 3:if(!(a=t.v)){t.n=4;break}n=a.width,r=a.height,s=a.depth,t.n=5;break;case 4:throw new Error("Could not get model bounding box");case 5:t.n=7;break;case 6:t.p=6,t.v,i.dimensions?(n=i.dimensions.width||i.dimensions.x||1,r=i.dimensions.height||i.dimensions.y||1,s=i.dimensions.depth||i.dimensions.z||1):i.boundingBox?(h=i.boundingBox).max&&h.min?(n=Math.abs(h.max.x-h.min.x)||1,r=Math.abs(h.max.y-h.min.y)||1,s=Math.abs(h.max.z-h.min.z)||1):void 0!==h.width&&void 0!==h.height&&void 0!==h.depth?(n=h.width||1,r=h.height||1,s=h.depth||1):"number"==typeof h.x&&"number"==typeof h.y&&"number"==typeof h.z&&(n=h.x||1,r=h.y||1,s=h.z||1):(u=i.type||"").toLowerCase().includes("chiller")?(n=2,r=2,s=2):u.toLowerCase().includes("pump")?(n=1,r=1,s=1):u.toLowerCase().includes("tower")?(n=3,r=4,s=3):(n=1,r=1,s=1);case 7:n=Math.max(n,.5),r=Math.max(r,.5),s=Math.max(s,.5),this.dragPreviewSize={width:n,height:r,depth:s},t.n=9;break;case 8:t.p=8,t.v,this.dragPreviewSize={width:1,height:1,depth:1};case 9:return t.a(2)}},e,this,[[2,6],[1,8]])})),function(t){return s.apply(this,arguments)})},{key:"getModelBoundingBox",value:(r=t.asyncToGenerator(t.regenerator().m(function e(n){var r,s,a,h,u,o,c;return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(n.libraryId){t.n=1;break}return t.a(2,null);case 1:return t.p=1,s={},t.p=2,t.n=3,fetch("./library/component-dictionary.json");case 3:return a=t.v,t.n=4,a.json();case 4:s=t.v,t.n=6;break;case 5:return t.p=5,t.v,t.a(2,null);case 6:if((h=s[n.libraryId])&&h.modelKey){t.n=7;break}return t.a(2,null);case 7:if(u=null===(r=this.modelPreloader)||void 0===r?void 0:r.getCachedModel(h.modelKey)){t.n=8;break}return t.a(2,null);case 8:return o=(new i.Box3).setFromObject(u),c=o.getSize(new i.Vector3),t.a(2,{width:c.x,height:c.y,depth:c.z});case 9:return t.p=9,t.v,t.a(2,null)}},e,this,[[2,5],[1,9]])})),function(t){return r.apply(this,arguments)})},{key:"updateDragPreview",value:(n=t.asyncToGenerator(t.regenerator().m(function e(i){return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(this.dragPreviewMesh||this.isCreatingDragPreview){t.n=3;break}return this.isCreatingDragPreview=!0,t.p=1,t.n=2,this.createDragPreview();case 2:return t.p=2,this.isCreatingDragPreview=!1,t.f(2);case 3:this.dragPreviewMesh&&i&&(this.dragPreviewMesh.position.set(i.x,i.y,i.z),this.dragPreviewMesh.visible=!0,this.dragPreviewBoundingBox&&(this.dragPreviewBoundingBox.position.set(i.x,i.y,i.z),this.dragPreviewBoundingBox.visible=!0));case 4:return t.a(2)}},e,this,[[1,,2,3]])})),function(t){return n.apply(this,arguments)})},{key:"createDragPreview",value:(e=t.asyncToGenerator(t.regenerator().m(function e(){var n,r,s,a,h,u,o,c,l;return t.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(this.clearDragPreview(),this.scene&&this.currentDragComponentData){t.n=1;break}return t.a(2);case 1:return t.p=1,n={},t.p=2,t.n=3,fetch("./library/component-dictionary.json");case 3:return r=t.v,t.n=4,r.json();case 4:n=t.v,t.n=6;break;case 5:t.p=5,t.v;case 6:if(s=this.currentDragComponentData.libraryId,a=n[s],h=null,a&&a.modelKey&&this.modelPreloader)try{(u=this.modelPreloader.getCachedModel(a.modelKey))&&((h=u.clone()).traverse(function(t){t.isMesh&&(t.material=t.material.clone(),t.material.transparent=!0,t.material.opacity=.4,t.material.depthTest=!0,t.material.depthWrite=!0,t.material.needsUpdate=!0)}),h.userData.isPreview=!0)}catch(t){h=null}return h||(o=this.dragPreviewSize||{width:1,height:1,depth:1},c=new i.BoxGeometry(o.width,o.height,o.depth),l=new i.MeshBasicMaterial({color:65280,wireframe:!0,transparent:!0,opacity:.6}),(h=new i.Mesh(c,l)).userData.isFallback=!0,h.userData.isPreview=!0),this.scene.add(h),this.dragPreviewMesh=h,this.dragPreviewMesh.visible=!1,this.createBoundingBoxHelper(),t.a(2,!0);case 7:return t.p=7,t.v,t.a(2,!1)}},e,this,[[2,5],[1,7]])})),function(){return e.apply(this,arguments)})},{key:"createBoundingBoxHelper",value:function(){if(this.dragPreviewMesh){var t=(new i.Box3).setFromObject(this.dragPreviewMesh),e=t.getSize(new i.Vector3);t.getCenter(new i.Vector3);var n=new i.BoxGeometry(e.x,e.y,e.z),r=new i.LineBasicMaterial({color:16776960,transparent:!0,opacity:.3}),s=new i.EdgesGeometry(n),a=new i.LineSegments(s,r);a.position.copy(this.dragPreviewMesh.position),this.scene.add(a),this.dragPreviewBoundingBox=a,this.dragPreviewBoundingBox.visible=!1}}},{key:"checkBoundingBoxOverlap",value:function(){var t=this;if(!this.dragPreviewMesh||!this.scene)return!1;var e=(new i.Box3).setFromObject(this.dragPreviewMesh),n=[];this.scene.traverse(function(e){!e.isMesh||e===t.dragPreviewMesh||e===t.dragPreviewBoundingBox||e.userData.isBaseGround||e.userData.isBrickWall||e.userData.isBaseGrid||e.userData&&("component"===e.userData.componentType||"connector"===e.userData.componentType||"gateway"===e.userData.componentType)&&n.push(e)});for(var r=0,s=n;r<s.length;r++){var a=s[r],h=(new i.Box3).setFromObject(a);if(e.intersectsBox(h))return!0}return!1}},{key:"clearDragPreview",value:function(){this.dragPreviewMesh&&(this.dragPreviewMesh.visible=!1),this.dragPreviewBoundingBox&&(this.dragPreviewBoundingBox.visible=!1)}},{key:"cleanupDragPreview",value:function(){this.dragPreviewMesh&&(this.scene.remove(this.dragPreviewMesh),this.dragPreviewMesh.geometry&&this.dragPreviewMesh.geometry.dispose(),this.dragPreviewMesh.material&&(Array.isArray(this.dragPreviewMesh.material)?this.dragPreviewMesh.material.forEach(function(t){return t.dispose()}):this.dragPreviewMesh.material.dispose()),this.dragPreviewMesh=null),this.dragPreviewBoundingBox&&(this.scene.remove(this.dragPreviewBoundingBox),this.dragPreviewBoundingBox.geometry&&this.dragPreviewBoundingBox.geometry.dispose(),this.dragPreviewBoundingBox.material&&this.dragPreviewBoundingBox.material.dispose(),this.dragPreviewBoundingBox=null)}},{key:"dispose",value:function(){this.cleanupDragPreview(),this.currentDragComponentData=null,this.dragPreviewSize=null,this.isDragOverScene=!1,this.dragTargetPosition=null}},{key:"getDragState",value:function(){return{isDragging:!!this.currentDragComponentData,isDragOverScene:this.isDragOverScene,dragComponentData:this.currentDragComponentData,dragTargetPosition:this.dragTargetPosition}}}]);var e,n,r,s,a,h,u,o}();exports.default=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js"),n=require("three"),t=require("../../core/debugLogger.js");function i(e){if(e&&e.t)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var r=i(n),a=function(){return e.createClass(function n(t){e.classCallCheck(this,n),this.sceneViewer=t,this.handleKeyDown=null},[{key:"setupKeyboardControls",value:function(){var e=this;this.handleKeyDown=function(n){if(n.ctrlKey&&("z"===n.key.toLowerCase()||"KeyZ"===n.code))return n.preventDefault(),n.stopPropagation(),void e.undoTransform();if(n.altKey&&("r"===n.key.toLowerCase()||"KeyR"===n.code))return n.preventDefault(),n.stopPropagation(),void e.toggleShouldUpdatePaths();switch(n.key.toLowerCase()){case"p":e.togglePerformanceUI();break;case"l":e.logPerformanceSummary();break;case"r":e.resetPerformanceStats();break;case"a":e.toggleAutoRotation();break;case"e":e.cycleToneMapping();break;case"=":case"+":e.increaseExposure();break;case"-":e.decreaseExposure();break;case"h":e.showHelpInfo()}},window.addEventListener("keydown",this.handleKeyDown,!0),window._performanceKeyHandler=this.handleKeyDown,this.overrideTransformControlsKeyboard(),t.logger.info("Keyboard controls initialized with Ctrl+Z undo override")}},{key:"togglePerformanceUI",value:function(){var e=this.sceneViewer;e.performanceUI&&(e.performanceUI.isVisible?e.performanceUI.hide():e.performanceUI.show())}},{key:"logPerformanceSummary",value:function(){var e=this.sceneViewer;e.performanceMonitor&&e.performanceMonitor.logSummary()}},{key:"resetPerformanceStats",value:function(){var e=this.sceneViewer;e.performanceMonitor&&e.performanceMonitor.reset()}},{key:"cycleToneMapping",value:function(){var e=this.sceneViewer;if(e.renderer){var n=[{type:r.NoToneMapping,name:"None"},{type:r.LinearToneMapping,name:"Linear"},{type:r.ReinhardToneMapping,name:"Reinhard"},{type:r.CineonToneMapping,name:"Cineon"},{type:r.ACESFilmicToneMapping,name:"ACES Filmic"}],t=n.findIndex(function(n){return n.type===e.renderer.toneMapping}),i=(t+1)%n.length,a=(n[t],n[i]);e.renderer.toneMapping=a.type}}},{key:"increaseExposure",value:function(){var e=this.sceneViewer;e.renderer&&(e.renderer.toneMappingExposure=Math.min(e.renderer.toneMappingExposure+.1,3))}},{key:"decreaseExposure",value:function(){var e=this.sceneViewer;e.renderer&&(e.renderer.toneMappingExposure=Math.max(e.renderer.toneMappingExposure-.1,.1))}},{key:"showHelpInfo",value:function(){}},{key:"toggleShouldUpdatePaths",value:function(){var e=this.sceneViewer;e&&"function"==typeof e.toggleShouldUpdatePaths&&e.toggleShouldUpdatePaths()}},{key:"toggleAutoRotation",value:function(){var e=this.sceneViewer;if(e.sceneInitializationManager){var n=e.sceneInitializationManager.toggleAutoRotation();void 0!==e.isAutoRotating&&(e.isAutoRotating=n)}}},{key:"setupResizeHandler",value:function(){var e=this.sceneViewer;e.handleResize=function(){if(e.$refs.container&&e.camera&&e.renderer){var n=e.$refs.container.getBoundingClientRect(),t=n.width,i=n.height;e.camera.aspect=t/i,e.camera.updateProjectionMatrix(),e.renderer.setSize(t,i),e.composer&&(e.composer.setSize(t,i),e.ssaoPass&&e.ssaoPass.setSize(t,i),e.bloomPass&&e.bloomPass.resolution.set(t,i)),e.tooltipsManager&&e.tooltipsManager.resize()}},e.resizeObserver=new ResizeObserver(e.handleResize),e.resizeObserver.observe(e.$refs.container),window.addEventListener("resize",e.handleResize),t.logger.info("Resize handler initialized")}},{key:"cleanup",value:function(){this.handleKeyDown&&(window.removeEventListener("keydown",this.handleKeyDown,!0),this.handleKeyDown=null),window._performanceKeyHandler&&(window.removeEventListener("keydown",window._performanceKeyHandler,!0),delete window._performanceKeyHandler);var e=this.sceneViewer;e.handleResize&&(window.removeEventListener("resize",e.handleResize),e.handleResize=null),e.resizeObserver&&(e.resizeObserver.disconnect(),e.resizeObserver=null),t.logger.info("Keyboard controls cleanup completed")}},{key:"undoTransform",value:function(){var e=this.sceneViewer;e.centralPlant&&("function"==typeof e.centralPlant.undoTransform&&e.centralPlant.undoTransform()&&(e.sceneHelper&&"function"==typeof e.sceneHelper.requestRender&&e.sceneHelper.requestRender(),e.renderer&&e.renderer.render(e.scene,e.camera),e.updateComponentPositions&&"function"==typeof e.updateComponentPositions&&e.updateComponentPositions()))}},{key:"overrideTransformControlsKeyboard",value:function(){var e=this.sceneViewer;if(e.transformManager&&e.transformManager.eventHandlers&&e.transformManager.eventHandlers.keydown){var n=e.transformManager.eventHandlers.keydown;e.transformManager.eventHandlers.keydown=function(e){(!e.ctrlKey||"z"!==e.key.toLowerCase()&&"KeyZ"!==e.code)&&n(e)}}}}])}();exports.KeyboardControlsManager=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("../../../_virtual/_rollupPluginBabelHelpers.js"),i=require("three"),s=require("./TransformControls.js");function e(t){if(t&&t.t)return t;var i=Object.create(null);return t&&Object.keys(t).forEach(function(s){if("default"!==s){var e=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,e.get?e:{enumerable:!0,get:function(){return t[s]}})}}),i.default=t,Object.freeze(i)}var n=e(i),h=function(){return t.createClass(function i(s,e,n){var h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t.classCallCheck(this,i),this.scene=s,this.camera=e,this.renderer=n,this.orbitControls=h,this.transformControls=null,this.boundingBoxHelper=null,this.boundingBoxCache=new WeakMap,this.selectedObject=null,this.currentMode="translate",this.currentSpace="world",this.forceInvisible=!1,this.eventHandlers={keydown:null,click:null,transformStart:null,transformEnd:null,transforming:null},this.clickTiming={lastClickTime:0,lastClickedObject:null,doubleClickDelay:300},this.transformState={isTransforming:!1,initialTransform:null,currentTransform:null},this.config={size:1,enabled:!0,showX:!0,showY:!0,showZ:!0,snap:null,translationSnap:null,rotationSnap:null,scaleSnap:null,showBoundingBox:!0,boundingBoxColor:65280,useBoundingBoxSelection:!0},this.callbacks={onObjectSelect:null,onTransformStart:null,onTransform:null,onTransformEnd:null,onModeChange:null,onObjectRemoved:null},this.init()},[{key:"init",value:function(){this.createTransformControls(),this.setupEventListeners(),this.setupKeyboardControls()}},{key:"on",value:function(t){t.onObjectSelect&&(this.callbacks.onObjectSelect=t.onObjectSelect),t.onTransformStart&&(this.callbacks.onTransformStart=t.onTransformStart),t.onTransform&&(this.callbacks.onTransform=t.onTransform),t.onTransformEnd&&(this.callbacks.onTransformEnd=t.onTransformEnd),t.onModeChange&&(this.callbacks.onModeChange=t.onModeChange),t.onObjectRemoved&&(this.callbacks.onObjectRemoved=t.onObjectRemoved)}},{key:"createTransformControls",value:function(){this.transformControls=new s.TransformControls(this.camera,this.renderer.domElement),this.transformControls.setMode(this.currentMode),this.transformControls.setSpace(this.currentSpace),this.transformControls.setSize(this.config.size),this.transformControls.setDelay(this.clickTiming),this.transformControls.showX=this.config.showX,this.transformControls.showY=this.config.showY,this.transformControls.showZ=this.config.showZ,this.transformControls.showXY=!1,this.transformControls.showYZ=!1,this.transformControls.showXZ=!1,this.transformControls.isTransformControls=!0,this.transformControls.userData={isTransformControls:!0},this.scene.add(this.transformControls),this.transformControls.enabled=!1,this.i()}},{key:"setupEventListeners",value:function(){var t=this;this.eventHandlers.transformStart=function(){t.transformState.isTransforming=!0,t.selectedObject&&(t.transformState.initialTransform={position:t.selectedObject.position.clone(),rotation:t.selectedObject.rotation.clone(),scale:t.selectedObject.scale.clone()}),t.orbitControls&&(t.orbitControls.enabled=!1),t.callbacks.onTransformStart&&t.callbacks.onTransformStart(t.selectedObject,t.currentMode)},this.eventHandlers.transformEnd=function(){if(t.transformState.isTransforming=!1,t.orbitControls&&(t.orbitControls.enabled=!0),t.selectedObject&&(t.transformState.currentTransform={position:t.selectedObject.position.clone(),rotation:t.selectedObject.rotation.clone(),scale:t.selectedObject.scale.clone()},t.boundingBoxCache.has(t.selectedObject)&&t.boundingBoxCache.delete(t.selectedObject)),t.callbacks.onTransformEnd&&t.callbacks.onTransformEnd(t.selectedObject,t.transformState.initialTransform,t.transformState.currentTransform,t.currentMode),"undefined"!=typeof window){var i,s=new CustomEvent("sceneUpdateComplete",{detail:{timestamp:Date.now(),transformType:t.currentMode,objectName:(null===(i=t.selectedObject)||void 0===i?void 0:i.name)||"unknown"}});window.dispatchEvent(s)}},this.eventHandlers.transforming=function(){if(t.selectedObject&&t.boundingBoxCache.has(t.selectedObject)&&t.boundingBoxCache.delete(t.selectedObject),t.updateBoundingBox(),t.callbacks.onTransform&&t.callbacks.onTransform(t.selectedObject,t.currentMode),"undefined"!=typeof window){var i,s=new CustomEvent("sceneUpdateComplete",{detail:{timestamp:Date.now(),transformType:t.currentMode,objectName:(null===(i=t.selectedObject)||void 0===i?void 0:i.name)||"unknown",isTransforming:!0}});window.dispatchEvent(s)}},this.transformControls&&(this.eventHandlers.transformStart&&this.transformControls.removeEventListener("mouseDown",this.eventHandlers.transformStart),this.eventHandlers.transformEnd&&this.transformControls.removeEventListener("mouseUp",this.eventHandlers.transformEnd),this.eventHandlers.transforming&&this.transformControls.removeEventListener("objectChange",this.eventHandlers.transforming),this.transformControls.addEventListener("mouseDown",this.eventHandlers.transformStart),this.transformControls.addEventListener("mouseUp",this.eventHandlers.transformEnd),this.transformControls.addEventListener("objectChange",this.eventHandlers.transforming))}},{key:"setupKeyboardControls",value:function(){var t=this;this.eventHandlers.keydown=function(i){if(t.transformControls.enabled&&!t.transformState.isTransforming&&(!i.ctrlKey||"KeyZ"!==i.code))switch(i.code){case"KeyG":t.setMode("translate");break;case"KeyR":t.setMode("rotate");break;case"KeyS":t.setMode("scale");break;case"KeyW":t.setSpace("world");break;case"KeyL":t.setSpace("local");break;case"Escape":t.deselectObject();break;case"KeyX":t.setAxisConstraint("X");break;case"KeyY":t.setAxisConstraint("Y");break;case"KeyZ":i.ctrlKey||t.setAxisConstraint("Z");break;case"ShiftLeft":case"ShiftRight":t.clearAxisConstraint();break;case"Backspace":t.handleObjectRemoval()}},window.addEventListener("keydown",this.eventHandlers.keydown)}},{key:"setupObjectSelection",value:function(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=new n.Raycaster,e=new n.Vector2;this.eventHandlers.click=function(n){if(!t.transformState.isTransforming){var h=Date.now(),o=h-t.clickTiming.lastClickTime;t.h(n,e),s.setFromCamera(e,t.camera);var a=t.o(s,i),l=a===t.clickTiming.lastClickedObject,r=o<t.clickTiming.doubleClickDelay;l&&r&&null!==a?(t.selectObject(a),t.clickTiming.lastClickTime=0,t.clickTiming.lastClickedObject=null):(t.deselectObject(),a&&t.selectObjectForTransformOnly(a),t.clickTiming.lastClickTime=h,t.clickTiming.lastClickedObject=a)}},this.renderer.domElement.addEventListener("click",this.eventHandlers.click)}},{key:"_calculateMousePosition",value:function(t,i){var s=this.renderer.domElement.getBoundingClientRect();i.x=(t.clientX-s.left)/s.width*2-1,i.y=-(t.clientY-s.top)/s.height*2+1}},{key:"_findTargetObject",value:function(t,i){if(this.config.useBoundingBoxSelection){var s=this.l(t,i);if(s)return s}return this.u(t,i)}},{key:"_findTargetViaBoundingBox",value:function(t,i){var s=this.intersectObjectsBoundingBoxes(t,i);if(s.length>0){var e=s[0].object;if(this.v(e))return e}return null}},{key:"_findTargetViaMesh",value:function(t,i){var s=t.intersectObjects(this.scene.children,!0);if(s.length>0){var e=s[0].object;if(e=this.k(e),(i?i(e):this.isSelectableObject(e))&&this.v(e)){this.config.useBoundingBoxSelection;return e}}return null}},{key:"_resolveHierarchyTarget",value:function(t){var i,s,e;return this.isConnectorOrb(t)?t:null!==(i=t.parent)&&void 0!==i&&null!==(i=i.name)&&void 0!==i&&i.includes(" Component")?t.parent:null!==(s=t.parent)&&void 0!==s&&null!==(s=s.parent)&&void 0!==s&&null!==(s=s.name)&&void 0!==s&&s.includes(" Component")?t.parent.parent:(null!==(e=t.userData)&&void 0!==e&&e.isPipeSegment,t)}},{key:"_isValidSelectableObject",value:function(t){return!(!t||!t.parent)&&!!(t.position&&t.rotation&&t.scale&&t.updateMatrixWorld)}},{key:"isConnectorOrb",value:function(t){if(!t||!t.isObject3D)return!1;if(!t.isMesh||!t.geometry)return!1;var i="CONNECTOR-GEO"===t.geometry.uuid,s="SphereGeometry"===t.geometry.type&&t.geometry.parameters&&.2===t.geometry.parameters.radius,e=t.name&&t.name.toLowerCase().includes("connector");return(i||s)&&e}},{key:"isSelectableObject",value:function(t){var i,s,e,n,h,o,a,l;if(!t||!t.isObject3D)return!1;if(t.userData&&t.userData.isPipeSegment,t.isTransformControls||t.isTransformControlsPlane||t.isTransformControlsGizmo)return!1;var r=t.isHelper||(null===(i=t.userData)||void 0===i?void 0:i.isHelper)||(null===(s=t.userData)||void 0===s?void 0:s.isBoundingBox),u=null===(e=t.userData)||void 0===e?void 0:e.isBaseGround,c=null===(n=t.userData)||void 0===n?void 0:n.isBrickWall;if(r||u||c||!t.visible)return!1;if(t.name&&t.name.toLowerCase().includes("polyline")&&(null===(h=t.userData)||void 0===h||!h.isPipeSegment)&&(null===(o=t.userData)||void 0===o||!o.isPipeJunction))return!1;var v=!0===(null===(a=t.userData)||void 0===a?void 0:a.isPipeSegment),f=!0===(null===(l=t.userData)||void 0===l?void 0:l.isPipeJunction),d=t.name&&t.name.includes(" Component"),y=this.isConnectorOrb(t);return d||y||v||f}},{key:"selectObject",value:function(t){if(!t||!t.isObject3D)return!1;this.selectedObject=t,t.updateMatrixWorld(!0);var i=(new n.Box3).setFromObject(t);return this.boundingBoxCache.set(t,i),this.transformControls.attach(t),this.transformControls.updateInteractionTime&&this.transformControls.updateInteractionTime(),this.createBoundingBox(t),this.forceInvisible?(this.transformControls.enabled=!1,this.i()):(this.transformControls.enabled=this.config.enabled,this.m()),this.callbacks.onObjectSelect&&this.callbacks.onObjectSelect(t),!0}},{key:"selectObjectForTransformOnly",value:function(t){if(!t||!t.isObject3D)return!1;this.selectedObject=t,t.updateMatrixWorld(!0);var i=(new n.Box3).setFromObject(t);return this.boundingBoxCache.set(t,i),this.transformControls.attach(t),this.transformControls.updateInteractionTime&&this.transformControls.updateInteractionTime(),this.createBoundingBox(t),this.forceInvisible?(this.transformControls.enabled=!1,this.i()):(this.transformControls.enabled=!0,this.m()),!0}},{key:"deselectObject",value:function(){this.selectedObject,this.removeBoundingBox(),this.selectedObject=null,this.transformControls&&(this.transformControls.detach(),this.transformControls.enabled=!1,this.i()),this.callbacks.onObjectSelect&&this.callbacks.onObjectSelect(null)}},{key:"createBoundingBox",value:function(t){if(this.config.showBoundingBox&&(this.removeBoundingBox(),t))try{this.boundingBoxHelper=new n.BoxHelper(t,this.config.boundingBoxColor),this.boundingBoxHelper.isHelper=!0,this.boundingBoxHelper.userData={isBoundingBox:!0},this.scene.add(this.boundingBoxHelper)}catch(t){}}},{key:"removeBoundingBox",value:function(){if(this.boundingBoxHelper)try{this.boundingBoxHelper.parent&&this.boundingBoxHelper.parent.remove(this.boundingBoxHelper),this.boundingBoxHelper.geometry&&this.boundingBoxHelper.geometry.dispose(),this.boundingBoxHelper.material&&this.boundingBoxHelper.material.dispose()}catch(t){}finally{this.boundingBoxHelper=null}}},{key:"updateBoundingBox",value:function(){if(this.boundingBoxHelper&&this.selectedObject)try{if(this.selectedObject.updateMatrixWorld(!0),this.boundingBoxHelper.update(),this.boundingBoxCache.has(this.selectedObject)){var t=(new n.Box3).setFromObject(this.selectedObject);this.boundingBoxCache.set(this.selectedObject,t)}}catch(t){this.createBoundingBox(this.selectedObject)}}},{key:"setBoundingBoxVisibility",value:function(t){this.config.showBoundingBox=t,t&&this.selectedObject&&!this.boundingBoxHelper?this.createBoundingBox(this.selectedObject):!t&&this.boundingBoxHelper&&this.removeBoundingBox()}},{key:"setBoundingBoxColor",value:function(t){this.config.boundingBoxColor=t,this.boundingBoxHelper&&this.boundingBoxHelper.material&&this.boundingBoxHelper.material.color.setHex(t)}},{key:"setMode",value:function(t){if(["translate","rotate","scale"].includes(t)){var i=this.currentMode;this.currentMode=t,this.transformControls.setMode(t),this.callbacks.onModeChange&&this.callbacks.onModeChange(t,i)}}},{key:"setSpace",value:function(t){if(["world","local"].includes(t)){this.currentSpace;this.currentSpace=t,this.transformControls.setSpace(t)}}},{key:"setAxisConstraint",value:function(t){["X","Y","Z"].includes(t)&&(this.transformControls.showX=!1,this.transformControls.showY=!1,this.transformControls.showZ=!1,this.transformControls["show".concat(t)]=!0)}},{key:"clearAxisConstraint",value:function(){this.transformControls.showX=this.config.showX,this.transformControls.showY=this.config.showY,this.transformControls.showZ=this.config.showZ}},{key:"setSnap",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};void 0!==t.translation&&(this.config.translationSnap=t.translation,this.transformControls.setTranslationSnap(t.translation)),void 0!==t.rotation&&(this.config.rotationSnap=t.rotation,this.transformControls.setRotationSnap(t.rotation)),void 0!==t.scale&&(this.config.scaleSnap=t.scale,this.transformControls.setScaleSnap(t.scale))}},{key:"snapValues",get:function(){return{translation:this.config.translationSnap||.5,rotation:this.config.rotationSnap||Math.PI/2,scale:this.config.scaleSnap||.1}}},{key:"setSize",value:function(t){this.config.size=t,this.transformControls.setSize(t)}},{key:"setEnabled",value:function(t){this.config.enabled=t,this.selectedObject&&(this.transformControls.enabled=t)}},{key:"setShowPlanes",value:function(t){return!!this.transformControls&&(this.transformControls.showXY=t,this.transformControls.showYZ=t,this.transformControls.showXZ=t,!0)}},{key:"ensureSceneAttachment",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!this.transformControls&&this.scene&&this.camera&&this.renderer?(this.createTransformControls(),this.setupEventListeners(),t||(this.transformControls.visible=!1),!0):!(!this.transformControls||!this.scene)&&(this.scene.children.includes(this.transformControls)?!this.transformControls.visible&&t?(this.transformControls.visible=!0,!0):this.transformControls.visible&&!t?(this.transformControls.visible=!1,!0):!(!this.transformControls.parent||this.transformControls.parent===this.scene)&&(this.transformControls.parent.remove(this.transformControls),this.scene.add(this.transformControls),!0):(this.scene.add(this.transformControls),this.transformControls.enabled=!1,this.selectedObject&&(this.transformControls.attach(this.selectedObject),this.transformControls.enabled=this.config.enabled),t||(this.transformControls.visible=!1),!0))}},{key:"getTransformData",value:function(){if(!this.selectedObject)return null;var t={position:this.selectedObject.position.clone(),rotation:this.selectedObject.rotation.clone(),scale:this.selectedObject.scale.clone()},i=this.getWorldTransformData();return{object:this.selectedObject,position:t.position,rotation:t.rotation,scale:t.scale,worldPosition:i.position,worldRotation:i.rotation,worldScale:i.scale,mode:this.currentMode,space:this.currentSpace,isTransforming:this.transformState.isTransforming}}},{key:"getWorldTransformData",value:function(){if(!this.selectedObject)return null;this.selectedObject.updateMatrixWorld(!0);var t=new n.Vector3;this.selectedObject.getWorldPosition(t);var i=new n.Quaternion;this.selectedObject.getWorldQuaternion(i);var s=new n.Euler;s.setFromQuaternion(i);var e=new n.Vector3;return this.selectedObject.getWorldScale(e),{position:t,rotation:s,scale:e}}},{key:"updateObjectTransform",value:function(t,i,s){var e=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(this.selectedObject){var n=this.selectedObject,h=parseFloat(s);if(!isNaN(h)){if(e)this.updateWorldTransform(n,t,i,h);else switch(t){case"position":n.position[i]=h;break;case"rotation":n.rotation[i]=h*(Math.PI/180);break;case"scale":n.scale[i]=h;break;default:return}this.transformControls&&this.transformControls.updateMatrixWorld(),this.updateBoundingBox()}}}},{key:"updateWorldTransform",value:function(t,i,s,e){switch(t.updateMatrixWorld(!0),i){case"position":this.setWorldPosition(t,s,e);break;case"rotation":this.setWorldRotation(t,s,e);break;case"scale":this.setWorldScale(t,s,e)}}},{key:"setWorldPosition",value:function(t,i,s){var e=new n.Vector3;if(t.getWorldPosition(e),e[i]=s,t.parent){var h=new n.Matrix4;h.copy(t.parent.matrixWorld).invert(),e.applyMatrix4(h)}t.position.copy(e)}},{key:"setWorldRotation",value:function(t,i,s){var e=new n.Quaternion;t.getWorldQuaternion(e);var h=new n.Euler;h.setFromQuaternion(e),h[i]=s*(Math.PI/180);var o=new n.Quaternion;if(o.setFromEuler(h),t.parent){var a=new n.Quaternion;t.parent.getWorldQuaternion(a),a.invert(),o.premultiply(a)}t.quaternion.copy(o)}},{key:"setWorldScale",value:function(t,i,s){var e=new n.Vector3;t.getWorldScale(e);var h=s/e[i];t.scale[i]*=h}},{key:"getSelectableObjectsWithBounds",value:function(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=[];return this.scene.traverse(function(e){var h,o;if(e&&e.isObject3D&&!(e.isTransformControls||e.isTransformControlsPlane||e.isTransformControlsGizmo||e.isHelper||null!==(h=e.userData)&&void 0!==h&&h.isHelper||null!==(o=e.userData)&&void 0!==o&&o.isBoundingBox))try{if(i?i(e):t.isSelectableObject(e)){e.updateMatrixWorld(!0);var a=t.boundingBoxCache.get(e);a&&e!==t.selectedObject||(a=(new n.Box3).setFromObject(e),t.boundingBoxCache.set(e,a)),s.push({object:e,boundingBox:a})}}catch(t){}}),s}},{key:"intersectObjectsBoundingBoxes",value:function(i){var s,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,h=this.getSelectableObjectsWithBounds(e),o=[],a=t.createForOfIteratorHelper(h);try{for(a.s();!(s=a.n()).done;){var l=s.value,r=l.object,u=l.boundingBox,c=i.ray.intersectBox(u,new n.Vector3);if(c){var v=i.ray.origin.distanceTo(c);o.push({object:r,point:c,distance:v,boundingBox:u})}}}catch(t){a.e(t)}finally{a.f()}return o.sort(function(t,i){return t.distance-i.distance}),o}},{key:"setBoundingBoxSelection",value:function(t){this.config.useBoundingBoxSelection=t}},{key:"handleObjectRemoval",value:function(){var t;this.selectedObject&&"gateway"===(null===(t=this.selectedObject.userData)||void 0===t?void 0:t.componentType)&&this.handleGatewayRemoval()}},{key:"handleGatewayRemoval",value:function(){var i,s=this.selectedObject,e={uuid:s.uuid,userData:t.objectSpread2({},s.userData),position:s.position.clone(),connections:(null===(i=s.userData)||void 0===i?void 0:i.connections)||null};s.userData.origin="computed",this.deselectObject(),this.callbacks.onObjectRemoved&&this.callbacks.onObjectRemoved(e)}},{key:"dispose",value:function(){this.eventHandlers.keydown&&window.removeEventListener("keydown",this.eventHandlers.keydown),this.eventHandlers.click&&this.renderer.domElement.removeEventListener("click",this.eventHandlers.click),this.removeBoundingBox(),this.selectedObject&&this.deselectObject(),this.transformControls&&(this.eventHandlers.transformStart&&this.transformControls.removeEventListener("mouseDown",this.eventHandlers.transformStart),this.eventHandlers.transformEnd&&this.transformControls.removeEventListener("mouseUp",this.eventHandlers.transformEnd),this.eventHandlers.transforming&&this.transformControls.removeEventListener("objectChange",this.eventHandlers.transforming),this.transformControls.detach(),this.scene&&this.transformControls.parent===this.scene&&this.scene.remove(this.transformControls),this.transformControls.dispose(),this.transformControls=null),this.selectedObject=null,this.orbitControls=null}},{key:"forceHide",value:function(){this.transformControls&&(this.i(),this.transformControls.enabled=!1)}},{key:"_hideTransformControls",value:function(){this.transformControls&&(this.transformControls.visible=!1,this.transformControls.p&&(this.transformControls.p.visible=!1),this.transformControls.j&&(this.transformControls.j.visible=!1))}},{key:"_showTransformControls",value:function(){this.transformControls&&(this.transformControls.visible=!0,this.transformControls.p&&(this.transformControls.p.visible=!0),this.transformControls.j&&(this.transformControls.j.visible=!0))}},{key:"getVisibilityState",value:function(){var t;return this.transformControls?{exists:!0,visible:this.transformControls.visible,enabled:this.transformControls.enabled,gizmoVisible:this.transformControls.p?this.transformControls.p.visible:"N/A",planeVisible:this.transformControls.j?this.transformControls.j.visible:"N/A",hasSelectedObject:!!this.selectedObject,selectedObjectName:(null===(t=this.selectedObject)||void 0===t?void 0:t.name)||"none"}:{exists:!1}}},{key:"_forceHideAllGizmoComponents",value:function(){if(this.transformControls&&this.transformControls.p){var t=this.transformControls.p;t.visible=!1,t.gizmo&&Object.keys(t.gizmo).forEach(function(i){t.gizmo[i]&&(t.gizmo[i].visible=!1)}),t.helper&&Object.keys(t.helper).forEach(function(i){t.helper[i]&&(t.helper[i].visible=!1)}),this.transformControls.j&&(this.transformControls.j.visible=!1)}}},{key:"_hidePlaneHelpers",value:function(){if(this.transformControls&&this.transformControls.p){var t=this.transformControls.p;if(t.gizmo&&t.gizmo.translate)t.gizmo.translate.traverse(function(t){"XY"!==t.name&&"YZ"!==t.name&&"XZ"!==t.name||(t.visible=!1)});if(t.picker&&t.picker.translate)t.picker.translate.traverse(function(t){"XY"!==t.name&&"YZ"!==t.name&&"XZ"!==t.name||(t.visible=!1)})}}},{key:"_showPlaneHelpers",value:function(){if(this.transformControls&&this.transformControls.p){var t=this.transformControls.p;if(t.gizmo&&t.gizmo.translate)t.gizmo.translate.traverse(function(t){"XY"!==t.name&&"YZ"!==t.name&&"XZ"!==t.name||(t.visible=!0)});if(t.picker&&t.picker.translate)t.picker.translate.traverse(function(t){"XY"!==t.name&&"YZ"!==t.name&&"XZ"!==t.name||(t.visible=!0)})}}}])}();exports.TransformControlsManager=h,exports.createTransformControls=function(t,i,s){return new h(t,i,s,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("three"),n=require("../../../node_modules/three/examples/jsm/loaders/RGBELoader.js"),t=require("./textureConfig.js"),o=require("../../core/debugLogger.js");function a(e){if(e&&e.t)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}}),r.default=e,Object.freeze(r)}var i=a(r),u=function(){return e.createClass(function r(n){e.classCallCheck(this,r),this.sceneViewer=n},[{key:"createSkybox",value:(f=e.asyncToGenerator(e.regenerator().m(function r(){var t,o,a,u,c,s,l,f,v,d;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:t=this.sceneViewer,(o=new i.PMREMGenerator(t.renderer)).compileEquirectangularShader(),a=[{type:"hdr",loader:new n.RGBELoader,paths:["/skyboxes/kloofendal_48d_partly_cloudy_puresky_2k.hdr","/skyboxes/kloofendal_48d_partly_cloudy_puresky_1k.hdr"]},{type:"jpeg",loader:t.textureLoader,paths:["/skyboxes/sky_fallback.jpg"]}],u=function(e,r){try{var n,a;e.mapping=i.EquirectangularReflectionMapping;var u=o.fromEquirectangular(e).texture;return null!==(n=t.scene.environment)&&void 0!==n&&n.dispose&&t.scene.environment.dispose(),null!==(a=t.scene.background)&&void 0!==a&&a.dispose&&t.scene.background.dispose(),t.scene.environment=u,t.scene.background=u,e.dispose(),!0}catch(e){return!1}},c=e.regenerator().m(function r(){var n,t,a,i,c,s,v,d;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:(n=f[l]).type,t=n.loader,a=n.paths,i=e.createForOfIteratorHelper(a),r.p=1,s=e.regenerator().m(function r(){var n,a;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=c.value,e.p=1,e.n=2,new Promise(function(e,r){var o=setTimeout(function(){return r(new Error("Timeout"))},1e4);t.load(n,function(r){clearTimeout(o),e(r)},void 0,function(e){clearTimeout(o),r(e)})});case 2:if(a=e.v,!u(a)){e.n=3;break}return o.dispose(),e.a(2,{v:{v:void 0}});case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2)}},r,null,[[1,4]])}),i.s();case 2:if((c=i.n()).done){r.n=5;break}return r.d(e.regeneratorValues(s()),3);case 3:if(!(v=r.v)){r.n=4;break}return r.a(2,v.v);case 4:r.n=2;break;case 5:r.n=7;break;case 6:r.p=6,d=r.v,i.e(d);case 7:return r.p=7,i.f(),r.f(7);case 8:return r.a(2)}},r,null,[[1,6,7,8]])}),l=0,f=a;case 1:if(!(l<f.length)){r.n=4;break}return r.d(e.regeneratorValues(c()),2);case 2:if(!(s=r.v)){r.n=3;break}return r.a(2,s.v);case 3:l++,r.n=1;break;case 4:v=new i.AmbientLight(16777215,.6),t.scene.add(v),(d=new i.Scene).add(new i.HemisphereLight(8900331,4473975,1)),t.scene.environment=o.fromScene(d).texture,t.scene.background=new i.Color(8900331),o.dispose();case 5:return r.a(2)}},r,this)})),function(){return f.apply(this,arguments)})},{key:"setupLighting",value:function(){var e=this.sceneViewer;e.scene.children=e.scene.children.filter(function(e){return!(e instanceof i.Light)});var r=new i.DirectionalLight(16777195,5);r.position.set(15,30,-10),r.castShadow=!0,r.shadow.camera.near=.1,r.shadow.camera.far=100,r.shadow.camera.left=-50,r.shadow.camera.right=50,r.shadow.camera.top=50,r.shadow.camera.bottom=-50,r.shadow.mapSize.width=2048,r.shadow.mapSize.height=2048,e.scene.add(r);var n=new i.DirectionalLight(16777164,.4);n.position.set(-10,10,-10),e.scene.add(n),o.logger.info("Scene lighting setup completed")}},{key:"addTexturedGround",value:(l=e.asyncToGenerator(e.regenerator().m(function r(){var n,a,u,c,s,l;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=this.sceneViewer,o.logger.debug("Starting addTexturedGround..."),a=new i.PlaneGeometry(30,30),u=new i.MeshStandardMaterial({color:7829367,metalness:.2,roughness:.9}),(c=new i.Mesh(a,u)).rotation.x=-Math.PI/2,c.position.y=0,c.receiveShadow=!0,c.name="Ground",c.userData.isBaseGround=!0,n.scene.add(c),e.p=1,o.logger.debug("Loading concrete texture set..."),e.n=2,t.loadTextureSetAndCreateMaterial("gravel_embedded_concrete",n.textureLoader);case 2:s=e.v,c.material=s,c.material.needsUpdate=!0,o.logger.success("Ground material updated with textures"),e.n=4;break;case 3:e.p=3,l=e.v,o.logger.warn("Error loading ground textures:",l);case 4:return e.a(2)}},r,this,[[1,3]])})),function(){return l.apply(this,arguments)})},{key:"addBrickWalls",value:(s=e.asyncToGenerator(e.regenerator().m(function r(){var n,a,u,c,s,l,f;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=this.sceneViewer,o.logger.debug("Starting addBrickWalls..."),a=2.5,u=.5,c=new i.MeshPhysicalMaterial({color:7824226,roughness:.9,metalness:.1,clearcoat:.05,clearcoatRoughness:.4}),s=function(e){var r=function(r,t,o,a,u,c){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1,f=new i.BoxGeometry(r,t,o);if(1!==l){for(var v=f.attributes.uv,d=v.array,h=0;h<d.length;h+=2)d[h+1]*=l;v.needsUpdate=!0}var k=new i.Mesh(f,e);return k.position.set(a,u-.56,c),0!==s&&k.rotateY(s),k.userData.isBrickWall=!0,k.castShadow=!0,k.receiveShadow=!0,k.name="Wall",n.scene.add(k),k};r(30,a,u,0,1.25,14.75,0,1),r(30,a,u,0,1.25,-14.75,0,1),r(u,8.5,29,14.75,4.25,0,0,3.4),r(u,a,29,-14.75,1.25,0,0,1)},s(c),o.logger.debug("Basic brick walls created"),e.p=1,o.logger.debug("Loading brick texture set..."),e.n=2,t.loadTextureSetAndCreateMaterial("brick",n.textureLoader);case 2:l=e.v,n.scene.traverse(function(e){e.isMesh&&e.userData.isBrickWall&&(e.material=l,e.material.needsUpdate=!0)}),o.logger.success("Brick walls updated with textures"),e.n=4;break;case 3:e.p=3,f=e.v,o.logger.warn("Error loading brick textures:",f);case 4:return e.a(2)}},r,this,[[1,3]])})),function(){return s.apply(this,arguments)})},{key:"addHorizonFog",value:function(){var e=this.sceneViewer,r=new i.ShaderMaterial({transparent:!0,uniforms:{fogColor:{value:new i.Color(5533306)},fogDensity:{value:1}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform vec3 fogColor;\n uniform float fogDensity;\n varying vec2 vUv;\n \n void main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = distance(vUv, center);\n float opacity = (1.0 - smoothstep(0.0, 0.5, dist)) * fogDensity;\n gl_FragColor = vec4(fogColor, opacity);\n }\n ",side:i.DoubleSide}),n=new i.PlaneGeometry(300,300),t=new i.Mesh(n,r);return t.rotation.x=-Math.PI/2,t.position.y=-3,t.name="fogPlane",e.scene.add(t),t}},{key:"initializeEnvironment",value:(c=e.asyncToGenerator(e.regenerator().m(function r(){return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.createSkybox();case 1:return this.setupLighting(),e.n=2,this.addTexturedGround();case 2:return e.n=3,this.addBrickWalls();case 3:this.addHorizonFog(),o.logger.info("Environment initialization completed");case 4:return e.a(2)}},r,this)})),function(){return c.apply(this,arguments)})},{key:"removeSkybox",value:function(){var e=this.sceneViewer;try{var r,n;return null!==(r=e.scene.environment)&&void 0!==r&&r.dispose&&e.scene.environment.dispose(),null!==(n=e.scene.background)&&void 0!==n&&n.dispose&&e.scene.background.dispose(),e.scene.environment=null,e.scene.background=new i.Color(16777215),o.logger.info("Skybox removed successfully"),!0}catch(e){return!1}}},{key:"setSkyboxType",value:(u=e.asyncToGenerator(e.regenerator().m(function r(n){var t,a,u,c,s;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:t=this.sceneViewer,e.p=1,null!==(a=t.scene.environment)&&void 0!==a&&a.dispose&&t.scene.environment.dispose(),null!==(u=t.scene.background)&&void 0!==u&&u.dispose&&t.scene.background.dispose(),(c=new i.PMREMGenerator(t.renderer)).compileEquirectangularShader(),s=n,e.n="HDR"===s?2:"Fallback"===s?4:"Color"===s?6:7;break;case 2:return e.n=3,this.loadHDRSkybox(c);case 3:case 5:return e.a(3,8);case 4:return e.n=5,this.loadFallbackSkybox(c);case 6:return this.setColorBackground(),e.a(3,8);case 7:return e.n=8,this.loadHDRSkybox(c);case 8:return c.dispose(),o.logger.info("Skybox type changed to: ".concat(n)),e.a(2,!0);case 9:return e.p=9,e.v,e.a(2,!1)}},r,this,[[1,9]])})),function(e){return u.apply(this,arguments)})},{key:"loadHDRSkybox",value:(a=e.asyncToGenerator(e.regenerator().m(function r(t){var o,a,u,c,s,l,f;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:o=this.sceneViewer,a=new n.RGBELoader,u=["/skyboxes/kloofendal_48d_partly_cloudy_puresky_2k.hdr","/skyboxes/kloofendal_48d_partly_cloudy_puresky_1k.hdr"],c=e.regenerator().m(function r(){var n,u,c;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return n=f[l],e.p=1,e.n=2,new Promise(function(e,r){var t=setTimeout(function(){return r(new Error("Timeout"))},1e4);a.load(n,function(r){clearTimeout(t),e(r)},void 0,function(e){clearTimeout(t),r(e)})});case 2:return(u=e.v).mapping=i.EquirectangularReflectionMapping,c=t.fromEquirectangular(u).texture,o.scene.environment=c,o.scene.background=c,u.dispose(),e.a(2,{v:void 0});case 3:e.p=3,e.v;case 4:return e.a(2)}},r,null,[[1,3]])}),l=0,f=u;case 1:if(!(l<f.length)){r.n=4;break}return r.d(e.regeneratorValues(c()),2);case 2:if(!(s=r.v)){r.n=3;break}return r.a(2,s.v);case 3:l++,r.n=1;break;case 4:throw new Error("Failed to load any HDR skybox");case 5:return r.a(2)}},r,this)})),function(e){return a.apply(this,arguments)})},{key:"loadFallbackSkybox",value:(r=e.asyncToGenerator(e.regenerator().m(function r(n){var t,o,a;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return t=this.sceneViewer,e.p=1,e.n=2,new Promise(function(e,r){var n=setTimeout(function(){return r(new Error("Timeout"))},1e4);t.textureLoader.load("/skyboxes/sky_fallback.jpg",function(r){clearTimeout(n),e(r)},void 0,function(e){clearTimeout(n),r(e)})});case 2:(o=e.v).mapping=i.EquirectangularReflectionMapping,a=n.fromEquirectangular(o).texture,t.scene.environment=a,t.scene.background=a,o.dispose(),e.n=4;break;case 3:throw e.p=3,e.v;case 4:return e.a(2)}},r,this,[[1,3]])})),function(e){return r.apply(this,arguments)})},{key:"setColorBackground",value:function(){var e=this.sceneViewer;e.scene.environment=null,e.scene.background=new i.Color(16777215);var r=new i.AmbientLight(16777215,.6);e.scene.add(r)}}]);var r,a,u,c,s,l,f}();exports.EnvironmentManager=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js");function r(e){if(e&&e.t)return e;var r=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),r.default=e,Object.freeze(r)}var t=r(require("three")),n={light_metal:{path:"/textures/gravel_embedded_concrete_1k",files:{diffuse:"diffuse.jpg",normal:"normal.jpg",roughness:"rough.jpg"},repeat:{x:2,y:2},materialProps:{color:12105912,metalness:.3,roughness:.3,normalScale:[.4,.4],clearcoat:.3,clearcoatRoughness:.2,envMapIntensity:1.6,reflectivity:.5}},brick:{path:"/textures/pavement_03_1k",files:{diffuse:"diffuse.jpg",normal:"normal.jpg",roughness:"rough.jpg"},repeat:{x:7.5,y:.75},materialProps:{color:10061960,roughness:.9,metalness:.1,normalScale:[1.5,1.5],bumpScale:.05,clearcoat:.05,clearcoatRoughness:.4}},gravel_embedded_concrete:{path:"/textures/gravel_embedded_concrete_1k",files:{diffuse:"diffuse.jpg",normal:"normal.jpg",roughness:"rough.jpg"},repeat:{x:7,y:7},materialProps:{color:6710886,metalness:0,roughness:1,normalScale:[1,1]}}};function o(e,r){return u.apply(this,arguments)}function u(){return u=e.asyncToGenerator(e.regenerator().m(function r(o,u){var a,s,c,i,l;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:if(a=n[o]){r.n=1;break}throw new Error('Texture set "'.concat(o,'" not found'));case 1:return s=function(e){return new Promise(function(r,t){u.load(e,function(e){r(e)},void 0,function(e){t(e)})})},c=Object.entries(a.files).map(function(){var r=e.asyncToGenerator(e.regenerator().m(function r(t){var n,o,u,c,i;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:return n=e.slicedToArray(t,2),o=n[0],u=n[1],c="".concat(a.path,"/").concat(u),r.n=1,s(c);case 1:return i=r.v,r.a(2,[o,i])}},r)}));return function(e){return r.apply(this,arguments)}}()),r.n=2,Promise.all(c);case 2:return i=r.v,l=Object.fromEntries(i),Object.values(l).forEach(function(e){e.wrapS=e.wrapT=t.RepeatWrapping,e.repeat.set(a.repeat.x,a.repeat.y)}),r.a(2,{textures:l,config:a})}},r)})),u.apply(this,arguments)}function a(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.textures,u=r.config,a=e.objectSpread2(e.objectSpread2({map:o.diffuse,normalMap:o.normal,roughnessMap:o.roughness},u.materialProps),n);return a.normalScale&&Array.isArray(a.normalScale)&&(a.normalScale=e.construct(t.Vector2,e.toConsumableArray(a.normalScale))),new t.MeshPhysicalMaterial(a)}function s(){return s=e.asyncToGenerator(e.regenerator().m(function r(t,n){var u,s,c=arguments;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return u=c.length>2&&void 0!==c[2]?c[2]:{},e.n=1,o(t,n);case 1:return s=e.v,e.a(2,a(s,u))}},r)})),s.apply(this,arguments)}exports.TEXTURE_SETS=n,exports.createMaterialFromTextureSet=a,exports.loadTextureSet=o,exports.loadTextureSetAndCreateMaterial=function(e,r){return s.apply(this,arguments)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js"),n=require("../../core/nameUtils.js"),t=function(){return e.createClass(function n(t){e.classCallCheck(this,n),this.sceneViewer=t},[{key:"exportSceneData",value:function(){var t=this;if(!this.sceneViewer.scene)return null;var r=function(e){var t,o,l,a,i,u,s,c,v=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||null!==(t=e.name)&&void 0!==t&&t.includes("Polyline")||null!==(o=e.userData)&&void 0!==o&&o.isBrickWall||null!==(l=e.userData)&&void 0!==l&&l.isBaseGround||null!==(a=e.userData)&&void 0!==a&&a.isBaseGrid||e.isLight||null!==(i=e.userData)&&void 0!==i&&i.isTransformControls||e.isTransformControls||e.type&&e.type.includes("TransformControls"))return null;if(!(v||null!==(u=e.userData)&&void 0!==u&&u.componentType))return null;if(v&&(null===(s=e.userData)||void 0===s||!s.forExport))return null;if(v&&null!==(c=e.userData)&&void 0!==c&&c.forExport);var d,p,f,h={uuid:n.getHardcodedUuid(e),name:e.name||"Unnamed Object",type:e.type||"Object3D"};(e.userData&&Object.keys(e.userData).length>0&&(h.userData={},Object.keys(e.userData).forEach(function(n){"worldBoundingBox"!==n&&"isBaseGround"!==n&&"isBrickWall"!==n&&"isBaseGrid"!==n&&"isTransformControls"!==n&&(h.userData[n]=e.userData[n])}),e.userData.dimensions&&(h.userData.dimensions=e.userData.dimensions),0===Object.keys(h.userData).length&&delete h.userData),h.position={x:parseFloat(e.position.x.toFixed(6)),y:parseFloat(e.position.y.toFixed(6)),z:parseFloat(e.position.z.toFixed(6))},h.rotation={x:parseFloat((e.rotation.x*(180/Math.PI)).toFixed(6)),y:parseFloat((e.rotation.y*(180/Math.PI)).toFixed(6)),z:parseFloat((e.rotation.z*(180/Math.PI)).toFixed(6))},h.scale={x:parseFloat(e.scale.x.toFixed(6)),y:parseFloat(e.scale.y.toFixed(6)),z:parseFloat(e.scale.z.toFixed(6))},e.geometry)&&(null!==(d=e.name)&&void 0!==d&&d.toLowerCase().includes("connector")?h.geometry="CONNECTOR-GEO":null!==(p=e.name)&&void 0!==p&&p.toLowerCase().includes("gateway")?h.geometry="GATEWAY-GEO":null!==(f=e.userData)&&void 0!==f&&f.libraryId&&(h.geometry="".concat(e.userData.libraryId,"-GEO")));if(e.children&&e.children.length>0){var O=[];e.children.forEach(function(e){var n=r(e,!0);n&&O.push(n)}),O.length>0&&(h.children=O)}return h},o=[];this.sceneViewer.scene.children.forEach(function(e){var n=r(e);n&&o.push(n)});var l,a,i={connections:(a=[],null!==(l=t.sceneViewer.currentSceneData)&&void 0!==l&&l.connections&&a.push.apply(a,e.toConsumableArray(t.sceneViewer.currentSceneData.connections)),a),scene:{object:{uuid:"PLANT-SCENE",name:"Scene",type:"Scene",children:o}}};return i.o={exportedAt:(new Date).toISOString(),exportedFrom:"SceneViewerEnhanced",version:"1.0.0",objectCount:o.length},i}},{key:"downloadSceneExport",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=this.exportSceneData();if(!n)return!1;e||(e="cp-export.json");try{var t=JSON.stringify(n,null,2),r=new Blob([t],{type:"application/json"}),o=URL.createObjectURL(r),l=document.createElement("a");return l.href=o,l.download=e,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(o),!0}catch(e){return!1}}},{key:"exportSceneDataAsString",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.exportSceneData();return n?e?JSON.stringify(n,null,2):JSON.stringify(n):null}},{key:"getExportMetadata",value:function(){var e;if(!this.sceneViewer.scene)return null;var n=0;return this.sceneViewer.scene.traverse(function(){return n++}),{totalObjects:n,hasCurrentSceneData:!!this.sceneViewer.currentSceneData,connectionsCount:(null===(e=this.sceneViewer.currentSceneData)||void 0===e||null===(e=e.connections)||void 0===e?void 0:e.length)||0,exportTimestamp:(new Date).toISOString()}}}])}();exports.SceneExportManager=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("three"),n=require("../../../node_modules/three/examples/jsm/controls/OrbitControls.js"),i=require("../../../node_modules/three/examples/jsm/loaders/GLTFLoader.js"),r=require("../system/performanceMonitor.js"),o=require("../../core/debugLogger.js");function u(e){if(e&&e.t)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var s=u(t),a=function(){return e.createClass(function t(n){e.classCallCheck(this,t),this.sceneViewer=n,this.textureLoader=null,this.gltfLoader=null},[{key:"initializeScene",value:(u=e.asyncToGenerator(e.regenerator().m(function t(){var n,i,r,u;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:(n=this.sceneViewer).scene=new s.Scene,i=n.$refs.container.getBoundingClientRect(),r=i.width,u=i.height,n.camera=new s.PerspectiveCamera(50,r/u,.01,1e3),n.camera.position.set(-8,4,9),n.renderer=new s.WebGLRenderer({antialias:!0}),n.renderer.setSize(r,u),n.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),n.renderer.shadowMap.enabled=!0,n.renderer.shadowMap.type=s.PCFSoftShadowMap,n.renderer.physicallyCorrectLights=!0,n.renderer.outputColorSpace=s.SRGBColorSpace,n.renderer.toneMapping=s.LinearToneMapping,n.renderer.toneMappingExposure=1.5,n.$refs.container.appendChild(n.renderer.domElement),o.logger.info("Scene, camera, and renderer initialized");case 1:return e.a(2)}},t,this)})),function(){return u.apply(this,arguments)})},{key:"initializePerformanceMonitoring",value:function(){var e=this.sceneViewer;if("development"===process.env.NODE_ENV)try{var t=document.querySelectorAll("#performance-monitor-ui");t.length>0&&t.forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}catch(e){}e.performanceMonitor=new r.PerformanceMonitor(e.renderer),e.performanceUI=new r.PerformanceUI(e.performanceMonitor,e.$refs.container,"light"),e.performanceMonitor.on("warning",function(e){}),e.performanceMonitor.start(),e.performanceUI.show(),this.exposePerformanceMonitoringGlobally(),o.logger.info("Performance monitoring initialized")}},{key:"exposePerformanceMonitoringGlobally",value:function(){var e=this,t=this.sceneViewer;"undefined"!=typeof window&&(window._performanceMonitor=t.performanceMonitor,window._performanceUI=t.performanceUI,window.performance3D={show:function(){return t.performanceUI.show()},hide:function(){return t.performanceUI.hide()},toggle:function(){return t.performanceUI.isVisible?t.performanceUI.hide():t.performanceUI.show()},setTheme:function(e){return t.performanceUI.setTheme(e)},log:function(){return t.performanceMonitor.logSummary()},reset:function(){return t.performanceMonitor.reset()},export:function(){return t.performanceMonitor.exportData()},cleanup:function(){return t.cleanupDuplicatePerformanceMonitors?t.cleanupDuplicatePerformanceMonitors():0},help:function(){}},window.cameraControls={autoRotate:{enable:function(){return e.toggleAutoRotation(!0)},disable:function(){return e.toggleAutoRotation(!1)},toggle:function(){return e.toggleAutoRotation()},setSpeed:function(e){if(t.controls)return t.controls.autoRotateSpeed=e,e}},help:function(){}})}},{key:"initializeLoaders",value:function(){var e=this.sceneViewer;this.textureLoader=new s.TextureLoader,e.textureLoader=this.textureLoader,this.gltfLoader=new i.GLTFLoader,e.gltfLoader=this.gltfLoader,o.logger.info("Texture and GLTF loaders initialized")}},{key:"setupControls",value:function(){this.sceneViewer.controls=new n.OrbitControls(this.sceneViewer.camera,this.sceneViewer.renderer.domElement),this.sceneViewer.controls.enableDamping=!0,this.sceneViewer.controls.dampingFactor=.05,this.sceneViewer.controls.minDistance=1,this.sceneViewer.controls.maxDistance=20,this.sceneViewer.controls.maxPolarAngle=Math.PI/1.5,this.sceneViewer.controls.autoRotate=!0,this.sceneViewer.controls.autoRotateSpeed=.5,o.logger.info("Orbit controls initialized with auto-rotation")}},{key:"setDefaultBackground",value:function(){this.sceneViewer.scene.background=new s.Color(8965358),o.logger.info("Default scene background set")}},{key:"initialize",value:(t=e.asyncToGenerator(e.regenerator().m(function t(){return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.initializeScene();case 1:this.initializePerformanceMonitoring(),this.initializeLoaders(),this.setupControls(),this.setDefaultBackground(),o.logger.info("Scene initialization completed");case 2:return e.a(2)}},t,this)})),function(){return t.apply(this,arguments)})},{key:"toggleAutoRotation",value:function(e){var t=this.sceneViewer;return!!t.controls&&(t.controls.autoRotate=void 0!==e?e:!t.controls.autoRotate,t.controls.autoRotate&&(t.controls.dampingFactor=1,setTimeout(function(){t.controls.dampingFactor=.05},100)),o.logger.info("Camera auto-rotation is now ".concat(t.controls.autoRotate?"ENABLED":"DISABLED")),t.controls.autoRotate)}}]);var t,u}();exports.SceneInitializationManager=a;
|