@epigraph/solutions 0.9.0-alpha → 0.9.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.
|
@@ -6499,7 +6499,7 @@ void main() {
|
|
|
6499
6499
|
opacity: 0;
|
|
6500
6500
|
pointer-events: none;
|
|
6501
6501
|
}
|
|
6502
|
-
`]}static setupWebComponent(){window.customElements.get(ru.webComponentName)||window.customElements.define(ru.webComponentName,ru)}get timeElapsedSinceLoadBegin(){return parseFloat((performance.now()-this._loadTimeBegin).toFixed(2))}get epigraphAnalytics(){return this._epigraphAnalytics}get identifier(){return this._identifier}get identifierType(){return this._identifierType}get appEvents(){return this._appEvents}get canvasSize(){return this.__canvasSize}get assetLoaders(){return this._assetLoaders}get assetManager(){return this._assetManager}get sceneManager(){return this._sceneManager}get cameraManager(){return this._cameraManager}get hasSceneChanged(){return this.__hasSceneChanged}set hasSceneChanged(e){this.__hasSceneChanged=e}get renderEngine(){return this._renderEngine}get isDevEnv(){return this._isDevEnv}enterPickerState(){this.pickerState=!0}exitPickerState(){this.pickerState=!1}renderScreenshotCanvasFrame(){this.renderEngine.screenshotRenderer.render(this.renderEngine.scene,this.cameraManager.cameras.screenshot)}onLoadFailed(e){this._appEvents.appFailedEvent.fire(e);const t=this.timeElapsedSinceLoadBegin,i=new FI(!0,t,e?.toString()??"");this._epigraphAnalytics.sendEvent(i),this.showSplashScreen()}getPositionOnMeshFromPoint(e,t){const i=new nb,a=new $e;a.x=e/this.canvasSize.width*2-1,a.y=-(t/this.canvasSize.height)*2+1,i.setFromCamera(a,this.cameraManager.cameras.main);const l=i.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.children,!0);return l.length>0?l[0].point:null}getSceneSphericalBoundsForCameraFocus(){const e=this.dimensionsManager.getCurrentSceneBounds();return e.getCenter(this._boundingSphereCenter),e.getBoundingSphere(new vn(this._boundingSphereCenter))}async getUsdzUrlForAr(){return this.hasSceneChanged?this.__usdzBlobUrl=await this.renderEngine.getSceneAsUsdzUrl():window.epigraph.logger.info({title:"Reusing cached USDZ for AR."}),this.appEvents.arModelReadyEvent.fire(this.__usdzBlobUrl),this.__usdzBlobUrl}async getGlbUrlForAr(){return this.hasSceneChanged?this.__glbBlobUrl=await this.renderEngine.getSceneAsGlbUrl():window.epigraph.logger.info({title:"Reusing cached GLB for AR."}),this.appEvents.arModelReadyEvent.fire(this.__glbBlobUrl),{glbSrc:this.__glbBlobUrl,variantName:null}}async launchAR(){if(!this.isLoading)return await this.viewInYourSpaceManager.launchAR()}async spawnProductInScene(e){const t=new xC(e);return this.renderEngine.sceneHierarchy.sceneStructure.add(t),await this._onSceneHierarchyUpdate(),Promise.resolve(t)}showDimensions(){this.dimensionsManager.enabled=!0,this.areDimensionsActive=!0,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled);const e=this.getSceneSphericalBoundsForCameraFocus();e.radius=e.radius*1.4,this.cameraManager.fitCameraToObject({objectToFocus:e})}hideDimensions(e=!1){if(this.dimensionsManager.enabled=!1,this.areDimensionsActive=!1,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),!e){const t=this.getSceneSphericalBoundsForCameraFocus();this.cameraManager.fitCameraToObject({objectToFocus:t})}}getDimensions(){const e=this.dimensionsManager.getCurrentDimensionsState(),t=this.dimensionsManager.dimensionsUnit;return{length:e.length.distance,width:e.width.distance,height:e.height.distance,unit:t}}printSceneHierarchy(){this.renderEngine.printSceneHierarchy()}showCameraAim(){this.cameraAimElemRef.classList.remove("hide")}hideCameraAim(){this.cameraAimElemRef.classList.add("hide")}showHelp(){this.isHelpVisible=!0}hideHelp(){this.isHelpVisible=!1}toggleHelp(){this.isHelpVisible=!this.isHelpVisible}showHotspots(){window.epigraph.logger.info({title:"Showing Hotspots"}),this.areHotspotsActive=!0,this.appEvents.hotspotsVisibilityChanged.fire({visible:!0})}hideHotspots(){window.epigraph.logger.info({title:"Hiding Hotspots"}),this.areHotspotsActive=!1,this.appEvents.hotspotsVisibilityChanged.fire({visible:!1})}toggleHotspots(){this.hotspotsManager.enabled?this.hideHotspots():this.showHotspots()}updateHotspotsOrder(e){this.hotspotsManager.updateHotspotsOrder(e)}openHotspot({hotspotId:e,state:t}){this.hotspotsManager.openHotspot({hotspotId:e,state:t})}closeActiveHotspot(){this.hotspotsManager.closeActiveHotspot()}setActiveHotspotState(e){this.hotspotsManager.setActiveHotspotState(e)}nextHotspot(){return this.hotspotsManager.nextHotspot()}previousHotspot(){return this.hotspotsManager.previousHotspot()}getActiveHotspot(){return this.hotspotsManager.activeHotspot}areHotspotsVisible(){return this.hotspotsManager.enabled}getAllHotspots(){return Array.from(this.hotspotsManager.hotspots.values())}getAllHotspotIds(){return Array.from(this.hotspotsManager.hotspots.keys())}getHotspotById(e){return this.hotspotsManager.hotspots.get(e)}createHotspots(e){this.hotspotsManager.createHotspots(e)}updateHotspots(e){this.hotspotsManager.updateHotspots(e)}removeHotspots(e){this.hotspotsManager.removeHotspots(e)}async triggerCameraInteractionPrompt(e=2){this.renderEngine.showCameraInteractionPromptIndicator();for(let t=0;t<e;t++)await this.cameraManager.wiggleCamera(),await Ft.wait(500);setTimeout(()=>{this.playInteractionPrompt=!this._isSceneInteractedWith},3e3)}getAllAnimations(){const e=this.sceneManager.getSceneStructure()[0];return e?e.product.renderAsset.getAllAnimations():[]}getAllAnimationNames(){const e=this.sceneManager.getSceneStructure()[0];return e?e.product.renderAsset.getAllAnimationNames():[]}playAnimationByName({animationName:e,
|
|
6502
|
+
`]}static setupWebComponent(){window.customElements.get(ru.webComponentName)||window.customElements.define(ru.webComponentName,ru)}get timeElapsedSinceLoadBegin(){return parseFloat((performance.now()-this._loadTimeBegin).toFixed(2))}get epigraphAnalytics(){return this._epigraphAnalytics}get identifier(){return this._identifier}get identifierType(){return this._identifierType}get appEvents(){return this._appEvents}get canvasSize(){return this.__canvasSize}get assetLoaders(){return this._assetLoaders}get assetManager(){return this._assetManager}get sceneManager(){return this._sceneManager}get cameraManager(){return this._cameraManager}get hasSceneChanged(){return this.__hasSceneChanged}set hasSceneChanged(e){this.__hasSceneChanged=e}get renderEngine(){return this._renderEngine}get isDevEnv(){return this._isDevEnv}enterPickerState(){this.pickerState=!0}exitPickerState(){this.pickerState=!1}renderScreenshotCanvasFrame(){this.renderEngine.screenshotRenderer.render(this.renderEngine.scene,this.cameraManager.cameras.screenshot)}onLoadFailed(e){this._appEvents.appFailedEvent.fire(e);const t=this.timeElapsedSinceLoadBegin,i=new FI(!0,t,e?.toString()??"");this._epigraphAnalytics.sendEvent(i),this.showSplashScreen()}getPositionOnMeshFromPoint(e,t){const i=new nb,a=new $e;a.x=e/this.canvasSize.width*2-1,a.y=-(t/this.canvasSize.height)*2+1,i.setFromCamera(a,this.cameraManager.cameras.main);const l=i.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.children,!0);return l.length>0?l[0].point:null}getSceneSphericalBoundsForCameraFocus(){const e=this.dimensionsManager.getCurrentSceneBounds();return e.getCenter(this._boundingSphereCenter),e.getBoundingSphere(new vn(this._boundingSphereCenter))}async getUsdzUrlForAr(){return this.hasSceneChanged?this.__usdzBlobUrl=await this.renderEngine.getSceneAsUsdzUrl():window.epigraph.logger.info({title:"Reusing cached USDZ for AR."}),this.appEvents.arModelReadyEvent.fire(this.__usdzBlobUrl),this.__usdzBlobUrl}async getGlbUrlForAr(){return this.hasSceneChanged?this.__glbBlobUrl=await this.renderEngine.getSceneAsGlbUrl():window.epigraph.logger.info({title:"Reusing cached GLB for AR."}),this.appEvents.arModelReadyEvent.fire(this.__glbBlobUrl),{glbSrc:this.__glbBlobUrl,variantName:null}}async launchAR(){if(!this.isLoading)return await this.viewInYourSpaceManager.launchAR()}async spawnProductInScene(e){const t=new xC(e);return this.renderEngine.sceneHierarchy.sceneStructure.add(t),await this._onSceneHierarchyUpdate(),Promise.resolve(t)}showDimensions(){this.dimensionsManager.enabled=!0,this.areDimensionsActive=!0,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled);const e=this.getSceneSphericalBoundsForCameraFocus();e.radius=e.radius*1.4,this.cameraManager.fitCameraToObject({objectToFocus:e})}hideDimensions(e=!1){if(this.dimensionsManager.enabled=!1,this.areDimensionsActive=!1,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),!e){const t=this.getSceneSphericalBoundsForCameraFocus();this.cameraManager.fitCameraToObject({objectToFocus:t})}}getDimensions(){const e=this.dimensionsManager.getCurrentDimensionsState(),t=this.dimensionsManager.dimensionsUnit;return{length:e.length.distance,width:e.width.distance,height:e.height.distance,unit:t}}printSceneHierarchy(){this.renderEngine.printSceneHierarchy()}showCameraAim(){this.cameraAimElemRef.classList.remove("hide")}hideCameraAim(){this.cameraAimElemRef.classList.add("hide")}showHelp(){this.isHelpVisible=!0}hideHelp(){this.isHelpVisible=!1}toggleHelp(){this.isHelpVisible=!this.isHelpVisible}showHotspots(){window.epigraph.logger.info({title:"Showing Hotspots"}),this.areHotspotsActive=!0,this.appEvents.hotspotsVisibilityChanged.fire({visible:!0})}hideHotspots(){window.epigraph.logger.info({title:"Hiding Hotspots"}),this.areHotspotsActive=!1,this.appEvents.hotspotsVisibilityChanged.fire({visible:!1})}toggleHotspots(){this.hotspotsManager.enabled?this.hideHotspots():this.showHotspots()}updateHotspotsOrder(e){this.hotspotsManager.updateHotspotsOrder(e)}openHotspot({hotspotId:e,state:t}){this.hotspotsManager.openHotspot({hotspotId:e,state:t})}closeActiveHotspot(){this.hotspotsManager.closeActiveHotspot()}setActiveHotspotState(e){this.hotspotsManager.setActiveHotspotState(e)}nextHotspot(){return this.hotspotsManager.nextHotspot()}previousHotspot(){return this.hotspotsManager.previousHotspot()}getActiveHotspot(){return this.hotspotsManager.activeHotspot}areHotspotsVisible(){return this.hotspotsManager.enabled}getAllHotspots(){return Array.from(this.hotspotsManager.hotspots.values())}getAllHotspotIds(){return Array.from(this.hotspotsManager.hotspots.keys())}getHotspotById(e){return this.hotspotsManager.hotspots.get(e)}createHotspots(e){this.hotspotsManager.createHotspots(e)}updateHotspots(e){this.hotspotsManager.updateHotspots(e)}removeHotspots(e){this.hotspotsManager.removeHotspots(e)}async triggerCameraInteractionPrompt(e=2){this.renderEngine.showCameraInteractionPromptIndicator();for(let t=0;t<e;t++)await this.cameraManager.wiggleCamera(),await Ft.wait(500);setTimeout(()=>{this.playInteractionPrompt=!this._isSceneInteractedWith},3e3)}getAllAnimations(){const e=this.sceneManager.getSceneStructure()[0];return e?e.product.renderAsset.getAllAnimations():[]}getAllAnimationNames(){const e=this.sceneManager.getSceneStructure()[0];return e?e.product.renderAsset.getAllAnimationNames():[]}playAnimationByName({animationName:e,clampWhenFinished:t=!1,loop:i=!1,repetitions:a=1/0,reverse:l=!1}){if(!e)return;const u=this.getAllAnimationNames();if(!u.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:u});return}const d=u.indexOf(e),p=this.getAllAnimations()[d];return l?(p.timeScale=-1,p.fadeOut(this._animationFadeDurationInMiliseconds*.001)):(p.timeScale=1,p.fadeIn(this._animationFadeDurationInMiliseconds*.001)),p.setLoop(i?Ua:Cl,a),p.clampWhenFinished=t,p.enabled=!0,p.play(),this._activeAnimations.set(e,p),{animationName:e,targetAnimationAction:p}}stopAnimationByName(e){if(!e)return;const t=this.getAllAnimationNames();if(!t.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:t});return}const i=t.indexOf(e),a=this.getAllAnimations()[i];a.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{a.stop()},this._animationFadeDurationInMiliseconds),this._activeAnimations.delete(e)}pauseActiveAnimations(e){for(const t of this._activeAnimations.values())t.paused=!0,e!==void 0&&(t.weight=e)}resumeActiveAnimations(){for(const e of this._activeAnimations.values())e.paused=!1,e.weight=1}stopAllAnimations(){for(const[e,t]of this._activeAnimations.entries())t.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{t.stop(),this._activeAnimations.delete(e)},this._animationFadeDurationInMiliseconds)}postRenderFrameUpdateInEngine(e){try{this.cameraManager.mainCameraControls.update(e),this.sceneManager.getFirstEntity().product.renderAsset.getAnimationMixer()?.update(e),this.renderEngine.mainRenderer.render(this.renderEngine.scene,this.cameraManager.cameras.main)}catch(t){return t}}getScreenPositionFromWorld(e){const t=new $e,i=this.cameraManager.cameras.main,a=this.renderEngine.canvas.clientWidth*.5,l=this.renderEngine.canvas.clientHeight*.5,d=e.clone().project(i);return t.x=(d.x+1)*a,t.y=-(d.y-1)*l,t}_renderAppCanvasContainer(){return this.featuresToEnable.viewer?Ee`
|
|
6503
6503
|
<div id="appCanvasContainer" class="app-canvas-container">
|
|
6504
6504
|
<span id="cameraAimIndicator" class="camera-aim-indicator hide"></span>
|
|
6505
6505
|
</div>
|
|
@@ -6619,7 +6619,7 @@ void main() {
|
|
|
6619
6619
|
class="splash-screen"
|
|
6620
6620
|
current-progress=${this._loadingProgress}
|
|
6621
6621
|
></epg-loader-scene>
|
|
6622
|
-
`}async _resetSession(){await this.renderEngine.emptyScene(),this.assetManager.assets.clear(),this._autoGeneratedProxyMesh.scale.set(1,1,1),this._autoGeneratedProxyMesh.position.set(0,0,0),this._autoGeneratedProxyMesh.updateMatrixWorld()}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app."}),this.addEventListener(this.appEvents.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.appEvents.cameraControlsStart.name,e=>{switch(e.detail.type){case"rotate":this.style.cursor="grabbing";break;case"pan":this.style.cursor="move",this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.pickerState===!1&&this.hotspotsManager.closeActiveHotspot()}),this.addEventListener(this.appEvents.inputEnd.name,()=>{this.style.cursor="grab",this.hideCameraAim()}),this.addEventListener(this.appEvents.hotspotOpenEvent.name,()=>{this.hideDimensions(!0)}),this.addEventListener(this.appEvents.assetLoadProgress.name,e=>{this._loadingProgress=e.detail.progress}),this.addEventListener(this.appEvents.hotspotOpenEvent.name,e=>{this._isActiveHotspot=!0,this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)}),this.addEventListener(this.appEvents.hotspotNextEvent.name,e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)}),this.addEventListener(this.appEvents.hotspotPreviousEvent.name,e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)}),this.addEventListener(this.appEvents.hotspotClosedEvent.name,e=>{this._isActiveHotspot=!1;const i=this.hotspotsManager.hotspots.get(e.detail.hotspotId)?.animation;if(i)for(const a of i){const l=a.loop,u=a.exit;l&&this.stopAnimationByName(l)
|
|
6622
|
+
`}async _resetSession(){await this.renderEngine.emptyScene(),this.assetManager.assets.clear(),this._autoGeneratedProxyMesh.scale.set(1,1,1),this._autoGeneratedProxyMesh.position.set(0,0,0),this._autoGeneratedProxyMesh.updateMatrixWorld()}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app."}),this.addEventListener(this.appEvents.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.appEvents.cameraControlsStart.name,e=>{switch(e.detail.type){case"rotate":this.style.cursor="grabbing";break;case"pan":this.style.cursor="move",this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.pickerState===!1&&this.hotspotsManager.closeActiveHotspot()}),this.addEventListener(this.appEvents.inputEnd.name,()=>{this.style.cursor="grab",this.hideCameraAim()}),this.addEventListener(this.appEvents.hotspotOpenEvent.name,()=>{this.hideDimensions(!0)}),this.addEventListener(this.appEvents.assetLoadProgress.name,e=>{this._loadingProgress=e.detail.progress}),this.addEventListener(this.appEvents.hotspotOpenEvent.name,e=>{this._isActiveHotspot=!0,this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)}),this.addEventListener(this.appEvents.hotspotNextEvent.name,e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)}),this.addEventListener(this.appEvents.hotspotPreviousEvent.name,e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)}),this.addEventListener(this.appEvents.hotspotClosedEvent.name,e=>{this._isActiveHotspot=!1;const i=this.hotspotsManager.hotspots.get(e.detail.hotspotId)?.animation;if(i)for(const a of i){const l=a.loop,u=a.exit;l&&this.stopAnimationByName(l);let d;u?d=this.playAnimationByName({animationName:u}):d=this.playAnimationByName({animationName:a.entry,reverse:!0}),setTimeout(()=>{d?.targetAnimationAction.reset(),this._activeAnimations.delete(d?.animationName??"")},this._animationFadeDurationInMiliseconds)}}),this.appCanvasContainerElemRef.onpointerdown=e=>{this.playInteractionPrompt=!1,this._isSceneInteractedWith=!0,this.hideHelp(),this.appEvents.inputStart.fire({event:e})},this.appCanvasContainerElemRef.onpointermove=e=>{this.appEvents.inputMove.fire({event:e})},this.appCanvasContainerElemRef.onpointerup=e=>{this.appEvents.inputEnd.fire({event:e})},this.appCanvasContainerElemRef.onpointerout=e=>{this.appEvents.inputEnd.fire({event:e})},this.cameraManager.mainCameraControls.addEventListener("update",this._onCameraPositionUpdate.bind(this))}_onCameraPositionUpdate(){this.dimensionsManager?.enabled&&this._repopulateDimensions(),this.hotspotsManager?.enabled&&this.hotspotsManager.recalculateHotspotPositions()}_setupAutoGeneratedProxyContainers(){const e=new Xn,t=new Li({color:65280,opacity:.5,transparent:!0});this._autoGeneratedProxyMesh=new lt(e,t)}async _setup(){window.epigraph.logger.table({title:"Setting up..."}),this._appEvents=new Kx(this),this._assetManager=new RU(this),this._cameraManager=new DU({appWcRef:this}),this._sceneManager=new a3(this),await this.setupRenderEngine(),await this._cameraManager.setup({mainRenderer:this.renderEngine.mainRenderer,screenshotRenderer:this.renderEngine.screenshotRenderer,cameraSettings:this.renderEngine.renderEngineSettings.camera}),this._setupAutoGeneratedProxyContainers(),this._setupEventListeners()}_resolveAnimationsOnHotspotEntry(e){this.stopAllAnimations();for(const t of e)this._activeAnimations.get(t.entry)||this.playAnimationByName({animationName:t.entry,clampWhenFinished:!0}),setTimeout(()=>{this._activeAnimations.delete(t.entry),this._activeAnimations.get(t.loop)?.loop||this.playAnimationByName({animationName:t.loop,loop:!0})},this._animationFadeDurationInMiliseconds)}_renderDimensionsManager(){let e=Ve;return this.featuresToEnable.dimensions&&(VU.setupWebComponent(),e=Ee`
|
|
6623
6623
|
<dimensions-manager
|
|
6624
6624
|
id="dimensionsManager"
|
|
6625
6625
|
.appWcRef=${this}
|