@roomle/web-sdk 5.1.0-alpha.3 → 5.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{BufferGeometry-Bl5whHAB.mjs → BufferGeometry-CxlpBjLq.mjs} +192 -195
- package/lib/BufferGeometry-CxlpBjLq.mjs.map +1 -0
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GLTFExporter-yQ7mMauu.mjs → GLTFExporter-DeNw0qAI.mjs} +86 -80
- package/lib/GLTFExporter-DeNw0qAI.mjs.map +1 -0
- package/lib/GaussianBlurNode-BR1cKBsX.mjs +65 -0
- package/lib/GaussianBlurNode-BR1cKBsX.mjs.map +1 -0
- package/lib/{Object3D-BHdngbxB.mjs → Object3D-CALIQdg1.mjs} +142 -59
- package/lib/Object3D-CALIQdg1.mjs.map +1 -0
- package/lib/{Pass-DLiMLT5k.mjs → Pass-DCljS3Z-.mjs} +4 -4
- package/lib/{Pass-DLiMLT5k.mjs.map → Pass-DCljS3Z-.mjs.map} +1 -1
- package/lib/{PointLightHelper-CuPSBuDU.mjs → PointLightHelper-C_0CYp7R.mjs} +35 -32
- package/lib/PointLightHelper-C_0CYp7R.mjs.map +1 -0
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{SpotLightHelper-m-Rh8vGU.mjs → SpotLightHelper-UUIHn43T.mjs} +22 -19
- package/lib/SpotLightHelper-UUIHn43T.mjs.map +1 -0
- package/lib/{USDZExporter-MdkuT226.mjs → USDZExporter-BBNw7Hey.mjs} +6 -3
- package/lib/USDZExporter-BBNw7Hey.mjs.map +1 -0
- package/lib/{Vector4-C7TlIAyy.mjs → Vector4-BOcWTZJI.mjs} +2 -2
- package/lib/Vector4-BOcWTZJI.mjs.map +1 -0
- package/lib/{api-KWh-ESd5.mjs → api-CwEjmjrn.mjs} +2 -2
- package/lib/{api-KWh-ESd5.mjs.map → api-CwEjmjrn.mjs.map} +1 -1
- package/lib/asset-loader.worker-CzI1oyTY.mjs.map +1 -1
- package/lib/{banana-for-scale-DpKXNBt_.mjs → banana-for-scale-Cf41yXTl.mjs} +3 -3
- package/lib/{banana-for-scale-DpKXNBt_.mjs.map → banana-for-scale-Cf41yXTl.mjs.map} +1 -1
- package/lib/budgeteer.sw-D80jTmYa.mjs.map +1 -1
- package/lib/{common-utils-DbL4tku0.mjs → common-utils-OTJQGohe.mjs} +3 -3
- package/lib/common-utils-OTJQGohe.mjs.map +1 -0
- package/lib/{component-dimensioning-luQ3LgrU.mjs → component-dimensioning-yPK46Y5o.mjs} +26 -26
- package/lib/{component-dimensioning-luQ3LgrU.mjs.map → component-dimensioning-yPK46Y5o.mjs.map} +1 -1
- package/lib/{component-raycast-helper-hj6sm7jw.mjs → component-raycast-helper-CnpnRaFg.mjs} +15 -15
- package/lib/{component-raycast-helper-hj6sm7jw.mjs.map → component-raycast-helper-CnpnRaFg.mjs.map} +1 -1
- package/lib/{configurator-CQ7KsW0O.mjs → configurator-iYlO_buA.mjs} +4 -4
- package/lib/{configurator-CQ7KsW0O.mjs.map → configurator-iYlO_buA.mjs.map} +1 -1
- package/lib/configurator-y7zIaUe_.mjs +2 -0
- package/lib/{continuous-drawing-helper-DqHIR_qF.mjs → continuous-drawing-helper-CTfGRTfH.mjs} +3 -3
- package/lib/{continuous-drawing-helper-DqHIR_qF.mjs.map → continuous-drawing-helper-CTfGRTfH.mjs.map} +1 -1
- package/lib/dimensioning-helper-CQlesi-m.mjs +2 -0
- package/lib/{dimensioning-helper-CGPjS2hW.mjs → dimensioning-helper-DSlkLDmx.mjs} +42 -36
- package/lib/dimensioning-helper-DSlkLDmx.mjs.map +1 -0
- package/lib/{glb-viewer-BWMMzvuG.mjs → glb-viewer-AGV-_xKd.mjs} +33 -33
- package/lib/{glb-viewer-BWMMzvuG.mjs.map → glb-viewer-AGV-_xKd.mjs.map} +1 -1
- package/lib/glb-viewer-DSzNR4CI.mjs +2 -0
- package/lib/{highlight-coordinator-DYjBxYpy.mjs → highlight-coordinator-DU6oFunq.mjs} +6 -6
- package/lib/{highlight-coordinator-DYjBxYpy.mjs.map → highlight-coordinator-DU6oFunq.mjs.map} +1 -1
- package/lib/{homag-intelligence-lbse0Y0v.mjs → homag-intelligence-D_yBv0ig.mjs} +3 -3
- package/lib/{homag-intelligence-lbse0Y0v.mjs.map → homag-intelligence-D_yBv0ig.mjs.map} +1 -1
- package/lib/{hosek-wilkie-sky-iMar2iw-.mjs → hosek-wilkie-sky-DmTvnxMA.mjs} +33 -33
- package/lib/{hosek-wilkie-sky-iMar2iw-.mjs.map → hosek-wilkie-sky-DmTvnxMA.mjs.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-CyGqK7nu.mjs → imos-ix-poc-export-helper-BGN97m8W.mjs} +3 -3
- package/lib/{imos-ix-poc-export-helper-CyGqK7nu.mjs.map → imos-ix-poc-export-helper-BGN97m8W.mjs.map} +1 -1
- package/lib/kernel-BWfRHWkW.mjs.map +1 -1
- package/lib/{kernel-utils-BvatnA7U.mjs → kernel-utils-BYKmP0mf.mjs} +13 -13
- package/lib/{kernel-utils-BvatnA7U.mjs.map → kernel-utils-BYKmP0mf.mjs.map} +1 -1
- package/lib/{material-viewer-BKTxh5Ui.mjs → material-viewer-BuBSXGw6.mjs} +18 -18
- package/lib/{material-viewer-BKTxh5Ui.mjs.map → material-viewer-BuBSXGw6.mjs.map} +1 -1
- package/lib/{packages-B4K6xrdJ.mjs → packages-CduZDHYG.mjs} +5 -5
- package/lib/{packages-B4K6xrdJ.mjs.map → packages-CduZDHYG.mjs.map} +1 -1
- package/lib/planner-B-SWR4R8.mjs +2 -0
- package/lib/{planner-HMMHSMAp.mjs → planner-BuBkFbra.mjs} +3 -3
- package/lib/{planner-HMMHSMAp.mjs.map → planner-BuBkFbra.mjs.map} +1 -1
- package/lib/{plugin-system-CRaC04G5.mjs → plugin-system-CPf99Zkf.mjs} +2 -2
- package/lib/{plugin-system-CRaC04G5.mjs.map → plugin-system-CPf99Zkf.mjs.map} +1 -1
- package/lib/{render-cache-DCPIQbO1.mjs → render-cache-CPppt7Rd.mjs} +5 -5
- package/lib/{render-cache-DCPIQbO1.mjs.map → render-cache-CPppt7Rd.mjs.map} +1 -1
- package/lib/{render-order-BPF2wDMw.mjs → render-order-a0QAbB7Q.mjs} +2 -2
- package/lib/{render-order-BPF2wDMw.mjs.map → render-order-a0QAbB7Q.mjs.map} +1 -1
- package/lib/roomle-headless.d.ts +21 -6
- package/lib/roomle-headless.js +14 -14
- package/lib/{roomle-renderer-Ato6RMrd.mjs → roomle-renderer-UJINLYxS.mjs} +2 -2
- package/lib/roomle-renderer-UJINLYxS.mjs.map +1 -0
- package/lib/{roomle-sdk-5aB4wxLW.mjs → roomle-sdk-CcNdTp_n.mjs} +2109 -2117
- package/lib/roomle-sdk-CcNdTp_n.mjs.map +1 -0
- package/lib/roomle-sdk.d.ts +21 -6
- package/lib/roomle-sdk.js +7 -7
- package/lib/{roomle-webgpu-renderer-BfZKcXSz.mjs → roomle-webgpu-renderer-BSvxbopA.mjs} +900 -707
- package/lib/roomle-webgpu-renderer-BSvxbopA.mjs.map +1 -0
- package/lib/{scene-renderer-DXvavD4L.mjs → scene-renderer--DzrpIl_.mjs} +309 -309
- package/lib/{scene-renderer-DXvavD4L.mjs.map → scene-renderer--DzrpIl_.mjs.map} +1 -1
- package/lib/{script-loader-axxcKvph.mjs → script-loader-D6i0wQ_j.mjs} +2 -2
- package/lib/{script-loader-axxcKvph.mjs.map → script-loader-D6i0wQ_j.mjs.map} +1 -1
- package/lib/{shading-settings-BBhR7KcS.mjs → shading-settings-6v-7O_Sz.mjs} +49 -49
- package/lib/{shading-settings-BBhR7KcS.mjs.map → shading-settings-6v-7O_Sz.mjs.map} +1 -1
- package/lib/src-6KtBPZXp.mjs +2 -0
- package/lib/{src-HhklrVDg.mjs → src-Dg0wYIom.mjs} +150 -150
- package/lib/{src-HhklrVDg.mjs.map → src-Dg0wYIom.mjs.map} +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
- package/lib/{stats-helper-BSmoG68E.mjs → stats-helper-DYjPPDnz.mjs} +2 -2
- package/lib/{stats-helper-BSmoG68E.mjs.map → stats-helper-DYjPPDnz.mjs.map} +1 -1
- package/lib/{three.core-0KaTx8dm.mjs → three.core-BTUCraWz.mjs} +976 -884
- package/lib/three.core-BTUCraWz.mjs.map +1 -0
- package/lib/{three.module-dym6j3lO.mjs → three.module-DUSFrLM6.mjs} +1789 -1739
- package/lib/three.module-DUSFrLM6.mjs.map +1 -0
- package/lib/three.tsl-De6A-G56.mjs +158 -0
- package/lib/three.tsl-De6A-G56.mjs.map +1 -0
- package/lib/three.tsl-DtfvggFX.mjs +2 -0
- package/lib/three.webgpu-B1OhMci_.mjs +3 -0
- package/lib/{three.webgpu-D3nSEIjD.mjs → three.webgpu-wPiwbpFM.mjs} +5806 -4926
- package/lib/three.webgpu-wPiwbpFM.mjs.map +1 -0
- package/lib/{threejs-utils-CLdyrCet.mjs → threejs-utils-lVSsgAiQ.mjs} +193 -202
- package/lib/threejs-utils-lVSsgAiQ.mjs.map +1 -0
- package/lib/{tools-core-DusxT3AY.mjs → tools-core-CRGER_KC.mjs} +3 -3
- package/lib/{tools-core-DusxT3AY.mjs.map → tools-core-CRGER_KC.mjs.map} +1 -1
- package/lib/{webgpu-BHAP6BLI.mjs → webgpu-BxYJfBjz.mjs} +555 -555
- package/lib/{webgpu-BHAP6BLI.mjs.map → webgpu-BxYJfBjz.mjs.map} +1 -1
- package/package.json +5 -5
- package/lib/BufferGeometry-Bl5whHAB.mjs.map +0 -1
- package/lib/GLTFExporter-yQ7mMauu.mjs.map +0 -1
- package/lib/GaussianBlurNode-DNBEf5-n.mjs +0 -59
- package/lib/GaussianBlurNode-DNBEf5-n.mjs.map +0 -1
- package/lib/Object3D-BHdngbxB.mjs.map +0 -1
- package/lib/PointLightHelper-CuPSBuDU.mjs.map +0 -1
- package/lib/SpotLightHelper-m-Rh8vGU.mjs.map +0 -1
- package/lib/USDZExporter-MdkuT226.mjs.map +0 -1
- package/lib/Vector4-C7TlIAyy.mjs.map +0 -1
- package/lib/common-utils-DbL4tku0.mjs.map +0 -1
- package/lib/configurator-ymHt9qjg.mjs +0 -2
- package/lib/dimensioning-helper-CGPjS2hW.mjs.map +0 -1
- package/lib/dimensioning-helper-VndKlIXS.mjs +0 -2
- package/lib/glb-viewer-D5QHd6Da.mjs +0 -2
- package/lib/planner-BM825oIz.mjs +0 -2
- package/lib/roomle-renderer-Ato6RMrd.mjs.map +0 -1
- package/lib/roomle-sdk-5aB4wxLW.mjs.map +0 -1
- package/lib/roomle-webgpu-renderer-BfZKcXSz.mjs.map +0 -1
- package/lib/src-Bbq3Hqzn.mjs +0 -2
- package/lib/three.core-0KaTx8dm.mjs.map +0 -1
- package/lib/three.module-dym6j3lO.mjs.map +0 -1
- package/lib/three.tsl-BTc4fg8T.mjs +0 -2
- package/lib/three.tsl-Cf0-sCqB.mjs +0 -152
- package/lib/three.tsl-Cf0-sCqB.mjs.map +0 -1
- package/lib/three.webgpu-ClICiWlK.mjs +0 -3
- package/lib/three.webgpu-D3nSEIjD.mjs.map +0 -1
- package/lib/threejs-utils-CLdyrCet.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel-BWfRHWkW.mjs","names":[],"sources":["../../packages/typings/kernel.ts"],"sourcesContent":["import type {\n PARAMETER_KERNEL_TYPE,\n PARAMETER_UNIT_TYPES,\n} from '../common-core/src/utils/parameter-types';\nimport type {\n AdditionalInfo,\n ConfigurationHash,\n ConfigurationString,\n PriceId,\n RapiConfiguration,\n RapiElement,\n RapiId,\n RapiItem,\n RapiJson,\n RapiTag,\n} from './rapi-types';\nimport type { KernelObject } from './planner';\nimport type { Enumify } from '#/common/src/utils/types';\nimport type {\n EmsArray,\n BindingError,\n InternalError,\n UnboundTypeError,\n} from './ems';\n\nexport interface WasmDbEntry {\n key: string;\n wasmVersion: string;\n wasmModule: any;\n}\n\n/* eslint-disable */\ndeclare namespace Module {\n function setStatus(str: string): void;\n\n let memoryInitializerPrefixURL: string;\n let Kernel: ConfiguratorKernelClass;\n}\n\n/* eslint:enable */\n\nexport interface KernelVector3 {\n x: number;\n y: number;\n z: number;\n}\n\nexport interface KernelMatrix4 {\n m: number[];\n}\n\nexport interface KernelValue {\n value: string;\n label: string;\n thumbnail: string | null;\n}\n\nexport interface KernelActionValue extends KernelValue {\n value: string;\n label: string;\n type: string;\n}\n\nexport interface KernelRange {\n valueFrom: number;\n valueTo: number;\n step: number;\n type: string;\n}\n\nexport interface UiKernelRange {\n valueFrom: string | null;\n valueTo: string | null;\n type: string;\n}\n\nexport interface KernelCatalogItem extends KernelObject {\n configuration: string;\n flipable: boolean;\n layer: number;\n orderable: boolean;\n scaleable: boolean;\n size: KernelVector3;\n type: string;\n detailType: string;\n}\n\nexport interface ConfigurationObject extends Object {\n componentId: RapiId;\n configuration: ConfigurationString;\n\n [key: string]: any;\n}\n\nexport interface KernelPossibleChild {\n componentId?: RapiId;\n itemId?: RapiId;\n isDefault?: boolean;\n possible: boolean;\n group: string | null;\n}\n\nexport interface KernelPartList {\n originPart: KernelComponent;\n fullList: KernelPart[];\n perMainComponent: Array<KernelPartList>;\n}\n\nexport interface KernelPart {\n articleNr: string;\n componentId: string;\n isModule: boolean;\n count: number;\n currencySymbol: string | null;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n label: string;\n parameters: KernelPartListParameter[];\n price: number | null;\n retailerPrice: number;\n\n [key: string]: any;\n}\n\nexport interface KernelPartListParameter {\n label: string;\n type: string;\n unitType: string;\n value: string;\n valueLabel: string | null;\n valueThumbnail: string;\n sort: number;\n}\n\nexport interface KernelPartListPrice {\n totalSum: number;\n partMap: Map<PriceId, KernelPart>;\n}\n\nexport const PARAMETER_VIEW_TYPE = {\n EMPTY: 0,\n TOGGLE: 1,\n IMAGELIST: 2,\n IMAGEBIG: 3,\n IMAGESMALL: 4,\n INPUTFIELD: 5,\n DROPDOWN: 6,\n SLIDER: 7,\n BUTTON: 8,\n} as const;\n\nexport interface KernelViewType {\n value: Enumify<typeof PARAMETER_VIEW_TYPE>;\n}\n\nexport interface KernelParameter {\n enabled: boolean;\n key: string;\n label: string;\n type: PARAMETER_KERNEL_TYPE;\n value: string;\n sort: number;\n unitType: PARAMETER_UNIT_TYPES;\n validGroups: [RapiId];\n validRange: KernelRange | null;\n validValues: KernelValue[];\n group: string;\n visibleInPlanner?: boolean;\n viewType: KernelViewType;\n source: 'external' | 'internal';\n level?: number;\n objectIds?: number[];\n}\n\nexport interface KernelParameterGroup {\n key: string;\n label: string;\n sort: number;\n collapsed: boolean;\n}\n\nexport interface KernelEnum {\n value: number;\n}\n\nexport interface UiKernelParameter extends KernelParameter {\n uiType: string | null;\n validRangeLabels?: UiKernelRange;\n groups: Promise<RapiJson[]>;\n valueLabel: string | null;\n grouping: KernelParameterGroup;\n tooltip?: {\n [key: string]: string;\n };\n additionalInfos?: AdditionalInfo[];\n}\n\nexport interface PossibleChildPreviewElement {\n id: string;\n configuration?: ConfigurationString;\n articleId?: string;\n isItem: boolean;\n isComponent: boolean;\n}\n\nexport interface UiPossibleChild\n extends RapiElement,\n PossibleChildPreviewElement {\n group: string;\n possible: boolean;\n subTags: UiPossibleChild[];\n}\n\nexport interface UiPossibleChildTag extends RapiTag {\n possibleChildren: UiPossibleChild[];\n}\n\nexport interface DockPair {\n parentId: number;\n parentDockId: number;\n childId: number;\n childDockId: number;\n position: KernelVector3;\n rotation: KernelVector3;\n insertInBetween: boolean;\n displacedComponents: number[];\n displacementRotation: KernelVector3;\n displacementVector: KernelVector3;\n\n [key: string]: any;\n}\n\nexport interface DockingLineSegment {\n from: number;\n to: number;\n}\n\nexport interface DockLine {\n parentId: number;\n parentDockId: number;\n childId: number;\n childDockId: number;\n position: KernelVector3;\n rotation: KernelVector3;\n lineFrom: KernelVector3;\n lineTo: KernelVector3;\n lineSegments: DockingLineSegment[];\n positionFrom: KernelVector3;\n positionTo: KernelVector3;\n insertInBetween: boolean;\n displacedComponents: number[];\n displacementRotation: KernelVector3;\n displacementVector: KernelVector3;\n\n [key: string]: any;\n}\n\nexport interface KernelCube {\n origin: KernelVector3;\n size: KernelVector3;\n}\n\nexport interface KernelExtrudedRectangle {\n angle: number;\n bottomCenter: KernelVector3;\n eulerRotation: KernelVector3;\n size: KernelVector3;\n readonly cornerPoints: EmsArray<KernelVector3>;\n}\n\nexport interface KernelObjectBounds {\n boundingBox: KernelCube;\n rectangleBox: KernelExtrudedRectangle;\n}\n\nexport interface KernelAssembledObjectBounds {\n boundingBox: KernelCube;\n parts: KernelObjectBounds[];\n}\n\nexport interface KernelComponentBounds {\n boxForMeasurement: KernelCube;\n geometryBounds: KernelAssembledObjectBounds;\n}\n\nexport interface KernelAnimation {\n actions: KernelAnimationAction[];\n enabled: boolean;\n key: string;\n label: string;\n group: string;\n sort: number;\n visibleInPlanner: boolean;\n level?: number;\n applyToChildren?: boolean;\n animate?: boolean;\n}\n\nexport interface KernelAnimationAction {\n key: string;\n label: string;\n type: string;\n}\n\nexport interface PlanObjectKernel {\n geometryBounds: KernelCube;\n boxForMeasurement: KernelCube;\n geometryBoundsWithEnvironment: KernelCube;\n id: number;\n rootPlanComponentId: number;\n externalId: string;\n externalObject: boolean;\n dimensioningAxes?: DimensioningAxis[];\n dimensionings?: Dimensioning[];\n animations?: KernelAnimation[];\n [key: string]: any;\n}\n\nexport const CONFIGURATION_TYPE = {\n STATIC: 0,\n INTERNAL: 1,\n EXTERNAL: 2,\n} as const;\n\nexport interface ObjectConfigurationType {\n value: Enumify<typeof CONFIGURATION_TYPE>;\n}\n\nexport interface KernelPlanObjectBase {\n dimensions: KernelVector3;\n center: KernelVector3;\n rootComponentCenter: KernelVector3;\n rotation: number;\n rgbValue: number;\n useCustomColor?: boolean;\n customLabel: string;\n customThumbnail: string;\n catalogItemId: string;\n articleId: string;\n runtimeId: number;\n configurationType: ObjectConfigurationType;\n configurationHash: string;\n configuration: string;\n configurationRuntimeId: number;\n componentRuntimeId: number;\n childObjectLevel: number;\n isAGeneratedModule: boolean;\n}\n\nexport interface KernelPlanObject extends KernelPlanObjectBase {\n partsConfigurationRuntimeId: number;\n parts: KernelPartList;\n parameters: KernelParameter[];\n animations?: KernelAnimation[];\n}\n\nexport const CORE_PLAN_COMPONENT_TYPE = {\n ROOT_COMPONENT: 0,\n COMPONENT: 1,\n ROOT_MODULE: 2,\n SUB_MODULE: 3,\n SUB_ARTICLE: 4,\n} as const;\n\nexport const CORE_PERMISSION_TO_DELETE = {\n NEVER: 0,\n REDOCK_CHILDREN: 1,\n ALWAYS: 2,\n} as const;\n\nexport interface KernelPlanObjectComponent extends KernelPlanObjectBase {\n isExternalObject: boolean;\n type: KernelComponentType;\n componentId: string;\n parentObjectId: number;\n childObjectIds: EmsArray<number>;\n externalObjectGroupId: string;\n externalRootModuleId: string;\n externalSubModuleId: string;\n isAGeneratedModule: boolean;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n isDuplicable: boolean;\n isExchangeable: boolean;\n animations?: KernelAnimation[];\n}\n\nexport interface UiPlanObject extends KernelPlanObject {\n data: RapiItem | RapiConfiguration | null;\n}\n\nexport interface EmscriptenList {\n size: () => number;\n length: number;\n}\n\nexport type EmscriptenString = any;\n\nexport interface EmscriptenMap<K, V> {\n set: (key: K, value: V) => void;\n size: () => number;\n}\n\nexport interface KernelComponentType {\n value: Enumify<typeof CORE_PLAN_COMPONENT_TYPE>;\n}\n\nexport interface KernelPermissionToDelete {\n value: Enumify<typeof CORE_PERMISSION_TO_DELETE>;\n}\n\nexport interface AnimationTransformation {\n animationMatrix: KernelMatrix4;\n key: string;\n}\n\nexport interface ComponentAnimationTransformation {\n animations: AnimationTransformation[];\n componentRuntimeId: number;\n}\n\nexport interface KernelComponent {\n [key: string]: any;\n externalComponent: boolean;\n type: KernelComponentType;\n id: number;\n valid: boolean;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n objectId: number;\n rootId: number;\n rootSiblingIds: number[];\n roomModuleIds: number[];\n parentId: number;\n childIds: EmscriptenList;\n label: string;\n labelIsCalculated: boolean;\n componentId: string;\n hash: string;\n position: KernelVector3;\n rotation: KernelVector3;\n globalTransform: KernelMatrix4;\n boxForMeasurement: KernelCube;\n geometryBounds: KernelAssembledObjectBounds;\n parameters: KernelParameter[];\n parameterGroups: KernelParameterGroup[];\n possibleChildren: KernelPossibleChild[];\n addOnSpots: AddOnSpot[];\n dimensioningAxes: DimensioningAxis[];\n dimensionings: Dimensioning[];\n animations: KernelAnimation[];\n childAnimationTransformations: ComponentAnimationTransformation[];\n}\n\nexport interface Dimensioning {\n axis: string;\n from: number;\n to: number;\n label: string;\n level: number;\n visible: boolean;\n maxLevel: number;\n interactionKey?: string;\n}\n\nexport interface DimensioningAxis {\n direction: KernelVector3;\n key: string;\n labelDirection: KernelVector3;\n origin: KernelVector3;\n alternativeOrigin?: KernelVector3;\n}\n\nexport interface AddOnSpot {\n position: KernelVector3;\n mask: string;\n}\n\nexport const CORE_ASSET_TYPE = {\n ITEM: 0,\n COMPONENT: 1,\n EXTERNAL_MESH: 2,\n MATERIAL_PROPERTIES: 3,\n MATERIAL_GROUP: 4,\n EXTERNAL_OBJ_URL: 5,\n EXTERNAL_SVG_URL: 6,\n} as const;\n\nexport interface AssetType {\n value: Enumify<typeof CORE_ASSET_TYPE>;\n}\n\nexport interface AssetRequest {\n id: string;\n value: number;\n type: AssetType;\n}\n\nexport interface AssetResponse {\n data: any;\n id: string;\n type: AssetType;\n value?: number;\n}\n\nexport interface KernelComponentDocking {\n componentId: number;\n isRootComponent: boolean;\n parentId: number;\n position: KernelVector3;\n rotation: KernelVector3;\n type: KernelComponentType;\n}\n\nexport interface KernelContainer {\n wasmBinaryFile: string;\n print: (msg: string) => void;\n printErr: (msg: string) => void;\n quit: (msg: string) => void;\n thisProgram: string;\n reallocBuffer: (size: string) => void;\n InternalError: typeof InternalError;\n BindingError: typeof BindingError;\n UnboundTypeError: typeof UnboundTypeError;\n wasmTableSize: number;\n wasmMaxTableSize: number;\n run: (a: any) => void;\n abort: (msg: string) => void;\n noExitRuntime: boolean;\n usingWasm: boolean;\n calledRun: boolean;\n setExternalHelpers: (kernelIo: any, utils: any) => void;\n registerConfiguratorCallback: (callbacksObject: any) => void;\n unregisterConfiguratorCallback: (callbacksObject: any) => void;\n evaluateJsScript: (\n kernel: ConfiguratorKernelClass,\n objectOrComponentId: number,\n name: string,\n argumentObject: any,\n ) => any;\n}\n\nexport const CORE_DOCK_PAIR_TYPE = {\n POINT: 0,\n LINE: 1,\n} as const;\n\nexport interface DockPairType {\n value: Enumify<typeof CORE_DOCK_PAIR_TYPE>;\n}\n\nexport interface KernelDockPairPreview {\n parentId: number;\n parentDockId: number;\n childId: number;\n childDockId: number;\n type: DockPairType;\n position: KernelVector3f;\n rotation: KernelVector3f;\n insertInBetween: boolean;\n displacedChildId: number;\n displacedChildTransform: KernelMatrix4;\n displacedComponents: number[];\n displacementRotation: KernelVector3f;\n displacementVector: KernelVector3f;\n positionFrom?: KernelVector3f;\n positionTo?: KernelVector3f;\n lineFrom?: KernelVector3f;\n lineTo?: KernelVector3f;\n lineSegments: DockingLineSegment[];\n areaWidth?: number;\n}\n\nexport interface KernelVector2f {\n x: number;\n y: number;\n\n vectorInRoomleSpace(): KernelVector2f;\n\n vectorInKernelSpace(): KernelVector2f;\n\n convertToRoomleSpace(): void;\n\n convertToKernelSpace(): void;\n}\n\nexport interface KernelVector3f {\n x: number;\n y: number;\n z: number;\n}\n\nexport interface KernelDockingLineSegment {\n from: number;\n to: number;\n}\n\nexport interface KernelVariable {\n key: string;\n type: string;\n value: string;\n}\n\nexport interface KernelParameterValue {\n value: string;\n label: string;\n thumbnail: string;\n}\n\nexport interface KernelConfiguration {\n componentId: string;\n parameters: Map<string, string>;\n dockParent: string;\n dockPosition: string;\n children: KernelConfiguration[];\n}\n\nexport interface KernelAddOnSpot {\n mask: string;\n position: KernelVector3f;\n}\n\nexport interface KernelParamKeyValuePair {\n parameterKey: string;\n parameterValue: string;\n}\n\nexport interface ConfigurationUniqueIdAndHash {\n hash: ConfigurationHash;\n uniqueId: ConfigurationString;\n libraryId: string;\n}\n\nexport interface ExternalModuleInformation {\n groupId: string;\n rootModuleId: string;\n subModuleId: string;\n}\n\nexport interface KernelObjectInformation {\n componentId: string;\n configurationRuntimeId: number;\n externalModule: ExternalModuleInformation;\n name: string;\n runtimeId: number;\n source: string;\n type: KernelComponentType;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n}\n\nexport interface ExternalAttributeInformation {\n groupId: string;\n moduleIds: ExternalModuleInformation[];\n attributeId: string;\n value: string;\n}\n\nexport const enum ExportType {\n TC = 0,\n IMOSiX = 1,\n HOMAGiX = 2,\n}\n\nexport interface HomagIxArticleData {\n name: string;\n count: number;\n position: { x: number; y: number; z: number };\n rotation: { x: number; y: number; z: number };\n attributes: string;\n}\n\nexport interface ConfigurationExporter {\n new (): ConfigurationExporter;\n\n init(): void;\n\n setDefaultExportDataDefinition(\n serializedDefaultExportDefinition: string,\n ): void;\n\n generateExport(\n exportType: number,\n planObjectId: number,\n kernel: ConfiguratorKernelClass,\n ): string;\n}\n\nexport interface ConfiguratorKernelClass {\n setUpdateCallbacksOnlyIfGeometryIsReady(onlyUpdateIfReady: boolean): void;\n\n useHDGeometry(requestUseHDGeometry: boolean): void;\n\n useEnvironmentGeometry(requestEnvironmentGeometry: boolean): void;\n\n setEnvironmentVariable(key: string, value: any): void;\n\n setLevel(restrictionLevel: number): void;\n\n setDockInsertPreviewBoxParameters(\n thickness: number,\n protruding: number,\n intruding: number,\n bevelSize: number,\n ): void;\n\n clearScene(): void;\n\n clearAll(): void;\n\n loadConfiguration(\n kernelConversationId: number,\n configurationObject: ConfigurationString,\n position: KernelVector3,\n ): void;\n\n updateConfiguration(\n kernelConversationId: number,\n objectOrComponentId: number,\n serializedConfiguration: string,\n ): void;\n\n loadPlainComponent(\n conversationId: number,\n componentId: RapiId,\n configuration: ConfigurationString,\n ): void;\n\n loadFreeFlyingConfiguration(\n conversationId: number,\n configuration: ConfigurationString,\n ): void;\n\n requestComponentDockPreview(\n targetObjectId: number,\n componentId: string,\n serializedComponent: string,\n dragIn: boolean,\n allowInsertInBetween: boolean,\n ): void;\n\n requestItemDockPreview(\n targetObjectId: number,\n serializedConfiguration: string,\n dragIn: boolean,\n allowInsertInBetween: boolean,\n ): void;\n\n requestExternalObjectDockPreview(\n targetObjectId: number,\n articleId: string,\n dragIn: boolean,\n allowInsertInBetween: boolean,\n ): void;\n\n assetsLoaded(assets: AssetResponse | AssetResponse[]): void;\n\n deleteComponent(componentId: number, redockChildrenToParent: boolean): void;\n\n deleteMultipleComponents(componentIds: any): void;\n\n resetPriceListIds(): void;\n\n addPriceList(newLocale: string): void;\n\n requestPlanObjectConstruction(planObjectId: number): void;\n\n requestPlanComponentConstruction(componentId: number): void;\n\n requestDeltaPlanComponentConstruction(componentId: number): void;\n\n requestPlanComponentConstructionRecursive(componentId: number): void;\n\n requestPreviewGeometry(\n dockingObjectOrComponentId: number,\n targetObjectRuntimeId: number,\n allowInsertInBetween: boolean,\n ): void;\n\n cancelDocking(componentId: number, undoDrag: boolean): void;\n\n getComponentParameters(componentId: number): KernelParameter[];\n\n getPlanComponentAnimations(planComponentId: number): KernelAnimation[];\n\n setComponentParameter(\n componentId: number,\n parameterKey: string,\n value: string,\n ): void;\n\n setPlanComponentsParameter(\n componentIds: any,\n parameterKey: string,\n value: string,\n ): void;\n\n getPlanObjectParameters(planObjectId: number): KernelParameter[];\n\n getCommonPlanObjectParameters(\n planObjectIds: EmsArray<number>,\n ): KernelParameter[];\n\n getPlanObjectAnimations(planObjectId: number): KernelAnimation[];\n\n setPlanObjectParameter(\n planObjectId: number,\n parameterKey: string,\n value: string,\n ): void;\n\n setPlanObjectsParameter(\n planObjectIds: any,\n parameterKey: string,\n value: string,\n ): void;\n\n dockComponent(\n childId: number,\n childDockId: number,\n parentId: number,\n parentDockId: number,\n position?: KernelVector3,\n ): void;\n\n getComponent(componentId: number): KernelComponent;\n\n getComponentBounds(\n componentId: number,\n animationValues: string[],\n ): KernelComponentBounds;\n\n getComponentId(componentId: number): RapiId;\n\n isExternalPlanObject(objectOrPlanComponentId: number): boolean;\n\n getComponentOrModuleInformation(\n objectOrPlanComponentId: number,\n ): KernelObjectInformation;\n\n getExternalObjectAttribute(\n objectOrPlanComponentId: number,\n attributeKey: string,\n value: string,\n ): ExternalAttributeInformation;\n\n getPlanObject(planObjectId: number): PlanObjectKernel;\n\n getPlanObjectFromPlanComponent(componentId: number): PlanObjectKernel;\n\n getPlanComponentPossibleChildren(componentId: number): KernelPossibleChild[];\n\n getChildrenOfPlanComponent(\n componentId: number,\n onlyPossible: boolean,\n onlyVisible: boolean,\n ): KernelPossibleChild[];\n\n getChildrenOfPlanObject(\n planObjectId: number,\n onlyPossible: boolean,\n onlyVisible: boolean,\n ): KernelPossibleChild[];\n\n getPlanObjectPossibleChildren(componentId: number): KernelPossibleChild[];\n\n getPlanObjectChildren(\n planObjectId: number,\n onlyPossible: boolean,\n onlyVisible: boolean,\n ): KernelPossibleChild[];\n\n getRootPlanComponentIdFromObjectId(planObjectId: number): number;\n\n getFullPartList(): KernelPartList;\n\n getSerializedConfiguration(\n planObjectOrComponentId: number,\n ): ConfigurationString;\n\n createNewSerializedConfiguration(\n configurationRuntimeId: number,\n ): ConfigurationString;\n\n retrieveConfigurationId(\n aPlanObjectOrComponentId: number,\n ): ConfigurationUniqueIdAndHash;\n\n getHashOfSerializedConfiguration(\n serializedConfiguration: string,\n ): ConfigurationHash;\n\n getPartList(getPartList: number): KernelPartList;\n\n getCommonPlanComponentParameters(componentIds: any): {\n parameters: KernelParameter[];\n parameterGroups: KernelParameterGroup[];\n animations: KernelAnimation[];\n };\n\n loadComponentDefinition(component: string): void;\n\n syncPlanObjectToView(conversationId: number, planObjectId: number): void;\n\n setAssetInvalid(assetType: AssetType, idOrUrl: string, quality: number): void;\n\n setActiveGroupInView(groupId: string): void;\n\n setActiveGroupInViewForPlanObject(groupId: string, runtimeId: number): void;\n\n setUpdateCallbacksOnlyIfGeometryIsReady(\n updateCallbacksOnlyIfGeometryIsReady: boolean,\n ): void;\n\n loadExternalAttributeDefinition(serializedDefinition: string): void;\n\n setExternalObjectConstructionProperties(serializedProperties: string): void;\n\n registerDebugClient(debugClient: DebugClient): void;\n\n getGlobalParameterValue(objectOrComponentId: number, name: string): string;\n\n getRuntimeIdOfRootComponent(objectOrComponentId: number): number;\n\n getRuntimeIdsOfChildComponents(objectOrComponentId: number): number[];\n\n getComponentParameterValue(objectOrComponentId: number, name: string): string;\n}\n\nexport interface KernelObjectPtrList {\n size(): void;\n\n push_back(object: KernelObject): void;\n}\n\nexport interface ObjectGroupPtr {}\n\nexport interface ParamterKeyValue {\n parameterKey: string;\n parameterValue: string;\n}\n\nexport interface VariantsList {\n componentId: string;\n parameterValues: ParamterKeyValue[];\n parts: KernelPart[];\n}\n\nexport interface KernelConfigurationLoadedData {\n conversationId: number;\n objectId: number;\n componentId: number;\n hash: string;\n errors: string[];\n}\n\nexport type RuntimeId = number;\n\nexport interface KernelMeshBuffer {\n indices: Int32Array;\n vertices: Float32Array;\n normals: Float32Array;\n uvCoords: Float32Array;\n}\n\nexport interface KernelMeshAnimation {\n matrix: Float32Array;\n visibility: boolean;\n initial: boolean;\n}\n\nexport interface KernelMeshAttributes {\n materialId: string;\n materialAttributes: Record<string, string> | null;\n transform: Float32Array;\n uvTransform: Float32Array | null;\n animations: Record<string, KernelMeshAnimation> | null;\n}\n\nexport const LIGHT_SOURCE_TYPE = {\n SPOT: 0,\n POINT: 1,\n AREA: 2,\n} as const;\n\nexport interface KernelLightSourceType {\n value: Enumify<typeof LIGHT_SOURCE_TYPE>;\n}\n\nexport interface KernelLightSourceAttributes {\n type: KernelLightSourceType;\n position: KernelVector3f;\n direction?: KernelVector3f;\n angle?: number;\n color?: string;\n intensity?: number;\n distance?: number;\n penumbra?: number;\n decay?: number;\n width?: number;\n height?: number;\n}\n\nexport interface DebugValueMapDump {\n type: string;\n componentId: string;\n internalId: string;\n id: number;\n parentId: number;\n values: Record<string, string>;\n}\n\nexport interface DebugValueMapChange {\n sourceId: number;\n sourceInfo: string;\n valueMaps: Record<string, DebugValueMapDump>;\n}\n\nexport interface DebugClient {\n debugValueMapChange(changes: DebugValueMapChange): void;\n}\n"],"mappings":";AA2IA,IAAa,IAAsB;CACjC,OAAO;CACP,QAAQ;CACR,WAAW;CACX,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,QAAQ;CACR,QAAQ;CACT,EAyKY,IAAqB;CAChC,QAAQ;CACR,UAAU;CACV,UAAU;CACX,EAkCY,IAA2B;CACtC,gBAAgB;CAChB,WAAW;CACX,aAAa;CACb,YAAY;CACZ,aAAa;CACd,EAEY,IAA4B;CACvC,OAAO;CACP,iBAAiB;CACjB,QAAQ;CACT,EA8GY,IAAkB;CAC7B,MAAM;CACN,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,gBAAgB;CAChB,kBAAkB;CAClB,kBAAkB;CACnB,EAwDY,IAAsB;CACjC,OAAO;CACP,MAAM;CACP,EAiHiB,IAAX,yBAAA,GAAA;QACL,EAAA,EAAA,KAAA,KAAA,MACA,EAAA,EAAA,SAAA,KAAA,UACA,EAAA,EAAA,UAAA,KAAA;KACD,EA6TY,IAAoB;CAC/B,MAAM;CACN,OAAO;CACP,MAAM;CACP"}
|
|
1
|
+
{"version":3,"file":"kernel-BWfRHWkW.mjs","names":[],"sources":["../../packages/typings/kernel.ts"],"sourcesContent":["import type {\n PARAMETER_KERNEL_TYPE,\n PARAMETER_UNIT_TYPES,\n} from '../common-core/src/utils/parameter-types';\nimport type {\n AdditionalInfo,\n ConfigurationHash,\n ConfigurationString,\n PriceId,\n RapiConfiguration,\n RapiElement,\n RapiId,\n RapiItem,\n RapiJson,\n RapiTag,\n} from './rapi-types';\nimport type { KernelObject, PlanViewType } from './planner';\nimport type { Enumify } from '#/common/src/utils/types';\nimport type {\n EmsArray,\n BindingError,\n InternalError,\n UnboundTypeError,\n} from './ems';\n\nexport interface WasmDbEntry {\n key: string;\n wasmVersion: string;\n wasmModule: any;\n}\n\n/* eslint-disable */\ndeclare namespace Module {\n function setStatus(str: string): void;\n\n let memoryInitializerPrefixURL: string;\n let Kernel: ConfiguratorKernelClass;\n}\n\n/* eslint:enable */\n\nexport interface KernelVector3 {\n x: number;\n y: number;\n z: number;\n}\n\nexport interface KernelMatrix4 {\n m: number[];\n}\n\nexport interface KernelValue {\n value: string;\n label: string;\n thumbnail: string | null;\n}\n\nexport interface KernelActionValue extends KernelValue {\n value: string;\n label: string;\n type: string;\n}\n\nexport interface KernelRange {\n valueFrom: number;\n valueTo: number;\n step: number;\n type: string;\n}\n\nexport interface UiKernelRange {\n valueFrom: string | null;\n valueTo: string | null;\n type: string;\n}\n\nexport interface KernelCatalogItem extends KernelObject {\n configuration: string;\n flipable: boolean;\n layer: number;\n orderable: boolean;\n scaleable: boolean;\n size: KernelVector3;\n type: string;\n detailType: string;\n}\n\nexport interface ConfigurationObject extends Object {\n componentId: RapiId;\n configuration: ConfigurationString;\n\n [key: string]: any;\n}\n\nexport interface KernelPossibleChild {\n componentId?: RapiId;\n itemId?: RapiId;\n isDefault?: boolean;\n possible: boolean;\n group: string | null;\n}\n\nexport interface KernelPartList {\n originPart: KernelComponent;\n fullList: KernelPart[];\n perMainComponent: Array<KernelPartList>;\n}\n\nexport interface KernelPart {\n articleNr: string;\n componentId: string;\n isModule: boolean;\n count: number;\n currencySymbol: string | null;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n label: string;\n parameters: KernelPartListParameter[];\n price: number | null;\n retailerPrice: number;\n\n [key: string]: any;\n}\n\nexport interface KernelPartListParameter {\n label: string;\n type: string;\n unitType: string;\n value: string;\n valueLabel: string | null;\n valueThumbnail: string;\n sort: number;\n}\n\nexport interface KernelPartListPrice {\n totalSum: number;\n partMap: Map<PriceId, KernelPart>;\n}\n\nexport const PARAMETER_VIEW_TYPE = {\n EMPTY: 0,\n TOGGLE: 1,\n IMAGELIST: 2,\n IMAGEBIG: 3,\n IMAGESMALL: 4,\n INPUTFIELD: 5,\n DROPDOWN: 6,\n SLIDER: 7,\n BUTTON: 8,\n} as const;\n\nexport interface KernelViewType {\n value: Enumify<typeof PARAMETER_VIEW_TYPE>;\n}\n\nexport interface KernelParameter {\n enabled: boolean;\n key: string;\n label: string;\n type: PARAMETER_KERNEL_TYPE;\n value: string;\n sort: number;\n unitType: PARAMETER_UNIT_TYPES;\n validGroups: [RapiId];\n validRange: KernelRange | null;\n validValues: KernelValue[];\n group: string;\n visibleInPlanner?: boolean;\n viewType: KernelViewType;\n source: 'external' | 'internal';\n level?: number;\n objectIds?: number[];\n}\n\nexport interface KernelParameterGroup {\n key: string;\n label: string;\n sort: number;\n collapsed: boolean;\n}\n\nexport interface KernelEnum {\n value: number;\n}\n\nexport interface UiKernelParameter extends KernelParameter {\n uiType: string | null;\n validRangeLabels?: UiKernelRange;\n groups: Promise<RapiJson[]>;\n valueLabel: string | null;\n grouping: KernelParameterGroup;\n tooltip?: {\n [key: string]: string;\n };\n additionalInfos?: AdditionalInfo[];\n}\n\nexport interface PossibleChildPreviewElement {\n id: string;\n configuration?: ConfigurationString;\n articleId?: string;\n isItem: boolean;\n isComponent: boolean;\n}\n\nexport interface UiPossibleChild\n extends RapiElement,\n PossibleChildPreviewElement {\n group: string;\n possible: boolean;\n subTags: UiPossibleChild[];\n}\n\nexport interface UiPossibleChildTag extends RapiTag {\n possibleChildren: UiPossibleChild[];\n}\n\nexport interface DockPair {\n parentId: number;\n parentDockId: number;\n childId: number;\n childDockId: number;\n position: KernelVector3;\n rotation: KernelVector3;\n insertInBetween: boolean;\n displacedComponents: number[];\n displacementRotation: KernelVector3;\n displacementVector: KernelVector3;\n\n [key: string]: any;\n}\n\nexport interface DockingLineSegment {\n from: number;\n to: number;\n}\n\nexport interface DockLine {\n parentId: number;\n parentDockId: number;\n childId: number;\n childDockId: number;\n position: KernelVector3;\n rotation: KernelVector3;\n lineFrom: KernelVector3;\n lineTo: KernelVector3;\n lineSegments: DockingLineSegment[];\n positionFrom: KernelVector3;\n positionTo: KernelVector3;\n insertInBetween: boolean;\n displacedComponents: number[];\n displacementRotation: KernelVector3;\n displacementVector: KernelVector3;\n\n [key: string]: any;\n}\n\nexport interface KernelCube {\n origin: KernelVector3;\n size: KernelVector3;\n}\n\nexport interface KernelExtrudedRectangle {\n angle: number;\n bottomCenter: KernelVector3;\n eulerRotation: KernelVector3;\n size: KernelVector3;\n readonly cornerPoints: EmsArray<KernelVector3>;\n}\n\nexport interface KernelObjectBounds {\n boundingBox: KernelCube;\n rectangleBox: KernelExtrudedRectangle;\n}\n\nexport interface KernelAssembledObjectBounds {\n boundingBox: KernelCube;\n parts: KernelObjectBounds[];\n}\n\nexport interface KernelComponentBounds {\n boxForMeasurement: KernelCube;\n geometryBounds: KernelAssembledObjectBounds;\n}\n\nexport interface KernelAnimation {\n actions: KernelAnimationAction[];\n enabled: boolean;\n key: string;\n label: string;\n group: string;\n sort: number;\n visibleInPlanner: boolean;\n level?: number;\n applyToChildren?: boolean;\n animate?: boolean;\n}\n\n// the kernel hands an empty label over as null\nexport interface KernelConfigurationPlanView {\n viewType: PlanViewType;\n lineOfSight: KernelVector3f;\n enabled: boolean;\n label: string | null;\n}\n\nexport interface KernelAnimationAction {\n key: string;\n label: string;\n type: string;\n}\n\nexport interface PlanObjectKernel {\n geometryBounds: KernelCube;\n boxForMeasurement: KernelCube;\n geometryBoundsWithEnvironment: KernelCube;\n id: number;\n rootPlanComponentId: number;\n externalId: string;\n externalObject: boolean;\n dimensioningAxes?: DimensioningAxis[];\n dimensionings?: Dimensioning[];\n animations?: KernelAnimation[];\n [key: string]: any;\n}\n\nexport const CONFIGURATION_TYPE = {\n STATIC: 0,\n INTERNAL: 1,\n EXTERNAL: 2,\n} as const;\n\nexport interface ObjectConfigurationType {\n value: Enumify<typeof CONFIGURATION_TYPE>;\n}\n\nexport interface KernelPlanObjectBase {\n dimensions: KernelVector3;\n center: KernelVector3;\n rootComponentCenter: KernelVector3;\n rotation: number;\n rgbValue: number;\n useCustomColor?: boolean;\n customLabel: string;\n customThumbnail: string;\n catalogItemId: string;\n articleId: string;\n runtimeId: number;\n configurationType: ObjectConfigurationType;\n configurationHash: string;\n configuration: string;\n configurationRuntimeId: number;\n componentRuntimeId: number;\n childObjectLevel: number;\n isAGeneratedModule: boolean;\n}\n\nexport interface KernelPlanObject extends KernelPlanObjectBase {\n partsConfigurationRuntimeId: number;\n parts: KernelPartList;\n parameters: KernelParameter[];\n animations?: KernelAnimation[];\n}\n\nexport const CORE_PLAN_COMPONENT_TYPE = {\n ROOT_COMPONENT: 0,\n COMPONENT: 1,\n ROOT_MODULE: 2,\n SUB_MODULE: 3,\n SUB_ARTICLE: 4,\n} as const;\n\nexport const CORE_PERMISSION_TO_DELETE = {\n NEVER: 0,\n REDOCK_CHILDREN: 1,\n ALWAYS: 2,\n} as const;\n\nexport interface KernelPlanObjectComponent extends KernelPlanObjectBase {\n isExternalObject: boolean;\n type: KernelComponentType;\n componentId: string;\n parentObjectId: number;\n childObjectIds: EmsArray<number>;\n externalObjectGroupId: string;\n externalRootModuleId: string;\n externalSubModuleId: string;\n isAGeneratedModule: boolean;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n isDuplicable: boolean;\n isExchangeable: boolean;\n animations?: KernelAnimation[];\n}\n\nexport interface UiPlanObject extends KernelPlanObject {\n data: RapiItem | RapiConfiguration | null;\n}\n\nexport interface EmscriptenList {\n size: () => number;\n length: number;\n}\n\nexport type EmscriptenString = any;\n\nexport interface EmscriptenMap<K, V> {\n set: (key: K, value: V) => void;\n size: () => number;\n}\n\nexport interface KernelComponentType {\n value: Enumify<typeof CORE_PLAN_COMPONENT_TYPE>;\n}\n\nexport interface KernelPermissionToDelete {\n value: Enumify<typeof CORE_PERMISSION_TO_DELETE>;\n}\n\nexport interface AnimationTransformation {\n animationMatrix: KernelMatrix4;\n key: string;\n}\n\nexport interface ComponentAnimationTransformation {\n animations: AnimationTransformation[];\n componentRuntimeId: number;\n}\n\nexport interface KernelComponent {\n [key: string]: any;\n externalComponent: boolean;\n type: KernelComponentType;\n id: number;\n valid: boolean;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n objectId: number;\n rootId: number;\n rootSiblingIds: number[];\n roomModuleIds: number[];\n parentId: number;\n childIds: EmscriptenList;\n label: string;\n labelIsCalculated: boolean;\n componentId: string;\n hash: string;\n position: KernelVector3;\n rotation: KernelVector3;\n globalTransform: KernelMatrix4;\n boxForMeasurement: KernelCube;\n geometryBounds: KernelAssembledObjectBounds;\n parameters: KernelParameter[];\n parameterGroups: KernelParameterGroup[];\n possibleChildren: KernelPossibleChild[];\n addOnSpots: AddOnSpot[];\n dimensioningAxes: DimensioningAxis[];\n dimensionings: Dimensioning[];\n animations: KernelAnimation[];\n childAnimationTransformations: ComponentAnimationTransformation[];\n}\n\nexport interface Dimensioning {\n axis: string;\n from: number;\n to: number;\n label: string;\n level: number;\n visible: boolean;\n maxLevel: number;\n interactionKey?: string;\n}\n\nexport interface DimensioningAxis {\n direction: KernelVector3;\n key: string;\n labelDirection: KernelVector3;\n origin: KernelVector3;\n alternativeOrigin?: KernelVector3;\n}\n\nexport interface AddOnSpot {\n position: KernelVector3;\n mask: string;\n}\n\nexport const CORE_ASSET_TYPE = {\n ITEM: 0,\n COMPONENT: 1,\n EXTERNAL_MESH: 2,\n MATERIAL_PROPERTIES: 3,\n MATERIAL_GROUP: 4,\n EXTERNAL_OBJ_URL: 5,\n EXTERNAL_SVG_URL: 6,\n} as const;\n\nexport interface AssetType {\n value: Enumify<typeof CORE_ASSET_TYPE>;\n}\n\nexport interface AssetRequest {\n id: string;\n value: number;\n type: AssetType;\n}\n\nexport interface AssetResponse {\n data: any;\n id: string;\n type: AssetType;\n value?: number;\n}\n\nexport interface KernelComponentDocking {\n componentId: number;\n isRootComponent: boolean;\n parentId: number;\n position: KernelVector3;\n rotation: KernelVector3;\n type: KernelComponentType;\n}\n\nexport interface KernelContainer {\n wasmBinaryFile: string;\n print: (msg: string) => void;\n printErr: (msg: string) => void;\n quit: (msg: string) => void;\n thisProgram: string;\n reallocBuffer: (size: string) => void;\n InternalError: typeof InternalError;\n BindingError: typeof BindingError;\n UnboundTypeError: typeof UnboundTypeError;\n wasmTableSize: number;\n wasmMaxTableSize: number;\n run: (a: any) => void;\n abort: (msg: string) => void;\n noExitRuntime: boolean;\n usingWasm: boolean;\n calledRun: boolean;\n setExternalHelpers: (kernelIo: any, utils: any) => void;\n registerConfiguratorCallback: (callbacksObject: any) => void;\n unregisterConfiguratorCallback: (callbacksObject: any) => void;\n evaluateJsScript: (\n kernel: ConfiguratorKernelClass,\n objectOrComponentId: number,\n name: string,\n argumentObject: any,\n ) => any;\n}\n\nexport const CORE_DOCK_PAIR_TYPE = {\n POINT: 0,\n LINE: 1,\n} as const;\n\nexport interface DockPairType {\n value: Enumify<typeof CORE_DOCK_PAIR_TYPE>;\n}\n\nexport interface KernelDockPairPreview {\n parentId: number;\n parentDockId: number;\n childId: number;\n childDockId: number;\n type: DockPairType;\n position: KernelVector3f;\n rotation: KernelVector3f;\n insertInBetween: boolean;\n displacedChildId: number;\n displacedChildTransform: KernelMatrix4;\n displacedComponents: number[];\n displacementRotation: KernelVector3f;\n displacementVector: KernelVector3f;\n positionFrom?: KernelVector3f;\n positionTo?: KernelVector3f;\n lineFrom?: KernelVector3f;\n lineTo?: KernelVector3f;\n lineSegments: DockingLineSegment[];\n areaWidth?: number;\n}\n\nexport interface KernelVector2f {\n x: number;\n y: number;\n\n vectorInRoomleSpace(): KernelVector2f;\n\n vectorInKernelSpace(): KernelVector2f;\n\n convertToRoomleSpace(): void;\n\n convertToKernelSpace(): void;\n}\n\nexport interface KernelVector3f {\n x: number;\n y: number;\n z: number;\n}\n\nexport interface KernelDockingLineSegment {\n from: number;\n to: number;\n}\n\nexport interface KernelVariable {\n key: string;\n type: string;\n value: string;\n}\n\nexport interface KernelParameterValue {\n value: string;\n label: string;\n thumbnail: string;\n}\n\nexport interface KernelConfiguration {\n componentId: string;\n parameters: Map<string, string>;\n dockParent: string;\n dockPosition: string;\n children: KernelConfiguration[];\n}\n\nexport interface KernelAddOnSpot {\n mask: string;\n position: KernelVector3f;\n}\n\nexport interface KernelParamKeyValuePair {\n parameterKey: string;\n parameterValue: string;\n}\n\nexport interface ConfigurationUniqueIdAndHash {\n hash: ConfigurationHash;\n uniqueId: ConfigurationString;\n libraryId: string;\n}\n\nexport interface ExternalModuleInformation {\n groupId: string;\n rootModuleId: string;\n subModuleId: string;\n}\n\nexport interface KernelObjectInformation {\n componentId: string;\n configurationRuntimeId: number;\n externalModule: ExternalModuleInformation;\n name: string;\n runtimeId: number;\n source: string;\n type: KernelComponentType;\n permissionToDelete: KernelPermissionToDelete;\n permissionToDeleteInIsolation: KernelPermissionToDelete;\n}\n\nexport interface ExternalAttributeInformation {\n groupId: string;\n moduleIds: ExternalModuleInformation[];\n attributeId: string;\n value: string;\n}\n\nexport const enum ExportType {\n TC = 0,\n IMOSiX = 1,\n HOMAGiX = 2,\n}\n\nexport interface HomagIxArticleData {\n name: string;\n count: number;\n position: { x: number; y: number; z: number };\n rotation: { x: number; y: number; z: number };\n attributes: string;\n}\n\nexport interface ConfigurationExporter {\n new (): ConfigurationExporter;\n\n init(): void;\n\n setDefaultExportDataDefinition(\n serializedDefaultExportDefinition: string,\n ): void;\n\n generateExport(\n exportType: number,\n planObjectId: number,\n kernel: ConfiguratorKernelClass,\n ): string;\n}\n\nexport interface ConfiguratorKernelClass {\n setUpdateCallbacksOnlyIfGeometryIsReady(onlyUpdateIfReady: boolean): void;\n\n useHDGeometry(requestUseHDGeometry: boolean): void;\n\n useEnvironmentGeometry(requestEnvironmentGeometry: boolean): void;\n\n setEnvironmentVariable(key: string, value: any): void;\n\n setLevel(restrictionLevel: number): void;\n\n setDockInsertPreviewBoxParameters(\n thickness: number,\n protruding: number,\n intruding: number,\n bevelSize: number,\n ): void;\n\n clearScene(): void;\n\n clearAll(): void;\n\n loadConfiguration(\n kernelConversationId: number,\n configurationObject: ConfigurationString,\n position: KernelVector3,\n ): void;\n\n updateConfiguration(\n kernelConversationId: number,\n objectOrComponentId: number,\n serializedConfiguration: string,\n ): void;\n\n loadPlainComponent(\n conversationId: number,\n componentId: RapiId,\n configuration: ConfigurationString,\n ): void;\n\n loadFreeFlyingConfiguration(\n conversationId: number,\n configuration: ConfigurationString,\n ): void;\n\n requestComponentDockPreview(\n targetObjectId: number,\n componentId: string,\n serializedComponent: string,\n dragIn: boolean,\n allowInsertInBetween: boolean,\n ): void;\n\n requestItemDockPreview(\n targetObjectId: number,\n serializedConfiguration: string,\n dragIn: boolean,\n allowInsertInBetween: boolean,\n ): void;\n\n requestExternalObjectDockPreview(\n targetObjectId: number,\n articleId: string,\n dragIn: boolean,\n allowInsertInBetween: boolean,\n ): void;\n\n assetsLoaded(assets: AssetResponse | AssetResponse[]): void;\n\n deleteComponent(componentId: number, redockChildrenToParent: boolean): void;\n\n deleteMultipleComponents(componentIds: any): void;\n\n resetPriceListIds(): void;\n\n addPriceList(newLocale: string): void;\n\n requestPlanObjectConstruction(planObjectId: number): void;\n\n requestPlanComponentConstruction(componentId: number): void;\n\n requestDeltaPlanComponentConstruction(componentId: number): void;\n\n requestPlanComponentConstructionRecursive(componentId: number): void;\n\n requestPreviewGeometry(\n dockingObjectOrComponentId: number,\n targetObjectRuntimeId: number,\n allowInsertInBetween: boolean,\n ): void;\n\n cancelDocking(componentId: number, undoDrag: boolean): void;\n\n getComponentParameters(componentId: number): KernelParameter[];\n\n getPlanComponentAnimations(planComponentId: number): KernelAnimation[];\n\n setComponentParameter(\n componentId: number,\n parameterKey: string,\n value: string,\n ): void;\n\n setPlanComponentsParameter(\n componentIds: any,\n parameterKey: string,\n value: string,\n ): void;\n\n getPlanObjectParameters(planObjectId: number): KernelParameter[];\n\n getCommonPlanObjectParameters(\n planObjectIds: EmsArray<number>,\n ): KernelParameter[];\n\n getPlanObjectAnimations(planObjectId: number): KernelAnimation[];\n\n getPlanViews(planObjectId: number): KernelConfigurationPlanView[];\n\n setPlanObjectParameter(\n planObjectId: number,\n parameterKey: string,\n value: string,\n ): void;\n\n setPlanObjectsParameter(\n planObjectIds: any,\n parameterKey: string,\n value: string,\n ): void;\n\n dockComponent(\n childId: number,\n childDockId: number,\n parentId: number,\n parentDockId: number,\n position?: KernelVector3,\n ): void;\n\n getComponent(componentId: number): KernelComponent;\n\n getComponentBounds(\n componentId: number,\n animationValues: string[],\n ): KernelComponentBounds;\n\n getComponentId(componentId: number): RapiId;\n\n isExternalPlanObject(objectOrPlanComponentId: number): boolean;\n\n getComponentOrModuleInformation(\n objectOrPlanComponentId: number,\n ): KernelObjectInformation;\n\n getExternalObjectAttribute(\n objectOrPlanComponentId: number,\n attributeKey: string,\n value: string,\n ): ExternalAttributeInformation;\n\n getPlanObject(planObjectId: number): PlanObjectKernel;\n\n getPlanObjectFromPlanComponent(componentId: number): PlanObjectKernel;\n\n getPlanComponentPossibleChildren(componentId: number): KernelPossibleChild[];\n\n getChildrenOfPlanComponent(\n componentId: number,\n onlyPossible: boolean,\n onlyVisible: boolean,\n ): KernelPossibleChild[];\n\n getChildrenOfPlanObject(\n planObjectId: number,\n onlyPossible: boolean,\n onlyVisible: boolean,\n ): KernelPossibleChild[];\n\n getPlanObjectPossibleChildren(componentId: number): KernelPossibleChild[];\n\n getPlanObjectChildren(\n planObjectId: number,\n onlyPossible: boolean,\n onlyVisible: boolean,\n ): KernelPossibleChild[];\n\n getRootPlanComponentIdFromObjectId(planObjectId: number): number;\n\n getFullPartList(): KernelPartList;\n\n getSerializedConfiguration(\n planObjectOrComponentId: number,\n ): ConfigurationString;\n\n createNewSerializedConfiguration(\n configurationRuntimeId: number,\n ): ConfigurationString;\n\n retrieveConfigurationId(\n aPlanObjectOrComponentId: number,\n ): ConfigurationUniqueIdAndHash;\n\n getHashOfSerializedConfiguration(\n serializedConfiguration: string,\n ): ConfigurationHash;\n\n getPartList(getPartList: number): KernelPartList;\n\n getCommonPlanComponentParameters(componentIds: any): {\n parameters: KernelParameter[];\n parameterGroups: KernelParameterGroup[];\n animations: KernelAnimation[];\n };\n\n loadComponentDefinition(component: string): void;\n\n syncPlanObjectToView(conversationId: number, planObjectId: number): void;\n\n setAssetInvalid(assetType: AssetType, idOrUrl: string, quality: number): void;\n\n setActiveGroupInView(groupId: string): void;\n\n setActiveGroupInViewForPlanObject(groupId: string, runtimeId: number): void;\n\n setUpdateCallbacksOnlyIfGeometryIsReady(\n updateCallbacksOnlyIfGeometryIsReady: boolean,\n ): void;\n\n loadExternalAttributeDefinition(serializedDefinition: string): void;\n\n setExternalObjectConstructionProperties(serializedProperties: string): void;\n\n registerDebugClient(debugClient: DebugClient): void;\n\n getGlobalParameterValue(objectOrComponentId: number, name: string): string;\n\n getRuntimeIdOfRootComponent(objectOrComponentId: number): number;\n\n getRuntimeIdsOfChildComponents(objectOrComponentId: number): number[];\n\n getComponentParameterValue(objectOrComponentId: number, name: string): string;\n}\n\nexport interface KernelObjectPtrList {\n size(): void;\n\n push_back(object: KernelObject): void;\n}\n\nexport interface ObjectGroupPtr {}\n\nexport interface ParamterKeyValue {\n parameterKey: string;\n parameterValue: string;\n}\n\nexport interface VariantsList {\n componentId: string;\n parameterValues: ParamterKeyValue[];\n parts: KernelPart[];\n}\n\nexport interface KernelConfigurationLoadedData {\n conversationId: number;\n objectId: number;\n componentId: number;\n hash: string;\n errors: string[];\n}\n\nexport type RuntimeId = number;\n\nexport interface KernelMeshBuffer {\n indices: Int32Array;\n vertices: Float32Array;\n normals: Float32Array;\n uvCoords: Float32Array;\n}\n\nexport interface KernelMeshAnimation {\n matrix: Float32Array;\n visibility: boolean;\n initial: boolean;\n}\n\nexport interface KernelMeshAttributes {\n materialId: string;\n materialAttributes: Record<string, string> | null;\n transform: Float32Array;\n uvTransform: Float32Array | null;\n animations: Record<string, KernelMeshAnimation> | null;\n}\n\nexport const LIGHT_SOURCE_TYPE = {\n SPOT: 0,\n POINT: 1,\n AREA: 2,\n} as const;\n\nexport interface KernelLightSourceType {\n value: Enumify<typeof LIGHT_SOURCE_TYPE>;\n}\n\nexport interface KernelLightSourceAttributes {\n type: KernelLightSourceType;\n position: KernelVector3f;\n direction?: KernelVector3f;\n angle?: number;\n color?: string;\n intensity?: number;\n distance?: number;\n penumbra?: number;\n decay?: number;\n width?: number;\n height?: number;\n}\n\nexport interface DebugValueMapDump {\n type: string;\n componentId: string;\n internalId: string;\n id: number;\n parentId: number;\n values: Record<string, string>;\n}\n\nexport interface DebugValueMapChange {\n sourceId: number;\n sourceInfo: string;\n valueMaps: Record<string, DebugValueMapDump>;\n}\n\nexport interface DebugClient {\n debugValueMapChange(changes: DebugValueMapChange): void;\n}\n"],"mappings":";AA2IA,IAAa,IAAsB;CACjC,OAAO;CACP,QAAQ;CACR,WAAW;CACX,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,QAAQ;CACR,QAAQ;CACT,EAiLY,IAAqB;CAChC,QAAQ;CACR,UAAU;CACV,UAAU;CACX,EAkCY,IAA2B;CACtC,gBAAgB;CAChB,WAAW;CACX,aAAa;CACb,YAAY;CACZ,aAAa;CACd,EAEY,IAA4B;CACvC,OAAO;CACP,iBAAiB;CACjB,QAAQ;CACT,EA8GY,IAAkB;CAC7B,MAAM;CACN,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,gBAAgB;CAChB,kBAAkB;CAClB,kBAAkB;CACnB,EAwDY,IAAsB;CACjC,OAAO;CACP,MAAM;CACP,EAiHiB,IAAX,yBAAA,GAAA;QACL,EAAA,EAAA,KAAA,KAAA,MACA,EAAA,EAAA,SAAA,KAAA,UACA,EAAA,EAAA,UAAA,KAAA;KACD,EA+TY,IAAoB;CAC/B,MAAM;CACN,OAAO;CACP,MAAM;CACP"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ei as e, cn as t, nt as n } from "./three.core-BTUCraWz.mjs";
|
|
2
2
|
//#region packages/common-core/src/utils/kernel-utils.ts
|
|
3
|
-
var r = (t) => t ? new e(t.x / 1e3, t.z / 1e3, t.y / -1e3) : new e(0, 0, 0), i = (e) => new
|
|
3
|
+
var r = (t) => t ? new e(t.x / 1e3, t.z / 1e3, t.y / -1e3) : new e(0, 0, 0), i = (e) => new n(e.x, e.z, -e.y, "YXZ"), a = (t) => new e(t.x / 1e3, t.z / 1e3, t.y / 1e3), o = (e, t = 0) => {
|
|
4
4
|
if (t === 0) return {
|
|
5
5
|
x: Math.round(e.x * 1e3),
|
|
6
6
|
y: Math.round(e.z * -1e3),
|
|
@@ -31,22 +31,22 @@ var r = (t) => t ? new e(t.x / 1e3, t.z / 1e3, t.y / -1e3) : new e(0, 0, 0), i =
|
|
|
31
31
|
for (let r = 0; r < n; r++) t.push(e.get(r));
|
|
32
32
|
}
|
|
33
33
|
return t;
|
|
34
|
-
}, u = (
|
|
35
|
-
let r = new
|
|
34
|
+
}, u = (n) => {
|
|
35
|
+
let r = new t();
|
|
36
36
|
r.set(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1), r.scale(new e(1 / 1e3, 1 / 1e3, 1 / 1e3));
|
|
37
|
-
let i = new
|
|
38
|
-
return i.set(1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1), i.scale(new e(1e3, 1e3, 1e3)), r.multiply(
|
|
37
|
+
let i = new t();
|
|
38
|
+
return i.set(1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1), i.scale(new e(1e3, 1e3, 1e3)), r.multiply(n).multiply(i);
|
|
39
39
|
}, d = (e) => {
|
|
40
|
-
let
|
|
41
|
-
return u(new
|
|
40
|
+
let n = c(e.m);
|
|
41
|
+
return u(new t().fromArray(n).transpose());
|
|
42
42
|
}, f = (e) => {
|
|
43
|
-
let
|
|
44
|
-
return
|
|
43
|
+
let n = new t(), r = c(e);
|
|
44
|
+
return n.fromArray(r), n.transpose(), u(n);
|
|
45
45
|
}, p = (e) => {
|
|
46
|
-
let
|
|
47
|
-
return
|
|
46
|
+
let n = new t();
|
|
47
|
+
return n.set(e[0], e[2], 0, e[4], e[1], e[3], 0, e[5], 0, 0, 1, 0, 0, 0, 0, 1), n;
|
|
48
48
|
};
|
|
49
49
|
//#endregion
|
|
50
50
|
export { r as a, p as c, o as i, d as n, a as o, i as r, f as s, c as t };
|
|
51
51
|
|
|
52
|
-
//# sourceMappingURL=kernel-utils-
|
|
52
|
+
//# sourceMappingURL=kernel-utils-BYKmP0mf.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel-utils-
|
|
1
|
+
{"version":3,"file":"kernel-utils-BYKmP0mf.mjs","names":[],"sources":["../../packages/common-core/src/utils/kernel-utils.ts"],"sourcesContent":["import type { KernelMatrix4, KernelVector3 } from '../../../typings/kernel';\nimport { Euler, Matrix4, Vector3 } from 'three';\n\nexport const convertToTHREE = (\n vector: KernelVector3 | null | undefined,\n): Vector3 => {\n if (!vector) {\n return new Vector3(0, 0, 0);\n }\n return new Vector3(vector.x / 1000, vector.z / 1000, vector.y / -1000);\n};\n\nexport const convertToThreeLength = (length: number): number => {\n return length / 1000;\n};\n\nexport const convertToEuler = (vector: KernelVector3): Euler => {\n return new Euler(vector.x, vector.z, -vector.y, 'YXZ');\n};\n\nexport const convertToThreeDimensions = (vector: KernelVector3): Vector3 => {\n return new Vector3(vector.x / 1000, vector.z / 1000, vector.y / 1000);\n};\n\nexport const convertToKernel = (\n vector: Vector3,\n decimalPlaces: number = 0,\n): KernelVector3 => {\n if (decimalPlaces === 0) {\n return {\n x: Math.round(vector.x * 1000),\n y: Math.round(vector.z * -1000),\n z: Math.round(vector.y * 1000),\n };\n }\n const factor = Math.pow(10, decimalPlaces);\n return {\n x: Math.round(vector.x * 1000 * factor) / factor,\n y: Math.round(vector.z * -1000 * factor) / factor,\n z: Math.round(vector.y * 1000 * factor) / factor,\n };\n};\n\nexport const utilityStringToUTF16 = (str: string): string => {\n return decodeURIComponent(encodeURIComponent(str));\n};\n\nexport const convertCObject = (obj: any): any => {\n if (!obj) {\n const typeOfObj = typeof obj;\n if (typeOfObj === 'number' || typeOfObj === 'boolean') {\n return obj;\n }\n return null;\n }\n\n if (\n !obj.hasOwnProperty('size') &&\n !!obj.size &&\n typeof obj.size === 'function'\n ) {\n let result = utilityToArray(obj);\n for (let i = 0; i < result.length; i++) {\n result[i] = convertCObject(result[i]);\n }\n if (typeof result === 'string') {\n return utilityStringToUTF16(result);\n }\n return result;\n }\n if (typeof obj === 'object') {\n for (let property in obj) {\n if (obj.hasOwnProperty(property)) {\n obj[property] = convertCObject(obj[property]);\n }\n }\n }\n\n if (typeof obj === 'string') {\n return utilityStringToUTF16(obj);\n }\n\n return obj;\n};\n\nexport const utilityToArray = (obj: any): any[] => {\n let result: any[] = [];\n if (obj) {\n let size = obj.size();\n for (let i = 0; i < size; i++) {\n result.push(obj.get(i));\n }\n }\n return result;\n};\n\nexport const convertKernelMatrixCoordsToThree = (matrix: Matrix4): Matrix4 => {\n let a = new Matrix4();\n a.set(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1);\n a.scale(new Vector3(1 / 1000, 1 / 1000, 1 / 1000));\n let b = new Matrix4();\n b.set(1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1);\n b.scale(new Vector3(1000, 1000, 1000));\n return a.multiply(matrix).multiply(b);\n};\n\nexport const convertKernelMatrixToThreeMatrix = (\n transform: KernelMatrix4,\n): Matrix4 => {\n const transformArray: number[] = convertCObject(transform.m);\n const transformMatrix = new Matrix4().fromArray(transformArray).transpose();\n return convertKernelMatrixCoordsToThree(transformMatrix);\n};\n\nexport const convertToThreeMatrix = (transform: Float32Array): Matrix4 => {\n let transformMatrix = new Matrix4();\n let transformArray: number[] = convertCObject(transform);\n transformMatrix.fromArray(transformArray);\n transformMatrix.transpose();\n\n return convertKernelMatrixCoordsToThree(transformMatrix);\n};\n\nexport const convertToThreeUVMatrix = (transform: Float32Array): Matrix4 => {\n const uvTransformMatrix = new Matrix4();\n uvTransformMatrix.set(\n transform[0],\n transform[2],\n 0,\n transform[4],\n transform[1],\n transform[3],\n 0,\n transform[5],\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n );\n return uvTransformMatrix;\n};\n"],"mappings":";;AAGA,IAAa,KACX,MAEK,IAGE,IAAI,EAAQ,EAAO,IAAI,KAAM,EAAO,IAAI,KAAM,EAAO,IAAI,KAAM,GAF7D,IAAI,EAAQ,GAAG,GAAG,EAAE,EASlB,KAAkB,MACtB,IAAI,EAAM,EAAO,GAAG,EAAO,GAAG,CAAC,EAAO,GAAG,MAAM,EAG3C,KAA4B,MAChC,IAAI,EAAQ,EAAO,IAAI,KAAM,EAAO,IAAI,KAAM,EAAO,IAAI,IAAK,EAG1D,KACX,GACA,IAAwB,MACN;AAClB,KAAI,MAAkB,EACpB,QAAO;EACL,GAAG,KAAK,MAAM,EAAO,IAAI,IAAK;EAC9B,GAAG,KAAK,MAAM,EAAO,IAAI,KAAM;EAC/B,GAAG,KAAK,MAAM,EAAO,IAAI,IAAK;EAC/B;CAEH,IAAM,IAAkB,MAAI;AAC5B,QAAO;EACL,GAAG,KAAK,MAAM,EAAO,IAAI,MAAO,EAAO,GAAG;EAC1C,GAAG,KAAK,MAAM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AG,GAAG,EAAE,EACtD,EAAE,MAAM,IAAI,EAAQ,KAAM,KAAM,IAAK,CAAC,EAC/B,EAAE,SAAS,EAAO,CAAC,SAAS,EAAE;GAG1B,KACX,MACY;CACZ,IAAM,IAA2B,EAAe,EAAU,EAAE;AAE5D,QAAO,EADiB,IAAI,GAAS,CAAC,UAAU,EAAe,CAAC,WAAW,CACnB;GAG7C,KAAwB,MAAqC;CACxE,IAAI,IAAkB,IAAI,GAAS,EAC/B,IAA2B,EAAe,EAAU;AAIxD,QAHA,EAAgB,UAAU,EAAe,EACzC,EAAgB,WAAW,EAEpB,EAAiC,EAAgB;GAG7C,KAA0B,MAAqC;CAC1E,IAAM,IAAoB,IAAI,GAAS;AAmBvC,QAlBA,EAAkB,IAChB,EAAU,IACV,EAAU,IACV,GACA,EAAU,IACV,EAAU,IACV,EAAU,IACV,GACA,EAAU,IACV,GACA,GACA,GACA,GACA,GACA,GACA,GACA,EACD,EACM"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { G as e, M as t, P as n, d as r, k as i, nt as a, u as o } from "./threejs-utils-
|
|
2
|
-
import {
|
|
1
|
+
import { G as e, M as t, P as n, d as r, k as i, nt as a, u as o } from "./threejs-utils-lVSsgAiQ.mjs";
|
|
2
|
+
import { ci as s, f as c, jn as l, ln as u, p as d, ti as f, w as p } from "./three.core-BTUCraWz.mjs";
|
|
3
3
|
import { n as m, r as h, t as g } from "./decorate-Bl-JF_YY.mjs";
|
|
4
|
-
import { U as _ } from "./common-utils-
|
|
5
|
-
import { $ as v, H as y, I as b, L as x, T as S, V as C, X as w, Y as T, _ as E, ct as D, g as O, n as k, nt as A, ot as j, p as M, rt as N, st as P, tt as F, v as I } from "./roomle-sdk-
|
|
6
|
-
import { t as L } from "./script-loader-
|
|
4
|
+
import { U as _ } from "./common-utils-OTJQGohe.mjs";
|
|
5
|
+
import { $ as v, H as y, I as b, L as x, T as S, V as C, X as w, Y as T, _ as E, ct as D, g as O, n as k, nt as A, ot as j, p as M, rt as N, st as P, tt as F, v as I } from "./roomle-sdk-CcNdTp_n.mjs";
|
|
6
|
+
import { t as L } from "./script-loader-D6i0wQ_j.mjs";
|
|
7
7
|
//#region packages/common-core/src/cameracontrol/material-viewer-camera-behaviour.ts
|
|
8
8
|
var R = class extends M {
|
|
9
9
|
get cameraControl() {
|
|
@@ -36,11 +36,11 @@ var R = class extends M {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
_initScene() {
|
|
39
|
-
let e = new
|
|
40
|
-
this._setMaterial(t), this._mesh = new
|
|
39
|
+
let e = new d(B.x, B.y, B.z, 100, 100, 100), t = a.createMeshPhysicalMaterial({ color: this._initData.colors.PRIMARY });
|
|
40
|
+
this._setMaterial(t), this._mesh = new u(e, this._material), this._mesh.castShadow = !0, this._mesh.position.setY(B.y / 2), this._scene.add(this._mesh);
|
|
41
41
|
let { initialFloorMaterial: n } = this._initData;
|
|
42
42
|
if (n ? this.changeFloorMaterialById(n) : this._environment = new I(this._scene, void 0, new p(16777215)), this.cameraBehaviour.cameraControl instanceof S) {
|
|
43
|
-
let e = new
|
|
43
|
+
let e = new c();
|
|
44
44
|
e.setFromObject(this._mesh), console.trace("reset camera"), this.cameraBehaviour.cameraControl.updateAndReset(e);
|
|
45
45
|
}
|
|
46
46
|
this.showGUI();
|
|
@@ -79,7 +79,7 @@ var R = class extends M {
|
|
|
79
79
|
}
|
|
80
80
|
sceneChanged() {}
|
|
81
81
|
getBounds() {
|
|
82
|
-
return this._mesh ? new
|
|
82
|
+
return this._mesh ? new c().setFromObject(this._mesh) : null;
|
|
83
83
|
}
|
|
84
84
|
getGeometryBounds() {
|
|
85
85
|
return null;
|
|
@@ -123,10 +123,10 @@ var R = class extends M {
|
|
|
123
123
|
}
|
|
124
124
|
_setGeometry() {
|
|
125
125
|
let e;
|
|
126
|
-
if (this._sceneParams.type === z.CUBE) e = new
|
|
127
|
-
else if (this._sceneParams.type === z.SPHERE) e = new
|
|
128
|
-
else if (this._sceneParams.type === z.PLANE_HORIZONTAL) e = new
|
|
129
|
-
else if (this._sceneParams.type === z.PLANE_VERTICAL) e = new
|
|
126
|
+
if (this._sceneParams.type === z.CUBE) e = new d(B.x, B.y, B.z, 100, 100, 100);
|
|
127
|
+
else if (this._sceneParams.type === z.SPHERE) e = new f(.5, 100, 100);
|
|
128
|
+
else if (this._sceneParams.type === z.PLANE_HORIZONTAL) e = new l(B.x, B.z), e.rotateX(-Math.PI / 2);
|
|
129
|
+
else if (this._sceneParams.type === z.PLANE_VERTICAL) e = new l(B.x, B.z);
|
|
130
130
|
else {
|
|
131
131
|
console.error(`MaterialViewerSceneManager: unexpected geometry type "${this._sceneParams.type}"`);
|
|
132
132
|
return;
|
|
@@ -142,15 +142,15 @@ var R = class extends M {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
async addTexture(e, n) {
|
|
145
|
-
let i = B.x * 100, a = B.y * 100,
|
|
145
|
+
let i = B.x * 100, a = B.y * 100, c = i / (e.mmWidth === 0 ? 1 : e.mmWidth), l = a / (e.mmHeight === 0 ? 1 : e.mmHeight), u = t(this._renderer);
|
|
146
146
|
if (n) {
|
|
147
147
|
let t = new Image();
|
|
148
148
|
t.src = n;
|
|
149
|
-
let r = new
|
|
149
|
+
let r = new s();
|
|
150
150
|
r.image = t, t.onload = function() {
|
|
151
151
|
r.needsUpdate = !0;
|
|
152
|
-
}, o(r, e, this._material, this._maxAnisotropy,
|
|
153
|
-
} else await r(e.image, e, this._material, this._maxAnisotropy,
|
|
152
|
+
}, o(r, e, this._material, this._maxAnisotropy, c, l, u);
|
|
153
|
+
} else await r(e.image, e, this._material, this._maxAnisotropy, c, l, u);
|
|
154
154
|
this._requestRender();
|
|
155
155
|
}
|
|
156
156
|
removeTexture(e) {
|
|
@@ -294,4 +294,4 @@ var U = class extends w {
|
|
|
294
294
|
//#endregion
|
|
295
295
|
export { G as MaterialViewer };
|
|
296
296
|
|
|
297
|
-
//# sourceMappingURL=material-viewer-
|
|
297
|
+
//# sourceMappingURL=material-viewer-BuBSXGw6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material-viewer-BKTxh5Ui.mjs","names":[],"sources":["../../packages/common-core/src/cameracontrol/material-viewer-camera-behaviour.ts","../../packages/material-viewer/src/webgl/material-viewer-scene-manager.ts","../../packages/material-viewer/src/roomle-material-viewer.ts","../../packages/material-viewer/src/roomle-material-viewer-ui-callback.ts","../../packages/material-viewer/src/utils/injectables.ts","../../packages/material-viewer/src/material-viewer.ts"],"sourcesContent":["import CameraBehaviour from './camera-behaviour';\nimport type AdjustableCameraControl3D from '../../../glb-viewer-core/src/camera-control/adjustable-camera-control-3d';\n\nexport default class MaterialViewerCameraBehaviour extends CameraBehaviour {\n public get cameraControl(): AdjustableCameraControl3D {\n return this._cameraControl as AdjustableCameraControl3D;\n }\n}\n","import SceneManager from '../../../common-core/src/webgl/scene-manager';\nimport type { GenericGUIParamFolder } from '../../../common-core/src/webgl/gui-types';\nimport type { RoomleWebGPURenderer } from '../../../common-core/src/webgpu/roomle-webgpu-renderer';\nimport type { CanvasOffset } from '../../../common-core/src/common-interfaces';\nimport type InputManager from '../../../common-core/src/input/input-manager';\nimport inject from '../../../common-core/src/di/inject';\nimport CameraControl3D from '../../../common-core/src/cameracontrol/camera-control-3d';\nimport type {\n RapiId,\n RapiMaterial,\n RapiMaterialShading,\n RapiTexture,\n} from '../../../typings/rapi-types';\nimport { RAPI_TEXTURE_TYPE } from '../../../typings/rapi-types';\nimport {\n addExistingTexture,\n addTexture,\n getWebGLGUI,\n getMaterialShading,\n setMaterial,\n getMaxTextures,\n} from '../../../common-core/src/utils/threejs-utils';\nimport { CAMERA_TYPE } from '../../../common-core/src/cameracontrol/camera-type';\nimport type ConfiguratorMeshGenerator from '../../../configurator-core/src/webgl/configurator-mesh-generator';\nimport type RoomleMaterialViewerUiCallback from '../roomle-material-viewer-ui-callback';\nimport BackgroundEnvironment from '../../../common-core/src/environment/background-environment';\nimport FloorEnvironment from '../../../configurator-core/src/webgl/environment/floor-environment';\nimport { type RapiAccess } from '../../../common-core/src/rapi-access';\nimport DynamicLightSettingLoader, {\n PREDEFINED_LIGHTSETTING,\n} from '../../../common-core/src/lightsetting/dynamic-light-setting-loader';\nimport { CANVAS_ID } from '../../../common-core/src/utils/dom-helper';\nimport type { Enumify } from '#/common/src/utils/types';\nimport type { MeshPhysicalMaterial } from 'three';\nimport {\n Box3,\n BoxGeometry,\n Color,\n DoubleSide,\n FrontSide,\n Mesh,\n PlaneGeometry,\n SphereGeometry,\n Texture,\n} from 'three';\nimport MaterialCreator from '../../../common-core/src/utils/material-creator';\nimport MaterialViewerCameraBehaviour from '../../../common-core/src/cameracontrol/material-viewer-camera-behaviour';\n\nexport const enum GEOMETRY {\n CUBE = 'cube',\n SPHERE = 'sphere',\n PLANE_VERTICAL = 'plane_vertical',\n PLANE_HORIZONTAL = 'plane_horizontal',\n}\n\nconst SIZE = { x: 1, y: 1, z: 1 };\nexport default class MaterialViewerSceneManager extends SceneManager {\n @inject\n private _inputManager: InputManager;\n\n @inject\n private _configuratorMeshGenerator: ConfiguratorMeshGenerator;\n\n @inject\n private _roomleMaterialViewerUiCallback: RoomleMaterialViewerUiCallback;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n private _gui: GenericGUIParamFolder | null;\n private _guiGeometryFolder: GenericGUIParamFolder | undefined;\n private _guiMaterialFolder: GenericGUIParamFolder | undefined;\n private _mesh: Mesh;\n private _material: MeshPhysicalMaterial;\n private _sceneParams = {\n type: GEOMETRY.CUBE,\n };\n private _materialParams = {\n color: '#ffffff',\n metallic: 0.5,\n alpha: 0,\n alphaCutoff: 0,\n doubleSided: false,\n };\n\n constructor(creator: string, offset: CanvasOffset) {\n super(creator, offset, CANVAS_ID.RMV, CAMERA_TYPE.CAMERA_3D);\n\n // Use lazy initialization for renderer-dependent settings\n this._initializeRendererSettings();\n\n this._initScene();\n }\n\n // If renderer is not ready yet, will retry on next tick.\n // This is necessary for dynamic WebGPU renderer imports.\n private _initializeRendererSettings(): void {\n if (!this._renderer) {\n // Retry on next tick if renderer not ready\n setTimeout(() => this._initializeRendererSettings(), 0);\n return;\n }\n\n const maxTextures = getMaxTextures(this._renderer);\n if (maxTextures > 8) {\n const lightSource =\n DynamicLightSettingLoader.createDynamicLightSettingSource(\n null,\n PREDEFINED_LIGHTSETTING.CAMERA,\n );\n if (lightSource) {\n this.loadDynamicLightSetting(lightSource);\n }\n }\n }\n\n private _initScene() {\n const geometry = new BoxGeometry(SIZE.x, SIZE.y, SIZE.z, 100, 100, 100);\n const meshPhysicalMaterial = MaterialCreator.createMeshPhysicalMaterial({\n color: this._initData.colors.PRIMARY,\n });\n this._setMaterial(meshPhysicalMaterial);\n this._mesh = new Mesh(geometry, this._material);\n this._mesh.castShadow = true;\n this._mesh.position.setY(SIZE.y / 2);\n this._scene.add(this._mesh);\n\n const { initialFloorMaterial } = this._initData;\n\n if (initialFloorMaterial) {\n this.changeFloorMaterialById(initialFloorMaterial);\n } else {\n this._environment = new BackgroundEnvironment(\n this._scene,\n undefined,\n new Color(0xffffff),\n );\n }\n\n if (this.cameraBehaviour.cameraControl instanceof CameraControl3D) {\n const boundingBox = new Box3();\n boundingBox.setFromObject(this._mesh);\n console.trace('reset camera');\n this.cameraBehaviour.cameraControl.updateAndReset(boundingBox);\n }\n\n void this.showGUI();\n }\n\n public loadMaterialId(materialId: RapiId): Promise<void> {\n return new Promise<void>((resolve) => {\n this._configuratorMeshGenerator\n .loadMaterial(materialId, SIZE.x * 1000, SIZE.y * 1000)\n .then((material) => {\n this._setMaterial(material as MeshPhysicalMaterial);\n this._mesh.material = this._material;\n this._updateGUI();\n this._requestRender();\n resolve();\n });\n });\n }\n\n public loadMaterial(material: RapiMaterial): Promise<void> {\n return new Promise<void>((resolve) => {\n // eslint-disable-next-line\n if (!material.__rapi_path__) {\n // eslint-disable-next-line\n material.__rapi_path__ = 'materials';\n }\n this._mesh.material = this._material;\n this._configuratorMeshGenerator\n .loadTextures(material, this._material, SIZE.x * 100, SIZE.y * 100)\n .then(() => {\n this._updateGUI();\n this._requestRender();\n });\n resolve();\n });\n }\n\n public loadMaterialShading(\n materialShading: RapiMaterialShading,\n ): Promise<void> {\n return new Promise<void>((resolve) => {\n let material = { shading: materialShading };\n this._setMaterial(setMaterial(this._material, material as RapiMaterial));\n this._mesh.material = this._material;\n this._updateGUI();\n this._requestRender();\n resolve();\n });\n }\n\n private _setMaterial(material: MeshPhysicalMaterial) {\n this._material = material;\n this._materialParams.alpha = material.opacity;\n this._materialParams.alphaCutoff = material.alphaTest;\n this._materialParams.color = '#' + material.color.getHexString();\n this._materialParams.doubleSided = material.side === DoubleSide;\n this._materialParams.metallic =\n material.metalness === 1 ? 1 : material.reflectivity;\n }\n\n public getMaterialShading(version: number = 1): RapiMaterialShading {\n return getMaterialShading(this._material, version);\n }\n\n protected createCameraControl(\n _mode: Enumify<typeof CAMERA_TYPE>,\n _offset: CanvasOffset,\n ) {\n this._changeCameraBehaviour(\n new MaterialViewerCameraBehaviour(\n new CameraControl3D(this._creator_, this._getInputManager(), undefined),\n this._cameraBehaviourState,\n ),\n );\n }\n\n protected _getInputManager(): InputManager {\n return this._inputManager;\n }\n\n public sceneChanged(): void {\n //override when needed\n }\n\n public getBounds(): Box3 | null {\n if (!this._mesh) {\n return null;\n }\n return new Box3().setFromObject(this._mesh);\n }\n\n getGeometryBounds(): Box3 | null {\n return null;\n }\n\n protected initializeWebGLGUI() {\n this._gui = getWebGLGUI();\n this._updateGUI();\n }\n\n protected override initializeWebGPUGUI(\n roomleWebGPURenderer: RoomleWebGPURenderer,\n ): void {\n super.initializeWebGPUGUI(roomleWebGPURenderer);\n this._gui =\n roomleWebGPURenderer.getOrCreateGUIParameters('Material Viewer');\n this._updateGUI();\n }\n\n private _updateGUI() {\n const gui = this._gui;\n if (!gui) {\n return;\n }\n if (!this._guiGeometryFolder) {\n this._guiGeometryFolder = gui.addFolder('Geometry');\n this._guiGeometryFolder\n .add(this._sceneParams, 'type', {\n Cube: GEOMETRY.CUBE,\n Sphere: GEOMETRY.SPHERE,\n PlaneVertical: GEOMETRY.PLANE_VERTICAL,\n PlaneHorizontal: GEOMETRY.PLANE_HORIZONTAL,\n })\n .onChange((type: number) => {\n console.log(type);\n this._setGeometry();\n });\n }\n if (this._material) {\n if (!this._guiMaterialFolder) {\n this._guiMaterialFolder = gui.addFolder('Material');\n this._guiMaterialFolder\n .addColor(this._materialParams, 'color')\n .onChange((color: string) => {\n this._material.color = new Color(color);\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'metallic', 0, 1, 0.01)\n .onChange((metallic: number) => {\n this._material.metalness = metallic === 1 ? 1 : 0.5;\n this._material.reflectivity = metallic || 0.5;\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._material, 'roughness', 0, 1, 0.01)\n .onChange((_roughness: number) => {\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._material, 'transmission', 0, 1, 0.01)\n .onChange((transmission: number) => {\n this._material.transmission = transmission;\n if (transmission > 0) {\n this._material.opacity = 1;\n this._material.alphaTest = 0.5;\n this._material.depthWrite = true;\n this._material.metalness = 0;\n }\n this._mesh.castShadow = !this._material.transparent;\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'alpha', 0, 1, 0.01)\n .onChange((alpha: number) => {\n this._material.transparent = alpha < 1;\n this._material.opacity = alpha;\n this._material.depthWrite = alpha >= 1;\n this._mesh.castShadow = !this._material.transparent;\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'alphaCutoff', 0, 1, 0.01)\n .onChange((alphaCutoff: number) => {\n if (alphaCutoff) {\n this._material.alphaTest = alphaCutoff;\n } else {\n this._material.alphaTest = 0;\n }\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'doubleSided')\n .onChange((doubleSided: boolean) => {\n if (doubleSided) {\n this._material.side = DoubleSide;\n } else {\n this._material.side = FrontSide;\n }\n this._shadingChanged();\n });\n }\n }\n }\n\n private _shadingChanged() {\n this._roomleMaterialViewerUiCallback.onMaterialShadingChanged(\n getMaterialShading(this._material),\n );\n this._requestRender();\n }\n\n public setGeometry(type: GEOMETRY) {\n this._sceneParams.type = type;\n this._setGeometry();\n }\n\n private _setGeometry() {\n let geometry;\n if (this._sceneParams.type === GEOMETRY.CUBE) {\n geometry = new BoxGeometry(SIZE.x, SIZE.y, SIZE.z, 100, 100, 100);\n } else if (this._sceneParams.type === GEOMETRY.SPHERE) {\n geometry = new SphereGeometry(0.5, 100, 100);\n } else if (this._sceneParams.type === GEOMETRY.PLANE_HORIZONTAL) {\n geometry = new PlaneGeometry(SIZE.x, SIZE.z);\n geometry.rotateX(-Math.PI / 2);\n } else if (this._sceneParams.type === GEOMETRY.PLANE_VERTICAL) {\n geometry = new PlaneGeometry(SIZE.x, SIZE.z);\n } else {\n console.error(\n `MaterialViewerSceneManager: unexpected geometry type \"${this._sceneParams.type}\"`,\n );\n return;\n }\n this._mesh.geometry = geometry;\n this._renderEverything();\n }\n\n public async changeFloorMaterialById(materialId: string): Promise<void> {\n const material = await this._rapiAccess.getMaterial(materialId);\n if (\n !this._environment ||\n !(this._environment instanceof FloorEnvironment)\n ) {\n this._environment = new FloorEnvironment(\n this._scene,\n this._environment,\n !this._initData.webGpu,\n );\n }\n return new Promise((resolve, reject) => {\n (this._environment as FloorEnvironment)\n .changeFloorMaterial(material, this._maxAnisotropy)\n .then(() => {\n this._requestRender();\n resolve();\n }, reject);\n });\n }\n\n public async addTexture(rapiTexture: RapiTexture, base64Image?: string) {\n const width = SIZE.x * 100;\n const height = SIZE.y * 100;\n const repeatWidth =\n width / (rapiTexture.mmWidth === 0 ? 1 : rapiTexture.mmWidth);\n const repeatHeight =\n height / (rapiTexture.mmHeight === 0 ? 1 : rapiTexture.mmHeight);\n const maxTextures = getMaxTextures(this._renderer);\n if (base64Image) {\n const image = new Image();\n image.src = base64Image;\n const texture = new Texture();\n texture.image = image;\n image.onload = function () {\n texture.needsUpdate = true;\n };\n addExistingTexture(\n texture,\n rapiTexture,\n this._material,\n this._maxAnisotropy,\n repeatWidth,\n repeatHeight,\n maxTextures,\n );\n } else {\n await addTexture(\n rapiTexture.image,\n rapiTexture,\n this._material,\n this._maxAnisotropy,\n repeatWidth,\n repeatHeight,\n maxTextures,\n );\n }\n this._requestRender();\n }\n\n public removeTexture(rapiTexture: RapiTexture) {\n if (rapiTexture.mapping === RAPI_TEXTURE_TYPE.ORM) {\n this._material.aoMap = null;\n this._material.roughnessMap = null;\n this._material.metalnessMap = null;\n }\n if (\n rapiTexture.mapping === RAPI_TEXTURE_TYPE.RGB ||\n rapiTexture.mapping === RAPI_TEXTURE_TYPE.RGBA\n ) {\n this._material.map = null;\n }\n if (rapiTexture.mapping === RAPI_TEXTURE_TYPE.XYZ) {\n this._material.normalMap = null;\n }\n this._material.needsUpdate = true;\n this._requestRender();\n }\n\n public clearCache() {\n this._configuratorMeshGenerator.clear();\n }\n}\n","import type ScriptLoader from '../../common-core/src/script-loader';\nimport type DomHelper from '../../common-core/src/utils/dom-helper';\nimport inject from '../../common-core/src/di/inject';\nimport type { ExternalEmbeddable, GlobalAPI } from '../../common-core/src/main';\nimport type { Main } from '../../common-core/src/main';\nimport type { Context } from '../../common-core/src/di/context';\nimport type { LifeCycleManager } from '../../common-core/src/life-cycle-manager';\nimport type { SceneSettings } from '../../common-core/src/scene-settings-loader';\nimport type { GEOMETRY } from './webgl/material-viewer-scene-manager';\nimport MaterialViewerSceneManager from './webgl/material-viewer-scene-manager';\nimport type {\n RapiId,\n RapiMaterial,\n RapiMaterialShading,\n RapiTexture,\n} from '../../typings/rapi-types';\nimport type RoomleMaterialViewerUiCallback from './roomle-material-viewer-ui-callback';\nimport type { InitDataDefinition } from '../../common-core/src/utils/shims';\nimport type InitData from '../../common-core/src/utils/init-data';\nimport { type RapiAccess } from '../../common-core/src/rapi-access';\nimport type { CanvasOffset } from '../../common-core/src/common-interfaces';\nimport type UnitFormatter from '../../configurator-core/src/services/unit-formatter';\nimport type { Scene } from 'three';\nimport { type IdbManager } from '../../common-core/src/services/idb-manager';\nimport type { GlobalCallback } from '../../common-core/src/services/global-callback';\n\nexport default class RoomleMaterialViewer\n implements\n GlobalAPI,\n Context,\n ExternalEmbeddable<RoomleMaterialViewerUiCallback>\n{\n public _creator_: string;\n\n @inject\n private _domHelper: DomHelper;\n\n @inject\n private _scriptLoader: ScriptLoader;\n\n @inject\n private _lifeCycleManager: LifeCycleManager;\n\n @inject\n private _roomleMaterialViewerUiCallback: RoomleMaterialViewerUiCallback;\n\n @inject\n private _initData: InitData;\n\n @inject\n private _globalCallback: GlobalCallback;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n @inject\n private _unitFormatter: UnitFormatter;\n\n @inject\n protected _idbManager: IdbManager;\n\n private _sceneManager: MaterialViewerSceneManager;\n\n constructor(creator: string) {\n this._creator_ = creator;\n }\n\n public setCameraOffset(offset: CanvasOffset): void {\n this._sceneManager.setCameraOffset(offset);\n }\n\n public getCameraOffset(): CanvasOffset {\n return this._sceneManager.getCameraOffset();\n }\n\n public init(element: HTMLElement): Promise<void> {\n this._domHelper.setDomElement(element);\n\n if (this._sceneManager) {\n this._lifeCycleManager.resume();\n return Promise.resolve();\n }\n\n return new Promise<void>(this._initPromiseCallback.bind(this));\n }\n\n private _initPromiseCallback(resolve: () => void, _reject: () => void) {\n this._sceneManager = new MaterialViewerSceneManager(this._creator_, {\n left: 0,\n top: 1,\n right: 1,\n bottom: 0,\n });\n this._sceneManager.enableHD();\n resolve();\n }\n\n get callbacks(): RoomleMaterialViewerUiCallback {\n return this._roomleMaterialViewerUiCallback;\n }\n\n set callbacks(callback: RoomleMaterialViewerUiCallback) {\n this._roomleMaterialViewerUiCallback = callback;\n }\n\n public loadMaterialShading(\n materialShading: RapiMaterialShading,\n ): Promise<void> {\n return this._sceneManager.loadMaterialShading(materialShading);\n }\n\n public loadMaterial(\n material: RapiMaterial,\n options: { flushCache?: boolean } = {},\n ): Promise<void> {\n if (options.flushCache) {\n this._clearCaches();\n }\n return this._sceneManager.loadMaterial(material);\n }\n\n public loadMaterialId(\n materialId: RapiId,\n options: { flushCache?: boolean } = {},\n ): Promise<void> {\n if (options.flushCache) {\n this._clearCaches();\n }\n return this._sceneManager.loadMaterialId(materialId);\n }\n\n public getMaterialShading(version: number = 1): RapiMaterialShading {\n return this._sceneManager.getMaterialShading(version);\n }\n\n /**\n * Loads a SceneSettings object, currently it can can contain a light setting definition\n * (see {@link @roomle/web-sdk/configurator-core/src/roomle-configurator#RoomleConfigurator.loadDynamicLightSetting}) and an environment definition (see {@link @roomle/web-sdk/configurator-core/src/environment/dynamic-environment-setting-loader#EnvironmentSetting}).\n * @param sceneSettings\n */\n public loadSceneSetting(sceneSettings: SceneSettings): Promise<void> {\n return this._sceneManager.loadSceneSettings(sceneSettings);\n }\n\n public setOverrides(initData: InitDataDefinition): void {\n if (!initData) {\n return;\n }\n this._initData.setOverrides(initData);\n }\n\n public updateSize(): void {\n this._sceneManager.updateCamera();\n }\n\n /**\n * Return the main class which has access to lifecycle events and RapiAccess.\n * Hidden because it's only useful for embedding API.\n * Has to be overridden by main class.\n * @hidden\n */\n public getMain(): Main | undefined {\n return undefined;\n }\n\n public resumeTest(element: HTMLElement) {\n this._domHelper.setDomElement(element);\n this._lifeCycleManager.resume();\n }\n\n public pauseTest() {\n this._lifeCycleManager.pause();\n }\n\n public showGUI() {\n this._sceneManager.showGUI();\n }\n\n /**\n * Sets the material of the floor to the given material id.\n * If the current environment is not floor environment it will be changed\n *\n * Example material ids are:\n * roomle_floor:DresdenEiche\n * roomle_floor:Ibiza\n * roomle_floor:Palma\n * roomle_floor:Elba\n * roomle_floor:Manacor\n * roomle_floor:KernEiche\n * roomle_floor:KieferScandic\n * roomle_floor:EicheHabsburg\n * roomle_floor:FuldaKiefer\n * roomle_floor:Ashton\n * roomle_floor:EicheLondon\n *\n * @param materialId\n * @returns promise that resolves when material has been changed\n */\n public async changeFloorMaterialById(materialId: string): Promise<void> {\n return this._sceneManager.changeFloorMaterialById(materialId);\n }\n\n /**\n * Set the geometry of the demo material mesh\n *\n * Possible parameter:\n * 'cube',\n * 'sphere',\n * 'plane_vertical',\n * 'plane_horizontal'\n *\n * @param type\n */\n public setGeometry(type: GEOMETRY) {\n this._sceneManager.setGeometry(type);\n }\n\n /**\n * Set a texture on the demo material, if no base64Image is set, the image field of rapiTexture is used\n * @param rapiTexture\n * @param base64Image for example \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg==\"\n */\n public async addTexture(rapiTexture: RapiTexture, base64Image?: string) {\n return this._sceneManager.addTexture(rapiTexture, base64Image);\n }\n\n /**\n * Remove texture from the demo material\n * @param rapiTexture\n */\n public removeTexture(rapiTexture: RapiTexture) {\n return this._sceneManager.removeTexture(rapiTexture);\n }\n\n private _clearCaches() {\n this._rapiAccess.cleanUp();\n this._sceneManager.clearCache();\n }\n\n public getScene(): Scene {\n return this._sceneManager.getScene();\n }\n\n public updateScene(): void {\n this._sceneManager.updateScene();\n }\n\n /**\n * returns unit formatter for formatting input und output values in scene\n */\n public getUnitFormatter(): UnitFormatter {\n return this._unitFormatter;\n }\n\n /**\n * returns manager class to interface with indexedDB storage\n */\n public getStorage(): IdbManager {\n return this._idbManager;\n }\n\n public setEnvironmentMap(params: {\n url?: string;\n intensity?: number;\n rotation?: number;\n maxLightSources?: number;\n }): void {\n const { url, intensity, rotation, maxLightSources } = params;\n this._sceneManager.setEnvironmentMap(\n url,\n intensity,\n rotation,\n maxLightSources,\n );\n }\n\n /**\n * @internal\n * Use this callbacks to hook in your functionality\n */\n public get globalCallbacks(): GlobalCallback {\n return this._globalCallback;\n }\n}\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { UiCallback } from '../../common-core/src/utils/ui-callback';\nimport type { RapiMaterialShading } from '../../typings/rapi-types';\n\nexport default class RoomleMaterialViewerUiCallback extends UiCallback {\n constructor(creator: string) {\n super(creator);\n }\n\n /**\n * Gets called when a material parameter has been changed using the graphical user interface\n * @param materialShading\n */\n public onMaterialShadingChanged = (\n materialShading: RapiMaterialShading,\n ): void => undefined;\n}\n","import Logger from '../../../common-core/src/logger';\nimport ScriptLoader from '../../../common-core/src/script-loader';\nimport {\n DependencyInjectionAssignment,\n DI_TYPE,\n} from '../../../common-core/src/di/container';\nimport InputManager from '../../../common-core/src/input/input-manager';\nimport ConfiguratorMeshGenerator from '../../../configurator-core/src/webgl/configurator-mesh-generator';\nimport { RapiAccess } from '../../../common-core/src/rapi-access';\nimport RoomleMaterialViewerUiCallback from '../roomle-material-viewer-ui-callback';\n\nexport const INJECTABLES: DependencyInjectionAssignment[] = [\n new DependencyInjectionAssignment('script-loader', ScriptLoader),\n new DependencyInjectionAssignment('logger', Logger),\n new DependencyInjectionAssignment(\n 'input-manager',\n InputManager,\n DI_TYPE.CONTEXT,\n ),\n new DependencyInjectionAssignment(\n 'configurator-mesh-generator',\n ConfiguratorMeshGenerator,\n ),\n new DependencyInjectionAssignment('rapi-access', RapiAccess),\n new DependencyInjectionAssignment(\n 'roomle-material-viewer-ui-callback',\n RoomleMaterialViewerUiCallback,\n DI_TYPE.CONTEXT,\n ),\n];\n","import './utils/global-definitions';\nimport { Main, BASE_CONTEXT } from '../../common-core/src/main';\nimport type Logger from '../../common-core/src/logger';\nimport RoomleDependencyInjection from '../../common-core/src/di/roomle-dependency-injection';\nimport RoomleMaterialViewer from './roomle-material-viewer';\nimport { INJECTABLES } from './utils/injectables';\n\nexport class MaterialViewer extends Main {\n private _viewer: RoomleMaterialViewer;\n\n protected setupGlobals(): void {\n //globals are initialized in bootFinished()\n }\n\n protected setupDependencies(): void {\n RoomleDependencyInjection.setup(INJECTABLES);\n this.lookup<Logger>('logger', this._context);\n }\n\n protected cleanUpGlobals(): void {\n throw new Error('Method not implemented.');\n }\n\n protected cleanUpDependencies(): void {\n throw new Error('Method not implemented.');\n }\n\n protected async bootFinished(): Promise<void> {\n this._viewer = new RoomleMaterialViewer(this._context);\n\n if (!window.RoomleMaterialViewer) {\n window.RoomleMaterialViewer = this._viewer;\n }\n }\n\n public getApi(): RoomleMaterialViewer {\n return this._viewer;\n }\n\n protected getContextName(): string {\n return BASE_CONTEXT.MATERIAL_VIEWER;\n }\n}\n"],"mappings":";;;;;;;AAGA,IAAqB,IAArB,cAA2D,EAAgB;CACzE,IAAW,gBAA2C;AACpD,SAAO,KAAK;;GC2CE,IAAX,yBAAA,GAAA;QACL,EAAA,OAAA,QACA,EAAA,SAAA,UACA,EAAA,iBAAA,kBACA,EAAA,mBAAA;KACD,EAEK,IAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,EACZ,IAArB,cAAwD,EAAa;CA6BnE,YAAY,GAAiB,GAAsB;AAMjD,EALA,MAAM,GAAS,GAAQ,EAAU,KAAK,EAAY,UAAU,sBAZvC,EACrB,MAAM,EAAS,MAChB,yBACyB;GACxB,OAAO;GACP,UAAU;GACV,OAAO;GACP,aAAa;GACb,aAAa;GACd,EAMC,KAAK,6BAA6B,EAElC,KAAK,YAAY;;CAKnB,8BAA4C;AAC1C,MAAI,CAAC,KAAK,WAAW;AAEnB,oBAAiB,KAAK,6BAA6B,EAAE,EAAE;AACvD;;AAIF,MADoB,EAAe,KAAK,UAAU,GAChC,GAAG;GACnB,IAAM,IACJ,EAA0B,gCACxB,MACA,EAAwB,OACzB;AACH,GAAI,KACF,KAAK,wBAAwB,EAAY;;;CAK/C,aAAqB;EACnB,IAAM,IAAW,IAAI,EAAY,EAAK,GAAG,EAAK,GAAG,EAAK,GAAG,KAAK,KAAK,IAAI,EACjE,IAAuB,EAAgB,2BAA2B,EACtE,OAAO,KAAK,UAAU,OAAO,SAC9B,CAAC;AAKF,EAJA,KAAK,aAAa,EAAqB,EACvC,KAAK,QAAQ,IAAI,EAAK,GAAU,KAAK,UAAU,EAC/C,KAAK,MAAM,aAAa,IACxB,KAAK,MAAM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I,EACF,iBACA,GACA,EAAQ,QACT;CACD,IAAI,EACF,+BACA,EACD;CACD,IAAI,EAA8B,eAAe,EAAW;CAC5D,IAAI,EACF,sCACA,GACA,EAAQ,QACT;CACF,ECtBY,IAAb,cAAoC,EAAK;CAGvC,eAA+B;CAI/B,oBAAoC;AAElC,EADA,EAA0B,MAAM,EAAY,EAC5C,KAAK,OAAe,UAAU,KAAK,SAAS;;CAG9C,iBAAiC;AAC/B,QAAU,MAAM,0BAA0B;;CAG5C,sBAAsC;AACpC,QAAU,MAAM,0BAA0B;;CAG5C,MAAgB,eAA8B;AAG5C,EAFA,KAAK,UAAU,IAAI,EAAqB,KAAK,SAAS,EAEjD,OAAO,yBACV,OAAO,uBAAuB,KAAK;;CAIvC,SAAsC;AACpC,SAAO,KAAK;;CAGd,iBAAmC;AACjC,SAAO,EAAa"}
|
|
1
|
+
{"version":3,"file":"material-viewer-BuBSXGw6.mjs","names":[],"sources":["../../packages/common-core/src/cameracontrol/material-viewer-camera-behaviour.ts","../../packages/material-viewer/src/webgl/material-viewer-scene-manager.ts","../../packages/material-viewer/src/roomle-material-viewer.ts","../../packages/material-viewer/src/roomle-material-viewer-ui-callback.ts","../../packages/material-viewer/src/utils/injectables.ts","../../packages/material-viewer/src/material-viewer.ts"],"sourcesContent":["import CameraBehaviour from './camera-behaviour';\nimport type AdjustableCameraControl3D from '../../../glb-viewer-core/src/camera-control/adjustable-camera-control-3d';\n\nexport default class MaterialViewerCameraBehaviour extends CameraBehaviour {\n public get cameraControl(): AdjustableCameraControl3D {\n return this._cameraControl as AdjustableCameraControl3D;\n }\n}\n","import SceneManager from '../../../common-core/src/webgl/scene-manager';\nimport type { GenericGUIParamFolder } from '../../../common-core/src/webgl/gui-types';\nimport type { RoomleWebGPURenderer } from '../../../common-core/src/webgpu/roomle-webgpu-renderer';\nimport type { CanvasOffset } from '../../../common-core/src/common-interfaces';\nimport type InputManager from '../../../common-core/src/input/input-manager';\nimport inject from '../../../common-core/src/di/inject';\nimport CameraControl3D from '../../../common-core/src/cameracontrol/camera-control-3d';\nimport type {\n RapiId,\n RapiMaterial,\n RapiMaterialShading,\n RapiTexture,\n} from '../../../typings/rapi-types';\nimport { RAPI_TEXTURE_TYPE } from '../../../typings/rapi-types';\nimport {\n addExistingTexture,\n addTexture,\n getWebGLGUI,\n getMaterialShading,\n setMaterial,\n getMaxTextures,\n} from '../../../common-core/src/utils/threejs-utils';\nimport { CAMERA_TYPE } from '../../../common-core/src/cameracontrol/camera-type';\nimport type ConfiguratorMeshGenerator from '../../../configurator-core/src/webgl/configurator-mesh-generator';\nimport type RoomleMaterialViewerUiCallback from '../roomle-material-viewer-ui-callback';\nimport BackgroundEnvironment from '../../../common-core/src/environment/background-environment';\nimport FloorEnvironment from '../../../configurator-core/src/webgl/environment/floor-environment';\nimport { type RapiAccess } from '../../../common-core/src/rapi-access';\nimport DynamicLightSettingLoader, {\n PREDEFINED_LIGHTSETTING,\n} from '../../../common-core/src/lightsetting/dynamic-light-setting-loader';\nimport { CANVAS_ID } from '../../../common-core/src/utils/dom-helper';\nimport type { Enumify } from '#/common/src/utils/types';\nimport type { MeshPhysicalMaterial } from 'three';\nimport {\n Box3,\n BoxGeometry,\n Color,\n DoubleSide,\n FrontSide,\n Mesh,\n PlaneGeometry,\n SphereGeometry,\n Texture,\n} from 'three';\nimport MaterialCreator from '../../../common-core/src/utils/material-creator';\nimport MaterialViewerCameraBehaviour from '../../../common-core/src/cameracontrol/material-viewer-camera-behaviour';\n\nexport const enum GEOMETRY {\n CUBE = 'cube',\n SPHERE = 'sphere',\n PLANE_VERTICAL = 'plane_vertical',\n PLANE_HORIZONTAL = 'plane_horizontal',\n}\n\nconst SIZE = { x: 1, y: 1, z: 1 };\nexport default class MaterialViewerSceneManager extends SceneManager {\n @inject\n private _inputManager: InputManager;\n\n @inject\n private _configuratorMeshGenerator: ConfiguratorMeshGenerator;\n\n @inject\n private _roomleMaterialViewerUiCallback: RoomleMaterialViewerUiCallback;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n private _gui: GenericGUIParamFolder | null;\n private _guiGeometryFolder: GenericGUIParamFolder | undefined;\n private _guiMaterialFolder: GenericGUIParamFolder | undefined;\n private _mesh: Mesh;\n private _material: MeshPhysicalMaterial;\n private _sceneParams = {\n type: GEOMETRY.CUBE,\n };\n private _materialParams = {\n color: '#ffffff',\n metallic: 0.5,\n alpha: 0,\n alphaCutoff: 0,\n doubleSided: false,\n };\n\n constructor(creator: string, offset: CanvasOffset) {\n super(creator, offset, CANVAS_ID.RMV, CAMERA_TYPE.CAMERA_3D);\n\n // Use lazy initialization for renderer-dependent settings\n this._initializeRendererSettings();\n\n this._initScene();\n }\n\n // If renderer is not ready yet, will retry on next tick.\n // This is necessary for dynamic WebGPU renderer imports.\n private _initializeRendererSettings(): void {\n if (!this._renderer) {\n // Retry on next tick if renderer not ready\n setTimeout(() => this._initializeRendererSettings(), 0);\n return;\n }\n\n const maxTextures = getMaxTextures(this._renderer);\n if (maxTextures > 8) {\n const lightSource =\n DynamicLightSettingLoader.createDynamicLightSettingSource(\n null,\n PREDEFINED_LIGHTSETTING.CAMERA,\n );\n if (lightSource) {\n this.loadDynamicLightSetting(lightSource);\n }\n }\n }\n\n private _initScene() {\n const geometry = new BoxGeometry(SIZE.x, SIZE.y, SIZE.z, 100, 100, 100);\n const meshPhysicalMaterial = MaterialCreator.createMeshPhysicalMaterial({\n color: this._initData.colors.PRIMARY,\n });\n this._setMaterial(meshPhysicalMaterial);\n this._mesh = new Mesh(geometry, this._material);\n this._mesh.castShadow = true;\n this._mesh.position.setY(SIZE.y / 2);\n this._scene.add(this._mesh);\n\n const { initialFloorMaterial } = this._initData;\n\n if (initialFloorMaterial) {\n this.changeFloorMaterialById(initialFloorMaterial);\n } else {\n this._environment = new BackgroundEnvironment(\n this._scene,\n undefined,\n new Color(0xffffff),\n );\n }\n\n if (this.cameraBehaviour.cameraControl instanceof CameraControl3D) {\n const boundingBox = new Box3();\n boundingBox.setFromObject(this._mesh);\n console.trace('reset camera');\n this.cameraBehaviour.cameraControl.updateAndReset(boundingBox);\n }\n\n void this.showGUI();\n }\n\n public loadMaterialId(materialId: RapiId): Promise<void> {\n return new Promise<void>((resolve) => {\n this._configuratorMeshGenerator\n .loadMaterial(materialId, SIZE.x * 1000, SIZE.y * 1000)\n .then((material) => {\n this._setMaterial(material as MeshPhysicalMaterial);\n this._mesh.material = this._material;\n this._updateGUI();\n this._requestRender();\n resolve();\n });\n });\n }\n\n public loadMaterial(material: RapiMaterial): Promise<void> {\n return new Promise<void>((resolve) => {\n // eslint-disable-next-line\n if (!material.__rapi_path__) {\n // eslint-disable-next-line\n material.__rapi_path__ = 'materials';\n }\n this._mesh.material = this._material;\n this._configuratorMeshGenerator\n .loadTextures(material, this._material, SIZE.x * 100, SIZE.y * 100)\n .then(() => {\n this._updateGUI();\n this._requestRender();\n });\n resolve();\n });\n }\n\n public loadMaterialShading(\n materialShading: RapiMaterialShading,\n ): Promise<void> {\n return new Promise<void>((resolve) => {\n let material = { shading: materialShading };\n this._setMaterial(setMaterial(this._material, material as RapiMaterial));\n this._mesh.material = this._material;\n this._updateGUI();\n this._requestRender();\n resolve();\n });\n }\n\n private _setMaterial(material: MeshPhysicalMaterial) {\n this._material = material;\n this._materialParams.alpha = material.opacity;\n this._materialParams.alphaCutoff = material.alphaTest;\n this._materialParams.color = '#' + material.color.getHexString();\n this._materialParams.doubleSided = material.side === DoubleSide;\n this._materialParams.metallic =\n material.metalness === 1 ? 1 : material.reflectivity;\n }\n\n public getMaterialShading(version: number = 1): RapiMaterialShading {\n return getMaterialShading(this._material, version);\n }\n\n protected createCameraControl(\n _mode: Enumify<typeof CAMERA_TYPE>,\n _offset: CanvasOffset,\n ) {\n this._changeCameraBehaviour(\n new MaterialViewerCameraBehaviour(\n new CameraControl3D(this._creator_, this._getInputManager(), undefined),\n this._cameraBehaviourState,\n ),\n );\n }\n\n protected _getInputManager(): InputManager {\n return this._inputManager;\n }\n\n public sceneChanged(): void {\n //override when needed\n }\n\n public getBounds(): Box3 | null {\n if (!this._mesh) {\n return null;\n }\n return new Box3().setFromObject(this._mesh);\n }\n\n getGeometryBounds(): Box3 | null {\n return null;\n }\n\n protected initializeWebGLGUI() {\n this._gui = getWebGLGUI();\n this._updateGUI();\n }\n\n protected override initializeWebGPUGUI(\n roomleWebGPURenderer: RoomleWebGPURenderer,\n ): void {\n super.initializeWebGPUGUI(roomleWebGPURenderer);\n this._gui =\n roomleWebGPURenderer.getOrCreateGUIParameters('Material Viewer');\n this._updateGUI();\n }\n\n private _updateGUI() {\n const gui = this._gui;\n if (!gui) {\n return;\n }\n if (!this._guiGeometryFolder) {\n this._guiGeometryFolder = gui.addFolder('Geometry');\n this._guiGeometryFolder\n .add(this._sceneParams, 'type', {\n Cube: GEOMETRY.CUBE,\n Sphere: GEOMETRY.SPHERE,\n PlaneVertical: GEOMETRY.PLANE_VERTICAL,\n PlaneHorizontal: GEOMETRY.PLANE_HORIZONTAL,\n })\n .onChange((type: number) => {\n console.log(type);\n this._setGeometry();\n });\n }\n if (this._material) {\n if (!this._guiMaterialFolder) {\n this._guiMaterialFolder = gui.addFolder('Material');\n this._guiMaterialFolder\n .addColor(this._materialParams, 'color')\n .onChange((color: string) => {\n this._material.color = new Color(color);\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'metallic', 0, 1, 0.01)\n .onChange((metallic: number) => {\n this._material.metalness = metallic === 1 ? 1 : 0.5;\n this._material.reflectivity = metallic || 0.5;\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._material, 'roughness', 0, 1, 0.01)\n .onChange((_roughness: number) => {\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._material, 'transmission', 0, 1, 0.01)\n .onChange((transmission: number) => {\n this._material.transmission = transmission;\n if (transmission > 0) {\n this._material.opacity = 1;\n this._material.alphaTest = 0.5;\n this._material.depthWrite = true;\n this._material.metalness = 0;\n }\n this._mesh.castShadow = !this._material.transparent;\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'alpha', 0, 1, 0.01)\n .onChange((alpha: number) => {\n this._material.transparent = alpha < 1;\n this._material.opacity = alpha;\n this._material.depthWrite = alpha >= 1;\n this._mesh.castShadow = !this._material.transparent;\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'alphaCutoff', 0, 1, 0.01)\n .onChange((alphaCutoff: number) => {\n if (alphaCutoff) {\n this._material.alphaTest = alphaCutoff;\n } else {\n this._material.alphaTest = 0;\n }\n this._shadingChanged();\n });\n this._guiMaterialFolder\n .add(this._materialParams, 'doubleSided')\n .onChange((doubleSided: boolean) => {\n if (doubleSided) {\n this._material.side = DoubleSide;\n } else {\n this._material.side = FrontSide;\n }\n this._shadingChanged();\n });\n }\n }\n }\n\n private _shadingChanged() {\n this._roomleMaterialViewerUiCallback.onMaterialShadingChanged(\n getMaterialShading(this._material),\n );\n this._requestRender();\n }\n\n public setGeometry(type: GEOMETRY) {\n this._sceneParams.type = type;\n this._setGeometry();\n }\n\n private _setGeometry() {\n let geometry;\n if (this._sceneParams.type === GEOMETRY.CUBE) {\n geometry = new BoxGeometry(SIZE.x, SIZE.y, SIZE.z, 100, 100, 100);\n } else if (this._sceneParams.type === GEOMETRY.SPHERE) {\n geometry = new SphereGeometry(0.5, 100, 100);\n } else if (this._sceneParams.type === GEOMETRY.PLANE_HORIZONTAL) {\n geometry = new PlaneGeometry(SIZE.x, SIZE.z);\n geometry.rotateX(-Math.PI / 2);\n } else if (this._sceneParams.type === GEOMETRY.PLANE_VERTICAL) {\n geometry = new PlaneGeometry(SIZE.x, SIZE.z);\n } else {\n console.error(\n `MaterialViewerSceneManager: unexpected geometry type \"${this._sceneParams.type}\"`,\n );\n return;\n }\n this._mesh.geometry = geometry;\n this._renderEverything();\n }\n\n public async changeFloorMaterialById(materialId: string): Promise<void> {\n const material = await this._rapiAccess.getMaterial(materialId);\n if (\n !this._environment ||\n !(this._environment instanceof FloorEnvironment)\n ) {\n this._environment = new FloorEnvironment(\n this._scene,\n this._environment,\n !this._initData.webGpu,\n );\n }\n return new Promise((resolve, reject) => {\n (this._environment as FloorEnvironment)\n .changeFloorMaterial(material, this._maxAnisotropy)\n .then(() => {\n this._requestRender();\n resolve();\n }, reject);\n });\n }\n\n public async addTexture(rapiTexture: RapiTexture, base64Image?: string) {\n const width = SIZE.x * 100;\n const height = SIZE.y * 100;\n const repeatWidth =\n width / (rapiTexture.mmWidth === 0 ? 1 : rapiTexture.mmWidth);\n const repeatHeight =\n height / (rapiTexture.mmHeight === 0 ? 1 : rapiTexture.mmHeight);\n const maxTextures = getMaxTextures(this._renderer);\n if (base64Image) {\n const image = new Image();\n image.src = base64Image;\n const texture = new Texture();\n texture.image = image;\n image.onload = function () {\n texture.needsUpdate = true;\n };\n addExistingTexture(\n texture,\n rapiTexture,\n this._material,\n this._maxAnisotropy,\n repeatWidth,\n repeatHeight,\n maxTextures,\n );\n } else {\n await addTexture(\n rapiTexture.image,\n rapiTexture,\n this._material,\n this._maxAnisotropy,\n repeatWidth,\n repeatHeight,\n maxTextures,\n );\n }\n this._requestRender();\n }\n\n public removeTexture(rapiTexture: RapiTexture) {\n if (rapiTexture.mapping === RAPI_TEXTURE_TYPE.ORM) {\n this._material.aoMap = null;\n this._material.roughnessMap = null;\n this._material.metalnessMap = null;\n }\n if (\n rapiTexture.mapping === RAPI_TEXTURE_TYPE.RGB ||\n rapiTexture.mapping === RAPI_TEXTURE_TYPE.RGBA\n ) {\n this._material.map = null;\n }\n if (rapiTexture.mapping === RAPI_TEXTURE_TYPE.XYZ) {\n this._material.normalMap = null;\n }\n this._material.needsUpdate = true;\n this._requestRender();\n }\n\n public clearCache() {\n this._configuratorMeshGenerator.clear();\n }\n}\n","import type ScriptLoader from '../../common-core/src/script-loader';\nimport type DomHelper from '../../common-core/src/utils/dom-helper';\nimport inject from '../../common-core/src/di/inject';\nimport type { ExternalEmbeddable, GlobalAPI } from '../../common-core/src/main';\nimport type { Main } from '../../common-core/src/main';\nimport type { Context } from '../../common-core/src/di/context';\nimport type { LifeCycleManager } from '../../common-core/src/life-cycle-manager';\nimport type { SceneSettings } from '../../common-core/src/scene-settings-loader';\nimport type { GEOMETRY } from './webgl/material-viewer-scene-manager';\nimport MaterialViewerSceneManager from './webgl/material-viewer-scene-manager';\nimport type {\n RapiId,\n RapiMaterial,\n RapiMaterialShading,\n RapiTexture,\n} from '../../typings/rapi-types';\nimport type RoomleMaterialViewerUiCallback from './roomle-material-viewer-ui-callback';\nimport type { InitDataDefinition } from '../../common-core/src/utils/shims';\nimport type InitData from '../../common-core/src/utils/init-data';\nimport { type RapiAccess } from '../../common-core/src/rapi-access';\nimport type { CanvasOffset } from '../../common-core/src/common-interfaces';\nimport type UnitFormatter from '../../configurator-core/src/services/unit-formatter';\nimport type { Scene } from 'three';\nimport { type IdbManager } from '../../common-core/src/services/idb-manager';\nimport type { GlobalCallback } from '../../common-core/src/services/global-callback';\n\nexport default class RoomleMaterialViewer\n implements\n GlobalAPI,\n Context,\n ExternalEmbeddable<RoomleMaterialViewerUiCallback>\n{\n public _creator_: string;\n\n @inject\n private _domHelper: DomHelper;\n\n @inject\n private _scriptLoader: ScriptLoader;\n\n @inject\n private _lifeCycleManager: LifeCycleManager;\n\n @inject\n private _roomleMaterialViewerUiCallback: RoomleMaterialViewerUiCallback;\n\n @inject\n private _initData: InitData;\n\n @inject\n private _globalCallback: GlobalCallback;\n\n @inject\n private _rapiAccess: RapiAccess;\n\n @inject\n private _unitFormatter: UnitFormatter;\n\n @inject\n protected _idbManager: IdbManager;\n\n private _sceneManager: MaterialViewerSceneManager;\n\n constructor(creator: string) {\n this._creator_ = creator;\n }\n\n public setCameraOffset(offset: CanvasOffset): void {\n this._sceneManager.setCameraOffset(offset);\n }\n\n public getCameraOffset(): CanvasOffset {\n return this._sceneManager.getCameraOffset();\n }\n\n public init(element: HTMLElement): Promise<void> {\n this._domHelper.setDomElement(element);\n\n if (this._sceneManager) {\n this._lifeCycleManager.resume();\n return Promise.resolve();\n }\n\n return new Promise<void>(this._initPromiseCallback.bind(this));\n }\n\n private _initPromiseCallback(resolve: () => void, _reject: () => void) {\n this._sceneManager = new MaterialViewerSceneManager(this._creator_, {\n left: 0,\n top: 1,\n right: 1,\n bottom: 0,\n });\n this._sceneManager.enableHD();\n resolve();\n }\n\n get callbacks(): RoomleMaterialViewerUiCallback {\n return this._roomleMaterialViewerUiCallback;\n }\n\n set callbacks(callback: RoomleMaterialViewerUiCallback) {\n this._roomleMaterialViewerUiCallback = callback;\n }\n\n public loadMaterialShading(\n materialShading: RapiMaterialShading,\n ): Promise<void> {\n return this._sceneManager.loadMaterialShading(materialShading);\n }\n\n public loadMaterial(\n material: RapiMaterial,\n options: { flushCache?: boolean } = {},\n ): Promise<void> {\n if (options.flushCache) {\n this._clearCaches();\n }\n return this._sceneManager.loadMaterial(material);\n }\n\n public loadMaterialId(\n materialId: RapiId,\n options: { flushCache?: boolean } = {},\n ): Promise<void> {\n if (options.flushCache) {\n this._clearCaches();\n }\n return this._sceneManager.loadMaterialId(materialId);\n }\n\n public getMaterialShading(version: number = 1): RapiMaterialShading {\n return this._sceneManager.getMaterialShading(version);\n }\n\n /**\n * Loads a SceneSettings object, currently it can can contain a light setting definition\n * (see {@link @roomle/web-sdk/configurator-core/src/roomle-configurator#RoomleConfigurator.loadDynamicLightSetting}) and an environment definition (see {@link @roomle/web-sdk/configurator-core/src/environment/dynamic-environment-setting-loader#EnvironmentSetting}).\n * @param sceneSettings\n */\n public loadSceneSetting(sceneSettings: SceneSettings): Promise<void> {\n return this._sceneManager.loadSceneSettings(sceneSettings);\n }\n\n public setOverrides(initData: InitDataDefinition): void {\n if (!initData) {\n return;\n }\n this._initData.setOverrides(initData);\n }\n\n public updateSize(): void {\n this._sceneManager.updateCamera();\n }\n\n /**\n * Return the main class which has access to lifecycle events and RapiAccess.\n * Hidden because it's only useful for embedding API.\n * Has to be overridden by main class.\n * @hidden\n */\n public getMain(): Main | undefined {\n return undefined;\n }\n\n public resumeTest(element: HTMLElement) {\n this._domHelper.setDomElement(element);\n this._lifeCycleManager.resume();\n }\n\n public pauseTest() {\n this._lifeCycleManager.pause();\n }\n\n public showGUI() {\n this._sceneManager.showGUI();\n }\n\n /**\n * Sets the material of the floor to the given material id.\n * If the current environment is not floor environment it will be changed\n *\n * Example material ids are:\n * roomle_floor:DresdenEiche\n * roomle_floor:Ibiza\n * roomle_floor:Palma\n * roomle_floor:Elba\n * roomle_floor:Manacor\n * roomle_floor:KernEiche\n * roomle_floor:KieferScandic\n * roomle_floor:EicheHabsburg\n * roomle_floor:FuldaKiefer\n * roomle_floor:Ashton\n * roomle_floor:EicheLondon\n *\n * @param materialId\n * @returns promise that resolves when material has been changed\n */\n public async changeFloorMaterialById(materialId: string): Promise<void> {\n return this._sceneManager.changeFloorMaterialById(materialId);\n }\n\n /**\n * Set the geometry of the demo material mesh\n *\n * Possible parameter:\n * 'cube',\n * 'sphere',\n * 'plane_vertical',\n * 'plane_horizontal'\n *\n * @param type\n */\n public setGeometry(type: GEOMETRY) {\n this._sceneManager.setGeometry(type);\n }\n\n /**\n * Set a texture on the demo material, if no base64Image is set, the image field of rapiTexture is used\n * @param rapiTexture\n * @param base64Image for example \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPj/HwADBwIAMCbHYQAAAABJRU5ErkJggg==\"\n */\n public async addTexture(rapiTexture: RapiTexture, base64Image?: string) {\n return this._sceneManager.addTexture(rapiTexture, base64Image);\n }\n\n /**\n * Remove texture from the demo material\n * @param rapiTexture\n */\n public removeTexture(rapiTexture: RapiTexture) {\n return this._sceneManager.removeTexture(rapiTexture);\n }\n\n private _clearCaches() {\n this._rapiAccess.cleanUp();\n this._sceneManager.clearCache();\n }\n\n public getScene(): Scene {\n return this._sceneManager.getScene();\n }\n\n public updateScene(): void {\n this._sceneManager.updateScene();\n }\n\n /**\n * returns unit formatter for formatting input und output values in scene\n */\n public getUnitFormatter(): UnitFormatter {\n return this._unitFormatter;\n }\n\n /**\n * returns manager class to interface with indexedDB storage\n */\n public getStorage(): IdbManager {\n return this._idbManager;\n }\n\n public setEnvironmentMap(params: {\n url?: string;\n intensity?: number;\n rotation?: number;\n maxLightSources?: number;\n }): void {\n const { url, intensity, rotation, maxLightSources } = params;\n this._sceneManager.setEnvironmentMap(\n url,\n intensity,\n rotation,\n maxLightSources,\n );\n }\n\n /**\n * @internal\n * Use this callbacks to hook in your functionality\n */\n public get globalCallbacks(): GlobalCallback {\n return this._globalCallback;\n }\n}\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { UiCallback } from '../../common-core/src/utils/ui-callback';\nimport type { RapiMaterialShading } from '../../typings/rapi-types';\n\nexport default class RoomleMaterialViewerUiCallback extends UiCallback {\n constructor(creator: string) {\n super(creator);\n }\n\n /**\n * Gets called when a material parameter has been changed using the graphical user interface\n * @param materialShading\n */\n public onMaterialShadingChanged = (\n materialShading: RapiMaterialShading,\n ): void => undefined;\n}\n","import Logger from '../../../common-core/src/logger';\nimport ScriptLoader from '../../../common-core/src/script-loader';\nimport {\n DependencyInjectionAssignment,\n DI_TYPE,\n} from '../../../common-core/src/di/container';\nimport InputManager from '../../../common-core/src/input/input-manager';\nimport ConfiguratorMeshGenerator from '../../../configurator-core/src/webgl/configurator-mesh-generator';\nimport { RapiAccess } from '../../../common-core/src/rapi-access';\nimport RoomleMaterialViewerUiCallback from '../roomle-material-viewer-ui-callback';\n\nexport const INJECTABLES: DependencyInjectionAssignment[] = [\n new DependencyInjectionAssignment('script-loader', ScriptLoader),\n new DependencyInjectionAssignment('logger', Logger),\n new DependencyInjectionAssignment(\n 'input-manager',\n InputManager,\n DI_TYPE.CONTEXT,\n ),\n new DependencyInjectionAssignment(\n 'configurator-mesh-generator',\n ConfiguratorMeshGenerator,\n ),\n new DependencyInjectionAssignment('rapi-access', RapiAccess),\n new DependencyInjectionAssignment(\n 'roomle-material-viewer-ui-callback',\n RoomleMaterialViewerUiCallback,\n DI_TYPE.CONTEXT,\n ),\n];\n","import './utils/global-definitions';\nimport { Main, BASE_CONTEXT } from '../../common-core/src/main';\nimport type Logger from '../../common-core/src/logger';\nimport RoomleDependencyInjection from '../../common-core/src/di/roomle-dependency-injection';\nimport RoomleMaterialViewer from './roomle-material-viewer';\nimport { INJECTABLES } from './utils/injectables';\n\nexport class MaterialViewer extends Main {\n private _viewer: RoomleMaterialViewer;\n\n protected setupGlobals(): void {\n //globals are initialized in bootFinished()\n }\n\n protected setupDependencies(): void {\n RoomleDependencyInjection.setup(INJECTABLES);\n this.lookup<Logger>('logger', this._context);\n }\n\n protected cleanUpGlobals(): void {\n throw new Error('Method not implemented.');\n }\n\n protected cleanUpDependencies(): void {\n throw new Error('Method not implemented.');\n }\n\n protected async bootFinished(): Promise<void> {\n this._viewer = new RoomleMaterialViewer(this._context);\n\n if (!window.RoomleMaterialViewer) {\n window.RoomleMaterialViewer = this._viewer;\n }\n }\n\n public getApi(): RoomleMaterialViewer {\n return this._viewer;\n }\n\n protected getContextName(): string {\n return BASE_CONTEXT.MATERIAL_VIEWER;\n }\n}\n"],"mappings":";;;;;;;AAGA,IAAqB,IAArB,cAA2D,EAAgB;CACzE,IAAW,gBAA2C;AACpD,SAAO,KAAK;;GC2CE,IAAX,yBAAA,GAAA;QACL,EAAA,OAAA,QACA,EAAA,SAAA,UACA,EAAA,iBAAA,kBACA,EAAA,mBAAA;KACD,EAEK,IAAO;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,EACZ,IAArB,cAAwD,EAAa;CA6BnE,YAAY,GAAiB,GAAsB;AAMjD,EALA,MAAM,GAAS,GAAQ,EAAU,KAAK,EAAY,UAAU,sBAZvC,EACrB,MAAM,EAAS,MAChB,yBACyB;GACxB,OAAO;GACP,UAAU;GACV,OAAO;GACP,aAAa;GACb,aAAa;GACd,EAMC,KAAK,6BAA6B,EAElC,KAAK,YAAY;;CAKnB,8BAA4C;AAC1C,MAAI,CAAC,KAAK,WAAW;AAEnB,oBA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EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,kBAAA,KAAA,EAAA,KAGA,GAAA,EAAA,eAAA,OAAA,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA;;;ACrDH,IAAqB,IAArB,cAA4D,EAAW;CACrE,YAAY,GAAiB;EAC3B,MAAM,EAAQ,mCAQd,MACS,KAAA;;GCLA,IAA+C;CAC1D,IAAI,EAA8B,iBAAiB,EAAa;CAChE,IAAI,EAA8B,UAAU,EAAO;CACnD,IAAI,EACF,iBACA,GACA,EAAQ,QACT;CACD,IAAI,EACF,+BACA,EACD;CACD,IAAI,EAA8B,eAAe,EAAW;CAC5D,IAAI,EACF,sCACA,GACA,EAAQ,QACT;CACF,ECtBY,IAAb,cAAoC,EAAK;CAGvC,eAA+B;CAI/B,oBAAoC;AAElC,EADA,EAA0B,MAAM,EAAY,EAC5C,KAAK,OAAe,UAAU,KAAK,SAAS;;CAG9C,iBAAiC;AAC/B,QAAU,MAAM,0BAA0B;;CAG5C,sBAAsC;AACpC,QAAU,MAAM,0BAA0B;;CAG5C,MAAgB,eAA8B;AAG5C,EAFA,KAAK,UAAU,IAAI,EAAqB,KAAK,SAAS,EAEjD,OAAO,yBACV,OAAO,uBAAuB,KAAK;;CAIvC,SAAsC;AACpC,SAAO,KAAK;;CAGd,iBAAmC;AACjC,SAAO,EAAa"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./roomle-sdk-
|
|
2
|
-
import "./configurator-
|
|
3
|
-
import "./planner-
|
|
4
|
-
import "./glb-viewer-
|
|
1
|
+
import "./roomle-sdk-CcNdTp_n.mjs";
|
|
2
|
+
import "./configurator-iYlO_buA.mjs";
|
|
3
|
+
import "./planner-BuBkFbra.mjs";
|
|
4
|
+
import "./glb-viewer-AGV-_xKd.mjs";
|
|
5
5
|
//#region ../common/src/utils/id-inferrer.ts
|
|
6
6
|
var e = (e) => e.split(":").length - 1 == 1, t = (e) => e.split(":").length - 1 <= 0, n = (e) => e ? e.startsWith("component@") : !1, r = (e) => e.startsWith("{") && e.endsWith("}"), i = (e) => e.startsWith("ps_");
|
|
7
7
|
//#endregion
|
|
8
8
|
export { i as a, e as i, r as n, t as r, n as t };
|
|
9
9
|
|
|
10
|
-
//# sourceMappingURL=packages-
|
|
10
|
+
//# sourceMappingURL=packages-CduZDHYG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packages-
|
|
1
|
+
{"version":3,"file":"packages-CduZDHYG.mjs","names":[],"sources":["../../../common/src/utils/id-inferrer.ts"],"sourcesContent":["import type { RapiId, RapiPlanSnapshotId } from '@roomle/web-sdk';\n\nexport const isIdAnItem = (id: string) => id.split(':').length - 1 === 1;\n\nexport const isIdAPlan = (id: string) => id.split(':').length - 1 <= 0;\n\nexport const isIdAComponent = (id: string) =>\n id ? id.startsWith('component@') : false;\n\nexport const isIdAConfigurationString = (id: string) =>\n id.startsWith('{') && id.endsWith('}');\n\nexport const isPlanSnapshotId = (\n id: string | RapiId,\n): id is RapiPlanSnapshotId => id.startsWith('ps_');\n"],"mappings":";;;;;AAEA,IAAa,KAAc,MAAe,EAAG,MAAM,IAAI,CAAC,SAAS,KAAM,GAE1D,KAAa,MAAe,EAAG,MAAM,IAAI,CAAC,SAAS,KAAK,GAExD,KAAkB,MAC7B,IAAK,EAAG,WAAW,aAAa,GAAG,IAExB,KAA4B,MACvC,EAAG,WAAW,IAAI,IAAI,EAAG,SAAS,IAAI,EAE3B,KACX,MAC6B,EAAG,WAAW,MAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as e, C as t, H as n, I as r, V as i, Z as a, c as o, ct as s, ft as c, n as l, ot as u, st as d, tt as f, u as p, w as m } from "./roomle-sdk-
|
|
2
|
-
import { t as h } from "./script-loader-
|
|
1
|
+
import { A as e, C as t, H as n, I as r, V as i, Z as a, c as o, ct as s, ft as c, n as l, ot as u, st as d, tt as f, u as p, w as m } from "./roomle-sdk-CcNdTp_n.mjs";
|
|
2
|
+
import { t as h } from "./script-loader-D6i0wQ_j.mjs";
|
|
3
3
|
//#region packages/planner-core/src/input/planner-input-manager.ts
|
|
4
4
|
var g = class extends r {
|
|
5
5
|
_canDrag(e) {
|
|
@@ -41,4 +41,4 @@ var g = class extends r {
|
|
|
41
41
|
//#endregion
|
|
42
42
|
export { v as t };
|
|
43
43
|
|
|
44
|
-
//# sourceMappingURL=planner-
|
|
44
|
+
//# sourceMappingURL=planner-BuBkFbra.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-
|
|
1
|
+
{"version":3,"file":"planner-BuBkFbra.mjs","names":[],"sources":["../../packages/planner-core/src/input/planner-input-manager.ts","../../packages/planner-core/src/utils/injectables.ts","../../packages/planner-core/src/planner.ts"],"sourcesContent":["import type { INPUT_EVENT_TYPE } from '../../../common-core/src/input/input-manager';\nimport InputManager from '../../../common-core/src/input/input-manager';\n\nexport default class PlannerInputManager extends InputManager {\n protected _canDrag(_type: INPUT_EVENT_TYPE): boolean {\n return true;\n }\n}\n","import ScriptLoader from '../../../common-core/src/script-loader';\nimport {\n DependencyInjectionAssignment,\n DI_TYPE,\n} from '../../../common-core/src/di/container';\nimport Logger from '../../../common-core/src/logger';\nimport { default as PlannerMeshGenerator } from '../webgl/planner-mesh-generator';\nimport { RapiAccess } from '../../../common-core/src/rapi-access';\nimport PlannerInputManager from '../input/planner-input-manager';\nimport PlannerSelectionHandler from './planner-selection-handler';\nimport GlobalInitData from '../../../common-core/src/utils/global-init-data';\nimport ConfiguratorViewModel from '../../../common-core/src/view-model/configurator-view-model';\n\nexport const INJECTABLES: DependencyInjectionAssignment[] = [\n new DependencyInjectionAssignment('script-loader', ScriptLoader),\n new DependencyInjectionAssignment(\n 'planner-input-manager',\n PlannerInputManager,\n DI_TYPE.CONTEXT,\n ),\n new DependencyInjectionAssignment('logger', Logger),\n new DependencyInjectionAssignment(\n 'planner-mesh-generator',\n PlannerMeshGenerator,\n ),\n new DependencyInjectionAssignment(\n 'configurator-view-model',\n ConfiguratorViewModel,\n DI_TYPE.CONTEXT,\n ),\n new DependencyInjectionAssignment('rapi-access', RapiAccess),\n new DependencyInjectionAssignment('global-init-data', GlobalInitData),\n new DependencyInjectionAssignment(\n 'planner-selection-handler',\n PlannerSelectionHandler,\n ),\n];\n","import './utils/global-definitions';\nimport { Main, BASE_CONTEXT } from '../../common-core/src/main';\nimport { RoomlePlanner } from './roomle-planner';\nimport RoomleDependencyInjection from '../../common-core/src/di/roomle-dependency-injection';\nimport { INJECTABLES } from './utils/injectables';\nimport type PlannerKernelAccess from './services/planner-kernel-access';\nimport type Logger from '../../common-core/src/logger';\nimport { KERNEL_TYPE } from '../../common-core/src/services/common-kernel-access';\nimport type { PluginName } from '../../configurator-core/src/utils/plugin-types';\nimport type InitData from '../../common-core/src/utils/init-data';\nimport { isInIframe } from '../../common-core/src/utils/rapi-utils';\n\nexport class Planner<\n P extends readonly PluginName[] = readonly [],\n> extends Main {\n private _planner: RoomlePlanner<P>;\n private _activePlugins: P;\n\n constructor(creator?: string, activePlugins?: P) {\n super(creator);\n this._activePlugins = (activePlugins || []) as P;\n }\n protected setupGlobals(): void {\n //globals are initialized in bootFinished()\n }\n\n protected setupDependencies(): void {\n RoomleDependencyInjection.setup(INJECTABLES);\n this.lookup<Logger>('logger', this._context);\n // instantiate kernel acccess\n // instantiate pka\n // set pka on kernel access\n const plannerKernelAccess = this.lookup<PlannerKernelAccess>(\n 'planner-kernel-access',\n this._context,\n );\n plannerKernelAccess.init(KERNEL_TYPE.PLANNER);\n }\n\n protected cleanUpGlobals(): void {\n throw new Error('Method not implemented.');\n }\n\n protected cleanUpDependencies(): void {\n throw new Error('Method not implemented.');\n }\n\n protected async bootFinished(): Promise<void> {\n this._planner = new RoomlePlanner<P>(this._context, this._activePlugins);\n\n this._planner.getMain = () => {\n return this;\n };\n\n if (!window.RoomlePlanner) {\n if (this._activePlugins.length === 0) {\n // cast to unknown because we know that the planner is a RoomlePlanner\n window.RoomlePlanner = this._planner as unknown as RoomlePlanner;\n } else {\n window.RoomlePlanner = this._planner as RoomlePlanner<\n readonly PluginName[]\n >;\n }\n }\n\n const initData = this.lookup<InitData>('init-data', this._context);\n\n if (initData?.hi && isInIframe()) {\n await this._planner.setupHomagIntelligence();\n }\n }\n\n public getApi(): RoomlePlanner<P> {\n return this._planner;\n }\n\n protected getContextName(): string {\n return BASE_CONTEXT.PLANNER;\n }\n}\n"],"mappings":";;;AAGA,IAAqB,IAArB,cAAiD,EAAa;CAC5D,SAAmB,GAAkC;AACnD,SAAO;;GCQE,IAA+C;CAC1D,IAAI,EAA8B,iBAAiB,EAAa;CAChE,IAAI,EACF,yBACA,GACA,EAAQ,QACT;CACD,IAAI,EAA8B,UAAU,EAAO;CACnD,IAAI,EACF,0BACA,EACD;CACD,IAAI,EACF,2BACA,GACA,EAAQ,QACT;CACD,IAAI,EAA8B,eAAe,EAAW;CAC5D,IAAI,EAA8B,oBAAoB,EAAe;CACrE,IAAI,EACF,6BACA,EACD;CACF,ECxBY,IAAb,cAEU,EAAK;CAIb,YAAY,GAAkB,GAAmB;AAE/C,EADA,MAAM,EAAQ,EACd,KAAK,iBAAkB,KAAiB,EAAE;;CAE5C,eAA+B;CAI/B,oBAAoC;AAMN,EAL5B,EAA0B,MAAM,EAAY,EAC5C,KAAK,OAAe,UAAU,KAAK,SAAS,EAIhB,KAAK,OAC/B,yBACA,KAAK,SACN,CACmB,KAAK,EAAY,QAAQ;;CAG/C,iBAAiC;AAC/B,QAAU,MAAM,0BAA0B;;CAG5C,sBAAsC;AACpC,QAAU,MAAM,0BAA0B;;CAG5C,MAAgB,eAA8B;AAoB5C,EAnBA,KAAK,WAAW,IAAI,EAAiB,KAAK,UAAU,KAAK,eAAe,EAExE,KAAK,SAAS,gBACL,MAGJ,OAAO,kBACN,KAAK,eAAe,QAEtB,OAAO,gBAAgB,KAAK,WAQf,KAAK,OAAiB,aAAa,KAAK,SAAS,EAEpD,MAAM,GAAY,IAC9B,MAAM,KAAK,SAAS,wBAAwB;;CAIhD,SAAkC;AAChC,SAAO,KAAK;;CAGd,iBAAmC;AACjC,SAAO,EAAa"}
|
|
@@ -20,7 +20,7 @@ var r = class {
|
|
|
20
20
|
async init(e, t, n) {
|
|
21
21
|
this._scene = e, this._uiScene = t, this._cameraPosition = n;
|
|
22
22
|
let { bananaForScale: r } = this._initData;
|
|
23
|
-
r && await import("./banana-for-scale-
|
|
23
|
+
r && await import("./banana-for-scale-Cf41yXTl.mjs").then(({ default: e }) => this._plugins.push(new e(this._creator_))), this._plugins.forEach((e) => e.setScene(this._scene)), this._plugins.forEach((e) => e.setUiScene(this._uiScene)), this._plugins.forEach((e) => e.updateBounds(this._bounds)), this._plugins.forEach((e) => e.moveCameraEnd(this._cameraPosition));
|
|
24
24
|
}
|
|
25
25
|
addPlugin(e) {
|
|
26
26
|
this._plugins.push(e), e.setScene(this._scene), e.setUiScene(this._uiScene), e.updateBounds(this._bounds), e.moveCameraEnd(this._cameraPosition);
|
|
@@ -52,4 +52,4 @@ n([t, e("design:type", Object)], i.prototype, "_initData", void 0);
|
|
|
52
52
|
//#endregion
|
|
53
53
|
export { r as n, i as t };
|
|
54
54
|
|
|
55
|
-
//# sourceMappingURL=plugin-system-
|
|
55
|
+
//# sourceMappingURL=plugin-system-CPf99Zkf.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-system-
|
|
1
|
+
{"version":3,"file":"plugin-system-CPf99Zkf.mjs","names":[],"sources":["../../packages/configurator-core/src/webgl/plugin-system.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type { Context } from '../../../common-core/src/di/context';\nimport inject from '../../../common-core/src/di/inject';\nimport type InitData from '../../../common-core/src/utils/init-data';\nimport type { Box3, Scene, Vector3 } from 'three';\n\nexport declare interface ScenePluginHooks {\n updateBounds(bounds: Box3): void;\n\n clearScene(scene: Scene, uiScene: Scene): void;\n\n moveCameraEnd(position: Vector3): void;\n\n moveCameraStart(position: Vector3): void;\n\n needsUiScene(): boolean;\n}\n\nexport declare interface ScenePlugin extends ScenePluginHooks, Context {\n setScene(scene: Scene): void;\n\n setUiScene(uiScene: Scene): void;\n}\n\nexport class ScenePluginDefaultImplementation implements ScenePlugin {\n public _creator_: string;\n\n constructor(creator: string) {\n this._creator_ = creator;\n }\n\n public setScene(scene: Scene): void {\n //noop\n }\n\n public setUiScene(uiScene: Scene): void {\n //noop\n }\n\n public updateBounds(bounds: Box3): void {\n //noop\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n //noop\n }\n\n public moveCameraEnd(position: Vector3): void {\n //noop\n }\n\n public moveCameraStart(position: Vector3): void {\n //noop\n }\n\n public needsUiScene(): boolean {\n return false;\n }\n}\n\nexport default class PluginSystem implements Context, ScenePluginHooks {\n public _creator_: string;\n\n @inject\n private _initData: InitData;\n\n private _scene: Scene;\n private _uiScene: Scene;\n private _bounds: Box3;\n private _cameraPosition: Vector3;\n\n private _plugins: ScenePlugin[] = [];\n\n constructor(creator: string) {\n this._creator_ = creator;\n }\n\n public async init(scene: Scene, uiScene: Scene, cameraPosition: Vector3) {\n this._scene = scene;\n this._uiScene = uiScene;\n this._cameraPosition = cameraPosition;\n const { bananaForScale } = this._initData;\n\n if (bananaForScale) {\n await import('./banana-for-scale').then(({ default: BananaForScale }) =>\n this._plugins.push(new BananaForScale(this._creator_)),\n );\n }\n\n this._plugins.forEach((plugin) => plugin.setScene(this._scene));\n this._plugins.forEach((plugin) => plugin.setUiScene(this._uiScene));\n this._plugins.forEach((plugin) => plugin.updateBounds(this._bounds));\n this._plugins.forEach((plugin) =>\n plugin.moveCameraEnd(this._cameraPosition),\n );\n }\n\n public addPlugin(plugin: ScenePlugin) {\n this._plugins.push(plugin);\n plugin.setScene(this._scene);\n plugin.setUiScene(this._uiScene);\n plugin.updateBounds(this._bounds);\n plugin.moveCameraEnd(this._cameraPosition);\n }\n\n public updateBounds(bounds: Box3) {\n this._bounds = bounds;\n this._plugins.forEach((plugin) => plugin.updateBounds(bounds));\n }\n\n public clearScene(scene: Scene, uiScene: Scene): void {\n this._plugins.forEach((plugin) => plugin.clearScene(scene, uiScene));\n }\n\n public getActivePlugins(): ScenePlugin[] {\n return this._plugins;\n }\n\n public getPlugin<T extends ScenePlugin>(type: any): T | null {\n for (let plugin of this._plugins) {\n if (plugin instanceof type) {\n return plugin as T;\n }\n }\n return null;\n }\n\n public moveCameraEnd(position: Vector3): void {\n this._cameraPosition = position;\n this._plugins.forEach((plugin) => plugin.moveCameraEnd(position));\n }\n\n public moveCameraStart(position: Vector3): void {\n this._cameraPosition = position;\n this._plugins.forEach((plugin) => plugin.moveCameraStart(position));\n }\n\n public needsUiScene(): boolean {\n return this._plugins\n .map((plugin) => plugin.needsUiScene())\n .reduce(\n (previousValue, currentValue) => previousValue || currentValue,\n false,\n );\n }\n}\n"],"mappings":";;AAwBA,IAAa,IAAb,MAAqE;CAGnE,YAAY,GAAiB;AAC3B,OAAK,YAAY;;CAGnB,SAAgB,GAAoB;CAIpC,WAAkB,GAAsB;CAIxC,aAAoB,GAAoB;CAIxC,WAAkB,GAAc,GAAsB;CAItD,cAAqB,GAAyB;CAI9C,gBAAuB,GAAyB;CAIhD,eAA+B;AAC7B,SAAO;;GAIU,IAArB,MAAuE;CAarE,YAAY,GAAiB;AAC3B,kBAHgC,EAAE,EAGlC,KAAK,YAAY;;CAGnB,MAAa,KAAK,GAAc,GAAgB,GAAyB;AAGvE,EAFA,KAAK,SAAS,GACd,KAAK,WAAW,GAChB,KAAK,kBAAkB;EACvB,IAAM,EAAE,sBAAmB,KAAK;AAWhC,EATI,KACF,MAAM,OAAO,mCAAsB,MAAM,EAAE,SAAS,QAClD,KAAK,SAAS,KAAK,IAAI,EAAe,KAAK,UA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