@roomle/web-sdk 2.68.0 → 2.69.0
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/{configurator-08346d05.nomodule.js → configurator-65da998a.nomodule.js} +2 -2
- package/lib/configurator-65da998a.nomodule.js.map +1 -0
- package/lib/{configurator-3922f173.js → configurator-666e8c65.js} +2 -2
- package/lib/configurator-666e8c65.js.map +1 -0
- package/lib/{configurator-main-21b35509.js → configurator-main-76aa9a2b.js} +2 -2
- package/lib/configurator-main-76aa9a2b.js.map +1 -0
- package/lib/configurator-main.nomodule.js +1 -1
- package/lib/{default-light-setting-878cb035.nomodule.js → default-light-setting-1793d4c0.nomodule.js} +2 -2
- package/lib/default-light-setting-1793d4c0.nomodule.js.map +1 -0
- package/lib/{default-light-setting-31e78403.js → default-light-setting-d8fe9af7.js} +2 -2
- package/lib/default-light-setting-d8fe9af7.js.map +1 -0
- package/lib/{glb-viewer-290757c7.js → glb-viewer-5d3baff6.js} +2 -2
- package/lib/{glb-viewer-290757c7.js.map → glb-viewer-5d3baff6.js.map} +1 -1
- package/lib/{glb-viewer-1f6be73b.nomodule.js → glb-viewer-933e235f.nomodule.js} +2 -2
- package/lib/{glb-viewer-1f6be73b.nomodule.js.map → glb-viewer-933e235f.nomodule.js.map} +1 -1
- package/lib/glb-viewer-main-43deb727.js +2 -0
- package/lib/glb-viewer-main-43deb727.js.map +1 -0
- package/lib/glb-viewer-main.nomodule.js +1 -1
- package/lib/legacy/{configurator-37993ad1.legacy.js → configurator-5962e900.legacy.js} +2 -2
- package/lib/legacy/configurator-5962e900.legacy.js.map +1 -0
- package/lib/legacy/configurator-main.legacy.js +1 -1
- package/lib/legacy/{default-light-setting-5644c18e.legacy.js → default-light-setting-eb0fe46a.legacy.js} +2 -2
- package/lib/legacy/default-light-setting-eb0fe46a.legacy.js.map +1 -0
- package/lib/legacy/{glb-viewer-c3aa17ef.legacy.js → glb-viewer-0341188a.legacy.js} +2 -2
- package/lib/legacy/{glb-viewer-c3aa17ef.legacy.js.map → glb-viewer-0341188a.legacy.js.map} +1 -1
- package/lib/legacy/glb-viewer-main.legacy.js +1 -1
- package/lib/legacy/{material-viewer-85899665.legacy.js → material-viewer-4498e854.legacy.js} +2 -2
- package/lib/legacy/material-viewer-4498e854.legacy.js.map +1 -0
- package/lib/legacy/material-viewer-main.legacy.js +1 -1
- package/lib/legacy/{planner-e30dc49a.legacy.js → planner-f91ae5b0.legacy.js} +2 -2
- package/lib/legacy/{planner-e30dc49a.legacy.js.map → planner-f91ae5b0.legacy.js.map} +1 -1
- package/lib/legacy/planner-main.legacy.js +1 -1
- package/lib/legacy/{roomle-configurator-7f741003.legacy.js → roomle-configurator-f95108ad.legacy.js} +2 -2
- package/lib/legacy/roomle-configurator-f95108ad.legacy.js.map +1 -0
- package/lib/legacy/roomle-sdk.legacy.js +1 -1
- package/lib/legacy/scene-manager-767189c5.legacy.js +2 -0
- package/lib/legacy/{scene-manager-3c0cc676.legacy.js.map → scene-manager-767189c5.legacy.js.map} +1 -1
- package/lib/{material-viewer-05119752.js → material-viewer-2ed7b3bc.js} +2 -2
- package/lib/material-viewer-2ed7b3bc.js.map +1 -0
- package/lib/{material-viewer-c839854a.nomodule.js → material-viewer-de60ddd4.nomodule.js} +2 -2
- package/lib/material-viewer-de60ddd4.nomodule.js.map +1 -0
- package/lib/material-viewer-main-1fbbe523.js +2 -0
- package/lib/material-viewer-main-1fbbe523.js.map +1 -0
- package/lib/material-viewer-main.nomodule.js +1 -1
- package/lib/{planner-8b61d530.js → planner-4faac98d.js} +2 -2
- package/lib/{planner-8b61d530.js.map → planner-4faac98d.js.map} +1 -1
- package/lib/{planner-4079b46e.nomodule.js → planner-eabbeff8.nomodule.js} +2 -2
- package/lib/{planner-4079b46e.nomodule.js.map → planner-eabbeff8.nomodule.js.map} +1 -1
- package/lib/{planner-main-4ea3855f.js → planner-main-245fcc70.js} +2 -2
- package/lib/planner-main-245fcc70.js.map +1 -0
- package/lib/planner-main.nomodule.js +1 -1
- package/lib/{roomle-configurator-074b69cf.nomodule.js → roomle-configurator-75dbbdbd.nomodule.js} +2 -2
- package/lib/roomle-configurator-75dbbdbd.nomodule.js.map +1 -0
- package/lib/{roomle-configurator-6dd905c3.js → roomle-configurator-d068c7b4.js} +2 -2
- package/lib/roomle-configurator-d068c7b4.js.map +1 -0
- package/lib/{roomle-sdk-455f20bf.js → roomle-sdk-b1e484f0.js} +2 -2
- package/lib/roomle-sdk-b1e484f0.js.map +1 -0
- package/lib/roomle-sdk.nomodule.js +1 -1
- package/lib/scene-manager-17273ebe.js +2 -0
- package/lib/{scene-manager-155c0eb1.js.map → scene-manager-17273ebe.js.map} +1 -1
- package/lib/scene-manager-867ed8ea.nomodule.js +2 -0
- package/lib/{scene-manager-50ad8aa4.nomodule.js.map → scene-manager-867ed8ea.nomodule.js.map} +1 -1
- package/package.json +2 -2
- package/lib/configurator-08346d05.nomodule.js.map +0 -1
- package/lib/configurator-3922f173.js.map +0 -1
- package/lib/configurator-main-21b35509.js.map +0 -1
- package/lib/default-light-setting-31e78403.js.map +0 -1
- package/lib/default-light-setting-878cb035.nomodule.js.map +0 -1
- package/lib/glb-viewer-main-fcdc76bd.js +0 -2
- package/lib/glb-viewer-main-fcdc76bd.js.map +0 -1
- package/lib/legacy/configurator-37993ad1.legacy.js.map +0 -1
- package/lib/legacy/default-light-setting-5644c18e.legacy.js.map +0 -1
- package/lib/legacy/material-viewer-85899665.legacy.js.map +0 -1
- package/lib/legacy/roomle-configurator-7f741003.legacy.js.map +0 -1
- package/lib/legacy/scene-manager-3c0cc676.legacy.js +0 -2
- package/lib/material-viewer-05119752.js.map +0 -1
- package/lib/material-viewer-c839854a.nomodule.js.map +0 -1
- package/lib/material-viewer-main-92206612.js +0 -2
- package/lib/material-viewer-main-92206612.js.map +0 -1
- package/lib/planner-main-4ea3855f.js.map +0 -1
- package/lib/roomle-configurator-074b69cf.nomodule.js.map +0 -1
- package/lib/roomle-configurator-6dd905c3.js.map +0 -1
- package/lib/roomle-sdk-455f20bf.js.map +0 -1
- package/lib/scene-manager-155c0eb1.js +0 -2
- package/lib/scene-manager-50ad8aa4.nomodule.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as ScriptLoader,M as Main}from"./script-loader-ea706d37.js";import{_ as __decorate,i as inject,e as CANVAS_ID,j as DynamicLightSettingLoader,k as PREDEFINED_LIGHTSETTING,M as MaterialCreator,aq as setMaterial,ar as getMaterialShading,O as getGUI,as as addExistingTexture,N as addTexture,at as UiCallback,D as DependencyInjectionAssignment,L as Logger,ao as InputManager,au as ConfiguratorMeshGenerator,R as RapiAccess,b as RoomleDependencyInjection}from"./roomle-dependency-injection-6cc5f1dd.js";import{S as SceneManager,B as BackgroundEnvironment,C as CameraControl3D,F as FloorEnvironment,T as TWEEN_FILE_NAME}from"./scene-manager-155c0eb1.js";import{aE as CAMERA_TYPE,aN as BoxGeometry,z as Mesh,C as Color,ad as Box3,a as Vector3,w as DoubleSide,a7 as FrontSide,a_ as SphereGeometry,bc as PlaneGeometry,a9 as Texture}from"./main-thread-to-worker-307e6096.js";import"./query-params-helper-b54bbbb4.js";class MaterialViewerSceneManager extends SceneManager{constructor(e,a){super(e,a,CANVAS_ID.RMV,CAMERA_TYPE.CAMERA_3D),this._sceneParams={type:"cube"},this._materialParams={color:"#ffffff",metallic:.5,alpha:0,alphaCutoff:0,doubleSided:!1},this._renderer.capabilities.maxTextures>8&&this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)),this._initScene()}_initScene(){const e=new BoxGeometry(1,1,1,100,100,100),a=MaterialCreator.createMeshPhysicalMaterial({color:this._initData.colors.PRIMARY});this._setMaterial(a),this._mesh=new Mesh(e,this._material),this._mesh.castShadow=!0,this._mesh.position.setY(.5),this._scene.add(this._mesh);const{initialFloorMaterial:t}=this._initData;if(t?this.changeFloorMaterialById(t):this._environment=new BackgroundEnvironment(this._scene,null,new Color(16777215)),this._cameraControl instanceof CameraControl3D){const e=new Box3;e.setFromObject(this._mesh),this._cameraControl.updateAndReset(e.getSize(new Vector3),e.getCenter(new Vector3))}this.showGUI()}loadMaterialId(e){return new Promise(a=>{this._configuratorMeshGenerator.loadMaterial(e,1e3,1e3).then(e=>{this._setMaterial(e),this._mesh.material=this._material,this._updateGUI(),this._requestRender(),a()})})}loadMaterial(e){return new Promise(a=>{e.__rapi_path__||(e.__rapi_path__="materials"),this._mesh.material=this._material,this._configuratorMeshGenerator.loadTextures(e,this._material,100,100).then(()=>{this._updateGUI(),this._requestRender()}),a()})}loadMaterialShading(e){return new Promise(a=>{let t={shading:e};this._setMaterial(setMaterial(this._material,t)),this._mesh.material=this._material,this._updateGUI(),this._requestRender(),a()})}_setMaterial(e){this._material=e,this._materialParams.alpha=e.opacity,this._materialParams.alphaCutoff=e.alphaTest,this._materialParams.color="#"+e.color.getHexString(),this._materialParams.doubleSided=e.side===DoubleSide,this._materialParams.metallic=1===e.metalness?1:e.reflectivity}getMaterialShading(e=1){return getMaterialShading(this._material,e)}createCameraControl(e,a){this._cameraControl=new CameraControl3D(this._creator_,this._getInputManager(),new Vector3(-1,1,1))}_getInputManager(){return this._inputManager}sceneChanged(){}getBounds(){return this._mesh?(new Box3).setFromObject(this._mesh):null}_guiLoaded(){this._updateGUI()}_updateGUI(){let e=getGUI();e&&(this._guiGeometryFolder||(this._guiGeometryFolder=e.addFolder("Geometry"),this._guiGeometryFolder.add(this._sceneParams,"type",{Cube:"cube",Sphere:"sphere",PlaneVertical:"plane_vertical",PlaneHorizontal:"plane_horizontal"}).onChange(e=>{this._setGeometry()})),this._material&&(this._guiMaterialFolder&&e.removeFolder(this._guiMaterialFolder),this._guiMaterialFolder=e.addFolder("Material"),this._guiMaterialFolder.addColor(this._materialParams,"color").onChange(e=>{this._material.color=new Color(e),this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"metallic").min(0).max(1).step(.01).onChange(e=>{this._material.metalness=1===e?1:.5,this._material.reflectivity=e||.5,this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"roughness").min(0).max(1).step(.01).onChange(e=>{this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"transmission").min(0).max(1).step(.01).onChange(e=>{this._material.transmission=e,e>0&&(this._material.opacity=1,this._material.alphaTest=.5,this._material.depthWrite=!1,this._material.transparent=!0,this._material.metalness=0),this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alpha").min(0).max(1).step(.01).onChange(e=>{this._material.transparent=e<1,this._material.opacity=e,this._material.depthWrite=e>=1,this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alphaCutoff").min(0).max(1).step(.01).onChange(e=>{this._material.alphaTest=e||0,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"doubleSided").onChange(e=>{this._material.side=e?DoubleSide:FrontSide,this._shadingChanged()})),this._addGUIListener(e))}_shadingChanged(){this._roomleMaterialViewerUiCallback.onMaterialShadingChanged(getMaterialShading(this._material))}setGeometry(e){this._sceneParams.type=e,this._setGeometry()}_setGeometry(){let e;"cube"===this._sceneParams.type&&(e=new BoxGeometry(1,1,1,100,100,100)),"sphere"===this._sceneParams.type&&(e=new SphereGeometry(.5,100,100)),"plane_horizontal"===this._sceneParams.type&&(e=new PlaneGeometry(1,1),e.rotateX(-Math.PI/2)),"plane_vertical"===this._sceneParams.type&&(e=new PlaneGeometry(1,1)),this._mesh.geometry=e,this._renderEverything()}async changeFloorMaterialById(e){const a=await this._rapiAccess.getMaterial(e);return this._environment&&this._environment instanceof FloorEnvironment||(this._environment=new FloorEnvironment(this._scene,this._environment,!0)),new Promise((e,t)=>{this._environment.changeFloorMaterial(a,this._maxAnisotropy).then(()=>{this._requestRender(),e()},t)})}async addTexture(e,a){const t=100/(0===e.mmWidth?1:e.mmWidth),i=100/(0===e.mmHeight?1:e.mmHeight);if(a){const r=new Image;r.src=a;const s=new Texture;s.image=r,r.onload=function(){s.needsUpdate=!0},addExistingTexture(s,e,this._material,this._maxAnisotropy,t,i,this._renderer.capabilities.maxTextures)}else await addTexture(e.image,e,this._material,this._maxAnisotropy,t,i,this._renderer.capabilities.maxTextures);this._requestRender()}removeTexture(e){"ORM"===e.mapping&&(this._material.aoMap=null,this._material.roughnessMap=null,this._material.metalnessMap=null),"RGB"!==e.mapping&&"RGBA"!==e.mapping||(this._material.map=null),"XYZ"===e.mapping&&(this._material.normalMap=null),this._material.needsUpdate=!0,this._requestRender()}clearCache(){this._configuratorMeshGenerator.clear()}}__decorate([inject],MaterialViewerSceneManager.prototype,"_inputManager",void 0),__decorate([inject],MaterialViewerSceneManager.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],MaterialViewerSceneManager.prototype,"_roomleMaterialViewerUiCallback",void 0),__decorate([inject],MaterialViewerSceneManager.prototype,"_rapiAccess",void 0);class RoomleMaterialViewer{constructor(e){this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e){return this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,a){Promise.all([this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})]).then(()=>{this._sceneManager=new MaterialViewerSceneManager(this._creator_,{left:0,top:1,right:1,bottom:0}),this._sceneManager.enableHD(),e()})}get callbacks(){return this._roomleMaterialViewerUiCallback}set callbacks(e){this._roomleMaterialViewerUiCallback=e}loadMaterialShading(e){return this._sceneManager.loadMaterialShading(e)}loadMaterial(e,a={}){return a.flushCache&&this._clearCaches(),this._sceneManager.loadMaterial(e)}loadMaterialId(e,a={}){return a.flushCache&&this._clearCaches(),this._sceneManager.loadMaterialId(e)}getMaterialShading(e=1){return this._sceneManager.getMaterialShading(e)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}setOverrides(e){e&&this._initData.setOverrides(e)}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}async changeFloorMaterialById(e){return this._sceneManager.changeFloorMaterialById(e)}setGeometry(e){this._sceneManager.setGeometry(e)}async addTexture(e,a){return this._sceneManager.addTexture(e,a)}removeTexture(e){return this._sceneManager.removeTexture(e)}_clearCaches(){this._rapiAccess.cleanUp(),this._sceneManager.clearCache()}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getUnitFormatter(){return this._unitFormatter}setEnvironmentMap(e){const{url:a,intensity:t,rotation:i,maxLightSources:r}=e;this._sceneManager.setEnvironmentMap(a,t,i,r)}}__decorate([inject],RoomleMaterialViewer.prototype,"_domHelper",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_scriptLoader",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_lifeCycleManager",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_roomleMaterialViewerUiCallback",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_initData",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_rapiAccess",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_unitFormatter",void 0);const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("input-manager",InputManager,1),new DependencyInjectionAssignment("configurator-mesh-generator",ConfiguratorMeshGenerator),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("roomle-material-viewer-ui-callback",class extends UiCallback{constructor(e){super(e),this.onMaterialShadingChanged=e=>{}}},1)];class MaterialViewer extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new RoomleMaterialViewer(this._context),window.RoomleMaterialViewer||(window.RoomleMaterialViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"material-viewer"}}export{MaterialViewer};
|
|
2
|
-
//# sourceMappingURL=material-viewer-
|
|
1
|
+
import{S as ScriptLoader,M as Main}from"./script-loader-ea706d37.js";import{_ as __decorate,i as inject,e as CANVAS_ID,j as DynamicLightSettingLoader,k as PREDEFINED_LIGHTSETTING,M as MaterialCreator,aq as setMaterial,ar as getMaterialShading,O as getGUI,as as addExistingTexture,N as addTexture,at as UiCallback,D as DependencyInjectionAssignment,L as Logger,ao as InputManager,au as ConfiguratorMeshGenerator,R as RapiAccess,b as RoomleDependencyInjection}from"./roomle-dependency-injection-6cc5f1dd.js";import{S as SceneManager,B as BackgroundEnvironment,C as CameraControl3D,F as FloorEnvironment,T as TWEEN_FILE_NAME}from"./scene-manager-17273ebe.js";import{aE as CAMERA_TYPE,aN as BoxGeometry,z as Mesh,C as Color,ad as Box3,a as Vector3,w as DoubleSide,a7 as FrontSide,a_ as SphereGeometry,bc as PlaneGeometry,a9 as Texture}from"./main-thread-to-worker-307e6096.js";import"./query-params-helper-b54bbbb4.js";class MaterialViewerSceneManager extends SceneManager{constructor(e,a){super(e,a,CANVAS_ID.RMV,CAMERA_TYPE.CAMERA_3D),this._sceneParams={type:"cube"},this._materialParams={color:"#ffffff",metallic:.5,alpha:0,alphaCutoff:0,doubleSided:!1},this._renderer.capabilities.maxTextures>8&&this.loadDynamicLightSetting(DynamicLightSettingLoader.createDynamicLightSettingSource(null,PREDEFINED_LIGHTSETTING.CAMERA)),this._initScene()}_initScene(){const e=new BoxGeometry(1,1,1,100,100,100),a=MaterialCreator.createMeshPhysicalMaterial({color:this._initData.colors.PRIMARY});this._setMaterial(a),this._mesh=new Mesh(e,this._material),this._mesh.castShadow=!0,this._mesh.position.setY(.5),this._scene.add(this._mesh);const{initialFloorMaterial:t}=this._initData;if(t?this.changeFloorMaterialById(t):this._environment=new BackgroundEnvironment(this._scene,null,new Color(16777215)),this._cameraControl instanceof CameraControl3D){const e=new Box3;e.setFromObject(this._mesh),this._cameraControl.updateAndReset(e.getSize(new Vector3),e.getCenter(new Vector3))}this.showGUI()}loadMaterialId(e){return new Promise(a=>{this._configuratorMeshGenerator.loadMaterial(e,1e3,1e3).then(e=>{this._setMaterial(e),this._mesh.material=this._material,this._updateGUI(),this._requestRender(),a()})})}loadMaterial(e){return new Promise(a=>{e.__rapi_path__||(e.__rapi_path__="materials"),this._mesh.material=this._material,this._configuratorMeshGenerator.loadTextures(e,this._material,100,100).then(()=>{this._updateGUI(),this._requestRender()}),a()})}loadMaterialShading(e){return new Promise(a=>{let t={shading:e};this._setMaterial(setMaterial(this._material,t)),this._mesh.material=this._material,this._updateGUI(),this._requestRender(),a()})}_setMaterial(e){this._material=e,this._materialParams.alpha=e.opacity,this._materialParams.alphaCutoff=e.alphaTest,this._materialParams.color="#"+e.color.getHexString(),this._materialParams.doubleSided=e.side===DoubleSide,this._materialParams.metallic=1===e.metalness?1:e.reflectivity}getMaterialShading(e=1){return getMaterialShading(this._material,e)}createCameraControl(e,a){this._cameraControl=new CameraControl3D(this._creator_,this._getInputManager(),new Vector3(-1,1,1))}_getInputManager(){return this._inputManager}sceneChanged(){}getBounds(){return this._mesh?(new Box3).setFromObject(this._mesh):null}_guiLoaded(){this._updateGUI()}_updateGUI(){let e=getGUI();e&&(this._guiGeometryFolder||(this._guiGeometryFolder=e.addFolder("Geometry"),this._guiGeometryFolder.add(this._sceneParams,"type",{Cube:"cube",Sphere:"sphere",PlaneVertical:"plane_vertical",PlaneHorizontal:"plane_horizontal"}).onChange(e=>{this._setGeometry()})),this._material&&(this._guiMaterialFolder&&e.removeFolder(this._guiMaterialFolder),this._guiMaterialFolder=e.addFolder("Material"),this._guiMaterialFolder.addColor(this._materialParams,"color").onChange(e=>{this._material.color=new Color(e),this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"metallic").min(0).max(1).step(.01).onChange(e=>{this._material.metalness=1===e?1:.5,this._material.reflectivity=e||.5,this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"roughness").min(0).max(1).step(.01).onChange(e=>{this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"transmission").min(0).max(1).step(.01).onChange(e=>{this._material.transmission=e,e>0&&(this._material.opacity=1,this._material.alphaTest=.5,this._material.depthWrite=!1,this._material.transparent=!0,this._material.metalness=0),this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alpha").min(0).max(1).step(.01).onChange(e=>{this._material.transparent=e<1,this._material.opacity=e,this._material.depthWrite=e>=1,this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alphaCutoff").min(0).max(1).step(.01).onChange(e=>{this._material.alphaTest=e||0,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"doubleSided").onChange(e=>{this._material.side=e?DoubleSide:FrontSide,this._shadingChanged()})),this._addGUIListener(e))}_shadingChanged(){this._roomleMaterialViewerUiCallback.onMaterialShadingChanged(getMaterialShading(this._material))}setGeometry(e){this._sceneParams.type=e,this._setGeometry()}_setGeometry(){let e;"cube"===this._sceneParams.type&&(e=new BoxGeometry(1,1,1,100,100,100)),"sphere"===this._sceneParams.type&&(e=new SphereGeometry(.5,100,100)),"plane_horizontal"===this._sceneParams.type&&(e=new PlaneGeometry(1,1),e.rotateX(-Math.PI/2)),"plane_vertical"===this._sceneParams.type&&(e=new PlaneGeometry(1,1)),this._mesh.geometry=e,this._renderEverything()}async changeFloorMaterialById(e){const a=await this._rapiAccess.getMaterial(e);return this._environment&&this._environment instanceof FloorEnvironment||(this._environment=new FloorEnvironment(this._scene,this._environment,!0)),new Promise((e,t)=>{this._environment.changeFloorMaterial(a,this._maxAnisotropy).then(()=>{this._requestRender(),e()},t)})}async addTexture(e,a){const t=100/(0===e.mmWidth?1:e.mmWidth),i=100/(0===e.mmHeight?1:e.mmHeight);if(a){const r=new Image;r.src=a;const s=new Texture;s.image=r,r.onload=function(){s.needsUpdate=!0},addExistingTexture(s,e,this._material,this._maxAnisotropy,t,i,this._renderer.capabilities.maxTextures)}else await addTexture(e.image,e,this._material,this._maxAnisotropy,t,i,this._renderer.capabilities.maxTextures);this._requestRender()}removeTexture(e){"ORM"===e.mapping&&(this._material.aoMap=null,this._material.roughnessMap=null,this._material.metalnessMap=null),"RGB"!==e.mapping&&"RGBA"!==e.mapping||(this._material.map=null),"XYZ"===e.mapping&&(this._material.normalMap=null),this._material.needsUpdate=!0,this._requestRender()}clearCache(){this._configuratorMeshGenerator.clear()}}__decorate([inject],MaterialViewerSceneManager.prototype,"_inputManager",void 0),__decorate([inject],MaterialViewerSceneManager.prototype,"_configuratorMeshGenerator",void 0),__decorate([inject],MaterialViewerSceneManager.prototype,"_roomleMaterialViewerUiCallback",void 0),__decorate([inject],MaterialViewerSceneManager.prototype,"_rapiAccess",void 0);class RoomleMaterialViewer{constructor(e){this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e){return this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,a){Promise.all([this._scriptLoader.fetch(TWEEN_FILE_NAME,{id:"tween-js"})]).then(()=>{this._sceneManager=new MaterialViewerSceneManager(this._creator_,{left:0,top:1,right:1,bottom:0}),this._sceneManager.enableHD(),e()})}get callbacks(){return this._roomleMaterialViewerUiCallback}set callbacks(e){this._roomleMaterialViewerUiCallback=e}loadMaterialShading(e){return this._sceneManager.loadMaterialShading(e)}loadMaterial(e,a={}){return a.flushCache&&this._clearCaches(),this._sceneManager.loadMaterial(e)}loadMaterialId(e,a={}){return a.flushCache&&this._clearCaches(),this._sceneManager.loadMaterialId(e)}getMaterialShading(e=1){return this._sceneManager.getMaterialShading(e)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}setOverrides(e){e&&this._initData.setOverrides(e)}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}async changeFloorMaterialById(e){return this._sceneManager.changeFloorMaterialById(e)}setGeometry(e){this._sceneManager.setGeometry(e)}async addTexture(e,a){return this._sceneManager.addTexture(e,a)}removeTexture(e){return this._sceneManager.removeTexture(e)}_clearCaches(){this._rapiAccess.cleanUp(),this._sceneManager.clearCache()}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getUnitFormatter(){return this._unitFormatter}setEnvironmentMap(e){const{url:a,intensity:t,rotation:i,maxLightSources:r}=e;this._sceneManager.setEnvironmentMap(a,t,i,r)}}__decorate([inject],RoomleMaterialViewer.prototype,"_domHelper",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_scriptLoader",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_lifeCycleManager",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_roomleMaterialViewerUiCallback",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_initData",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_rapiAccess",void 0),__decorate([inject],RoomleMaterialViewer.prototype,"_unitFormatter",void 0);const INJECTABLES=[new DependencyInjectionAssignment("script-loader",ScriptLoader),new DependencyInjectionAssignment("logger",Logger),new DependencyInjectionAssignment("input-manager",InputManager,1),new DependencyInjectionAssignment("configurator-mesh-generator",ConfiguratorMeshGenerator),new DependencyInjectionAssignment("rapi-access",RapiAccess),new DependencyInjectionAssignment("roomle-material-viewer-ui-callback",class extends UiCallback{constructor(e){super(e),this.onMaterialShadingChanged=e=>{}}},1)];class MaterialViewer extends Main{setupGlobals(){}setupDependencies(){RoomleDependencyInjection.setup(INJECTABLES),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new RoomleMaterialViewer(this._context),window.RoomleMaterialViewer||(window.RoomleMaterialViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"material-viewer"}}export{MaterialViewer};
|
|
2
|
+
//# sourceMappingURL=material-viewer-2ed7b3bc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material-viewer-2ed7b3bc.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./script-loader-c03cdfaf.nomodule.js","./roomle-dependency-injection-348f3aac.nomodule.js","./scene-manager-
|
|
2
|
-
//# sourceMappingURL=material-viewer-
|
|
1
|
+
System.register(["./script-loader-c03cdfaf.nomodule.js","./roomle-dependency-injection-348f3aac.nomodule.js","./scene-manager-867ed8ea.nomodule.js","./main-thread-to-worker-38d48e06.nomodule.js","./query-params-helper-519cb51c.nomodule.js"],(function(e){var t,a,i,r,s,n,o,h,l,_,m,c,d,g,p,u,M,w,C,y,f,v,S,P,b,x,F,G,I,U,R,T,A,k,D,j;return{setters:[function(e){t=e.S,a=e.M},function(e){i=e._,r=e.i,s=e.e,n=e.j,o=e.k,h=e.M,l=e.aq,_=e.ar,m=e.O,c=e.as,d=e.N,g=e.at,p=e.D,u=e.L,M=e.ao,w=e.au,C=e.R,y=e.b},function(e){f=e.S,v=e.B,S=e.C,P=e.F,b=e.T},function(e){x=e.aE,F=e.aN,G=e.z,I=e.C,U=e.ad,R=e.a,T=e.w,A=e.a7,k=e.a_,D=e.bc,j=e.a9},function(){}],execute:function(){class E extends f{constructor(e,t){super(e,t,s.RMV,x.CAMERA_3D),this._sceneParams={type:"cube"},this._materialParams={color:"#ffffff",metallic:.5,alpha:0,alphaCutoff:0,doubleSided:!1},this._renderer.capabilities.maxTextures>8&&this.loadDynamicLightSetting(n.createDynamicLightSettingSource(null,o.CAMERA)),this._initScene()}_initScene(){const e=new F(1,1,1,100,100,100),t=h.createMeshPhysicalMaterial({color:this._initData.colors.PRIMARY});this._setMaterial(t),this._mesh=new G(e,this._material),this._mesh.castShadow=!0,this._mesh.position.setY(.5),this._scene.add(this._mesh);const{initialFloorMaterial:a}=this._initData;if(a?this.changeFloorMaterialById(a):this._environment=new v(this._scene,null,new I(16777215)),this._cameraControl instanceof S){const e=new U;e.setFromObject(this._mesh),this._cameraControl.updateAndReset(e.getSize(new R),e.getCenter(new R))}this.showGUI()}loadMaterialId(e){return new Promise(t=>{this._configuratorMeshGenerator.loadMaterial(e,1e3,1e3).then(e=>{this._setMaterial(e),this._mesh.material=this._material,this._updateGUI(),this._requestRender(),t()})})}loadMaterial(e){return new Promise(t=>{e.__rapi_path__||(e.__rapi_path__="materials"),this._mesh.material=this._material,this._configuratorMeshGenerator.loadTextures(e,this._material,100,100).then(()=>{this._updateGUI(),this._requestRender()}),t()})}loadMaterialShading(e){return new Promise(t=>{let a={shading:e};this._setMaterial(l(this._material,a)),this._mesh.material=this._material,this._updateGUI(),this._requestRender(),t()})}_setMaterial(e){this._material=e,this._materialParams.alpha=e.opacity,this._materialParams.alphaCutoff=e.alphaTest,this._materialParams.color="#"+e.color.getHexString(),this._materialParams.doubleSided=e.side===T,this._materialParams.metallic=1===e.metalness?1:e.reflectivity}getMaterialShading(e=1){return _(this._material,e)}createCameraControl(e,t){this._cameraControl=new S(this._creator_,this._getInputManager(),new R(-1,1,1))}_getInputManager(){return this._inputManager}sceneChanged(){}getBounds(){return this._mesh?(new U).setFromObject(this._mesh):null}_guiLoaded(){this._updateGUI()}_updateGUI(){let e=m();e&&(this._guiGeometryFolder||(this._guiGeometryFolder=e.addFolder("Geometry"),this._guiGeometryFolder.add(this._sceneParams,"type",{Cube:"cube",Sphere:"sphere",PlaneVertical:"plane_vertical",PlaneHorizontal:"plane_horizontal"}).onChange(e=>{this._setGeometry()})),this._material&&(this._guiMaterialFolder&&e.removeFolder(this._guiMaterialFolder),this._guiMaterialFolder=e.addFolder("Material"),this._guiMaterialFolder.addColor(this._materialParams,"color").onChange(e=>{this._material.color=new I(e),this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"metallic").min(0).max(1).step(.01).onChange(e=>{this._material.metalness=1===e?1:.5,this._material.reflectivity=e||.5,this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"roughness").min(0).max(1).step(.01).onChange(e=>{this._shadingChanged()}),this._guiMaterialFolder.add(this._material,"transmission").min(0).max(1).step(.01).onChange(e=>{this._material.transmission=e,e>0&&(this._material.opacity=1,this._material.alphaTest=.5,this._material.depthWrite=!1,this._material.transparent=!0,this._material.metalness=0),this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alpha").min(0).max(1).step(.01).onChange(e=>{this._material.transparent=e<1,this._material.opacity=e,this._material.depthWrite=e>=1,this._mesh.castShadow=!this._material.transparent,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"alphaCutoff").min(0).max(1).step(.01).onChange(e=>{this._material.alphaTest=e||0,this._shadingChanged()}),this._guiMaterialFolder.add(this._materialParams,"doubleSided").onChange(e=>{this._material.side=e?T:A,this._shadingChanged()})),this._addGUIListener(e))}_shadingChanged(){this._roomleMaterialViewerUiCallback.onMaterialShadingChanged(_(this._material))}setGeometry(e){this._sceneParams.type=e,this._setGeometry()}_setGeometry(){let e;"cube"===this._sceneParams.type&&(e=new F(1,1,1,100,100,100)),"sphere"===this._sceneParams.type&&(e=new k(.5,100,100)),"plane_horizontal"===this._sceneParams.type&&(e=new D(1,1),e.rotateX(-Math.PI/2)),"plane_vertical"===this._sceneParams.type&&(e=new D(1,1)),this._mesh.geometry=e,this._renderEverything()}async changeFloorMaterialById(e){const t=await this._rapiAccess.getMaterial(e);return this._environment&&this._environment instanceof P||(this._environment=new P(this._scene,this._environment,!0)),new Promise((e,a)=>{this._environment.changeFloorMaterial(t,this._maxAnisotropy).then(()=>{this._requestRender(),e()},a)})}async addTexture(e,t){const a=100/(0===e.mmWidth?1:e.mmWidth),i=100/(0===e.mmHeight?1:e.mmHeight);if(t){const r=new Image;r.src=t;const s=new j;s.image=r,r.onload=function(){s.needsUpdate=!0},c(s,e,this._material,this._maxAnisotropy,a,i,this._renderer.capabilities.maxTextures)}else await d(e.image,e,this._material,this._maxAnisotropy,a,i,this._renderer.capabilities.maxTextures);this._requestRender()}removeTexture(e){"ORM"===e.mapping&&(this._material.aoMap=null,this._material.roughnessMap=null,this._material.metalnessMap=null),"RGB"!==e.mapping&&"RGBA"!==e.mapping||(this._material.map=null),"XYZ"===e.mapping&&(this._material.normalMap=null),this._material.needsUpdate=!0,this._requestRender()}clearCache(){this._configuratorMeshGenerator.clear()}}i([r],E.prototype,"_inputManager",void 0),i([r],E.prototype,"_configuratorMeshGenerator",void 0),i([r],E.prototype,"_roomleMaterialViewerUiCallback",void 0),i([r],E.prototype,"_rapiAccess",void 0);class O{constructor(e){this._creator_=e}setCameraOffset(e){this._sceneManager.setCameraOffset(e)}getCameraOffset(){return this._sceneManager.getCameraOffset()}init(e){return this._domHelper.setDomElement(e),this._sceneManager?(this._lifeCycleManager.resume(),Promise.resolve()):new Promise(this._initPromiseCallback.bind(this))}_initPromiseCallback(e,t){Promise.all([this._scriptLoader.fetch(b,{id:"tween-js"})]).then(()=>{this._sceneManager=new E(this._creator_,{left:0,top:1,right:1,bottom:0}),this._sceneManager.enableHD(),e()})}get callbacks(){return this._roomleMaterialViewerUiCallback}set callbacks(e){this._roomleMaterialViewerUiCallback=e}loadMaterialShading(e){return this._sceneManager.loadMaterialShading(e)}loadMaterial(e,t={}){return t.flushCache&&this._clearCaches(),this._sceneManager.loadMaterial(e)}loadMaterialId(e,t={}){return t.flushCache&&this._clearCaches(),this._sceneManager.loadMaterialId(e)}getMaterialShading(e=1){return this._sceneManager.getMaterialShading(e)}loadSceneSetting(e){return this._sceneManager.loadSceneSettings(e)}setOverrides(e){e&&this._initData.setOverrides(e)}updateSize(){this._sceneManager.updateCamera()}getMain(){}resumeTest(e){this._domHelper.setDomElement(e),this._lifeCycleManager.resume()}pauseTest(){this._lifeCycleManager.pause()}showGUI(){this._sceneManager.showGUI()}async changeFloorMaterialById(e){return this._sceneManager.changeFloorMaterialById(e)}setGeometry(e){this._sceneManager.setGeometry(e)}async addTexture(e,t){return this._sceneManager.addTexture(e,t)}removeTexture(e){return this._sceneManager.removeTexture(e)}_clearCaches(){this._rapiAccess.cleanUp(),this._sceneManager.clearCache()}getScene(){return this._sceneManager.getScene()}updateScene(){this._sceneManager.updateScene()}getUnitFormatter(){return this._unitFormatter}setEnvironmentMap(e){const{url:t,intensity:a,rotation:i,maxLightSources:r}=e;this._sceneManager.setEnvironmentMap(t,a,i,r)}}i([r],O.prototype,"_domHelper",void 0),i([r],O.prototype,"_scriptLoader",void 0),i([r],O.prototype,"_lifeCycleManager",void 0),i([r],O.prototype,"_roomleMaterialViewerUiCallback",void 0),i([r],O.prototype,"_initData",void 0),i([r],O.prototype,"_rapiAccess",void 0),i([r],O.prototype,"_unitFormatter",void 0);const V=[new p("script-loader",t),new p("logger",u),new p("input-manager",M,1),new p("configurator-mesh-generator",w),new p("rapi-access",C),new p("roomle-material-viewer-ui-callback",class extends g{constructor(e){super(e),this.onMaterialShadingChanged=e=>{}}},1)];e("MaterialViewer",class extends a{setupGlobals(){}setupDependencies(){y.setup(V),this.lookup("logger",this._context)}cleanUpGlobals(){throw new Error("Method not implemented.")}cleanUpDependencies(){throw new Error("Method not implemented.")}bootFinished(){this._viewer=new O(this._context),window.RoomleMaterialViewer||(window.RoomleMaterialViewer=this._viewer)}getApi(){return this._viewer}getContextName(){return"material-viewer"}})}}}));
|
|
2
|
+
//# sourceMappingURL=material-viewer-de60ddd4.nomodule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material-viewer-de60ddd4.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{MaterialViewer}from"./material-viewer-2ed7b3bc.js";import"./script-loader-ea706d37.js";import"./query-params-helper-b54bbbb4.js";import"./main-thread-to-worker-307e6096.js";import"./roomle-dependency-injection-6cc5f1dd.js";import"./scene-manager-17273ebe.js";(new MaterialViewer).boot();
|
|
2
|
+
//# sourceMappingURL=material-viewer-main-1fbbe523.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material-viewer-main-1fbbe523.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./material-viewer-
|
|
1
|
+
System.register(["./material-viewer-de60ddd4.nomodule.js","./script-loader-c03cdfaf.nomodule.js","./query-params-helper-519cb51c.nomodule.js","./main-thread-to-worker-38d48e06.nomodule.js","./roomle-dependency-injection-348f3aac.nomodule.js","./scene-manager-867ed8ea.nomodule.js"],(function(){var e;return{setters:[function(n){e=n.MaterialViewer},function(){},function(){},function(){},function(){},function(){}],execute:function(){(new e).boot()}}}));
|
|
2
2
|
//# sourceMappingURL=material-viewer-main.nomodule.js.map
|