From 6a1aaa51473fb179e29794f4e6c47b0e472e40a3 Mon Sep 17 00:00:00 2001 From: AlexandruPopovici Date: Tue, 7 Jan 2025 13:33:43 +0200 Subject: [PATCH 1/2] chore(viewer-lib): Snow mode is no longer default in the sandbox --- packages/viewer-sandbox/src/main.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/viewer-sandbox/src/main.ts b/packages/viewer-sandbox/src/main.ts index 1e5cca01b9..a936e51d98 100644 --- a/packages/viewer-sandbox/src/main.ts +++ b/packages/viewer-sandbox/src/main.ts @@ -21,7 +21,6 @@ import { SectionTool } from '@speckle/viewer' import { SectionOutlines } from '@speckle/viewer' import { ViewModesKeys } from './Extensions/ViewModesKeys' import { BoxSelection } from './Extensions/BoxSelection' -import { SnowPipeline } from './Pipelines/Snow/SnowPipeline' const createViewer = async (containerName: string, _stream: string) => { const container = document.querySelector(containerName) @@ -83,9 +82,6 @@ const createViewer = async (containerName: string, _stream: string) => { Object.assign(sandbox.sceneParams.worldSize, viewer.World.worldSize) Object.assign(sandbox.sceneParams.worldOrigin, viewer.World.worldOrigin) sandbox.refresh() - const snowPipeline = new SnowPipeline(viewer.getRenderer()) - viewer.getRenderer().pipeline = snowPipeline - void snowPipeline.start() }) viewer.on(ViewerEvent.UnloadComplete, () => { From 22accd07fa7585b2065eb7a8d019825327600aac Mon Sep 17 00:00:00 2001 From: AlexandruPopovici Date: Tue, 7 Jan 2025 13:36:20 +0200 Subject: [PATCH 2/2] fix(viewer-lib): Handles WEB-2417 Shadowcather now properly updates when adding/removing render trees even if the scene bounds does not change --- packages/viewer/src/modules/SpeckleRenderer.ts | 9 +++++---- packages/viewer/src/modules/Viewer.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/viewer/src/modules/SpeckleRenderer.ts b/packages/viewer/src/modules/SpeckleRenderer.ts index 19e2ec0963..6a2d6f3793 100644 --- a/packages/viewer/src/modules/SpeckleRenderer.ts +++ b/packages/viewer/src/modules/SpeckleRenderer.ts @@ -605,7 +605,7 @@ export default class SpeckleRenderer { this.updateHelpers() /** We'll just update the shadowcatcher after all batches are loaded */ - this.updateShadowCatcher() + this.updateShadowCatcher(true) this.updateClippingPlanes() if (this._speckleCamera) this._speckleCamera.updateCameraPlanes(this.sceneBox) delete this.cancel[renderTree.id] @@ -641,7 +641,6 @@ export default class SpeckleRenderer { public removeRenderTree(subtreeId: string) { this.rootGroup.remove(this.rootGroup.getObjectByName(subtreeId) as Object3D) - this.updateShadowCatcher() const batches = this.batcher.getBatches(subtreeId) batches.forEach((value) => { @@ -651,6 +650,7 @@ export default class SpeckleRenderer { this.batcher.purgeBatches(subtreeId) this.updateDirectLights() this.updateHelpers() + this.updateShadowCatcher(true) } public cancelRenderTree(subtreeId: string) { @@ -844,14 +844,15 @@ export default class SpeckleRenderer { this._shadowcatcher?.updateClippingPlanes(planes) } - public updateShadowCatcher() { + public updateShadowCatcher(force: boolean = false) { if (this.sunConfiguration.shadowcatcher !== undefined) this._shadowcatcher.shadowcatcherMesh.visible = this.sunConfiguration.shadowcatcher if (this.sunConfiguration.shadowcatcher) { this._shadowcatcher.bake( this.clippingVolume, - this._renderer.capabilities.maxTextureSize + this._renderer.capabilities.maxTextureSize, + force ) this.needsRender = true } diff --git a/packages/viewer/src/modules/Viewer.ts b/packages/viewer/src/modules/Viewer.ts index 0aaa797574..d0f77a118f 100644 --- a/packages/viewer/src/modules/Viewer.ts +++ b/packages/viewer/src/modules/Viewer.ts @@ -366,7 +366,7 @@ export class Viewer extends EventEmitter implements IViewer { this.speckleRenderer.removeRenderTree(resource) this.tree.getRenderTree(resource)?.purge() this.tree.purge(resource) - this.requestRender(UpdateFlags.RENDER | UpdateFlags.SHADOWS) + this.requestRender(UpdateFlags.RENDER_RESET | UpdateFlags.SHADOWS) } } finally { if (--this.inProgressOperations === 0) {