@spatial-elements/core 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/CarouselDeviceCamera.d.ts +20 -0
- package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
- package/dist/catalog/CarouselDeviceCamera.js +58 -0
- package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts +8 -2
- package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -1
- package/dist/catalog/CarouselGlassCompositor.js +69 -12
- package/dist/catalog/CarouselGlassCompositor.js.map +1 -1
- package/dist/catalog/CarouselGround.d.ts +22 -1
- package/dist/catalog/CarouselGround.d.ts.map +1 -1
- package/dist/catalog/CarouselGround.js +185 -24
- package/dist/catalog/CarouselGround.js.map +1 -1
- package/dist/catalog/CatalogDepthBlur.d.ts +20 -1
- package/dist/catalog/CatalogDepthBlur.d.ts.map +1 -1
- package/dist/catalog/CatalogDepthBlur.js +126 -23
- package/dist/catalog/CatalogDepthBlur.js.map +1 -1
- package/dist/catalog/CatalogGeometryFade.d.ts +5 -1
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -1
- package/dist/catalog/CatalogGeometryFade.js +39 -7
- package/dist/catalog/CatalogGeometryFade.js.map +1 -1
- package/dist/catalog/CatalogModelOutline.d.ts +3 -1
- package/dist/catalog/CatalogModelOutline.d.ts.map +1 -1
- package/dist/catalog/CatalogModelOutline.js +11 -2
- package/dist/catalog/CatalogModelOutline.js.map +1 -1
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -1
- package/dist/catalog/CatalogPreparation.js +8 -6
- package/dist/catalog/CatalogPreparation.js.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +144 -3
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.js +554 -103
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts +4 -0
- package/dist/catalog/CatalogTransition.d.ts.map +1 -1
- package/dist/catalog/CatalogTransition.js +109 -27
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/CatalogWarmOutputContext.d.ts +39 -0
- package/dist/catalog/CatalogWarmOutputContext.d.ts.map +1 -0
- package/dist/catalog/CatalogWarmOutputContext.js +159 -0
- package/dist/catalog/CatalogWarmOutputContext.js.map +1 -0
- package/dist/catalog/EarlyNavigationCoordinator.d.ts +35 -0
- package/dist/catalog/EarlyNavigationCoordinator.d.ts.map +1 -0
- package/dist/catalog/EarlyNavigationCoordinator.js +103 -0
- package/dist/catalog/EarlyNavigationCoordinator.js.map +1 -0
- package/dist/catalog/NavigationFeedback.d.ts +12 -0
- package/dist/catalog/NavigationFeedback.d.ts.map +1 -0
- package/dist/catalog/NavigationFeedback.js +40 -0
- package/dist/catalog/NavigationFeedback.js.map +1 -0
- package/dist/catalog/PreparationGate.d.ts +4 -0
- package/dist/catalog/PreparationGate.d.ts.map +1 -1
- package/dist/catalog/PreparationGate.js +1 -0
- package/dist/catalog/PreparationGate.js.map +1 -1
- package/dist/catalog/SourceDomClipping.d.ts +8 -0
- package/dist/catalog/SourceDomClipping.d.ts.map +1 -0
- package/dist/catalog/SourceDomClipping.js +74 -0
- package/dist/catalog/SourceDomClipping.js.map +1 -0
- package/dist/catalog/SourceDomMotion.d.ts +28 -0
- package/dist/catalog/SourceDomMotion.d.ts.map +1 -0
- package/dist/catalog/SourceDomMotion.js +111 -0
- package/dist/catalog/SourceDomMotion.js.map +1 -0
- package/dist/catalog/SpatialPageRegistry.d.ts +1 -0
- package/dist/catalog/SpatialPageRegistry.d.ts.map +1 -1
- package/dist/catalog/SpatialPageRegistry.js.map +1 -1
- package/dist/catalog/StagedCatalogTransition.d.ts +74 -0
- package/dist/catalog/StagedCatalogTransition.d.ts.map +1 -0
- package/dist/catalog/StagedCatalogTransition.js +270 -0
- package/dist/catalog/StagedCatalogTransition.js.map +1 -0
- package/dist/catalog/cardProjection.d.ts +31 -0
- package/dist/catalog/cardProjection.d.ts.map +1 -1
- package/dist/catalog/cardProjection.js +63 -4
- package/dist/catalog/cardProjection.js.map +1 -1
- package/dist/catalog/carouselPanelProjection.d.ts.map +1 -1
- package/dist/catalog/carouselPanelProjection.js +48 -11
- package/dist/catalog/carouselPanelProjection.js.map +1 -1
- package/dist/catalog/catalogActivationFocus.d.ts +5 -0
- package/dist/catalog/catalogActivationFocus.d.ts.map +1 -0
- package/dist/catalog/catalogActivationFocus.js +39 -0
- package/dist/catalog/catalogActivationFocus.js.map +1 -0
- package/dist/catalog/catalogJourney.d.ts +2 -0
- package/dist/catalog/catalogJourney.d.ts.map +1 -1
- package/dist/catalog/catalogJourney.js.map +1 -1
- package/dist/catalog/catalogPose.d.ts +18 -0
- package/dist/catalog/catalogPose.d.ts.map +1 -1
- package/dist/catalog/catalogPose.js +26 -5
- package/dist/catalog/catalogPose.js.map +1 -1
- package/dist/catalog/catalogTransitionViewport.d.ts +9 -0
- package/dist/catalog/catalogTransitionViewport.d.ts.map +1 -0
- package/dist/catalog/catalogTransitionViewport.js +13 -0
- package/dist/catalog/catalogTransitionViewport.js.map +1 -0
- package/dist/catalog/catalogViewLink.d.ts +2 -0
- package/dist/catalog/catalogViewLink.d.ts.map +1 -1
- package/dist/catalog/catalogViewLink.js +10 -2
- package/dist/catalog/catalogViewLink.js.map +1 -1
- package/dist/catalog/deviceYaw.d.ts +21 -0
- package/dist/catalog/deviceYaw.d.ts.map +1 -0
- package/dist/catalog/deviceYaw.js +87 -0
- package/dist/catalog/deviceYaw.js.map +1 -0
- package/dist/catalog/listDeviceOrientation.d.ts +17 -0
- package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
- package/dist/catalog/listDeviceOrientation.js +262 -0
- package/dist/catalog/listDeviceOrientation.js.map +1 -0
- package/dist/catalog/stagedDetailGeometry.d.ts +37 -0
- package/dist/catalog/stagedDetailGeometry.d.ts.map +1 -0
- package/dist/catalog/stagedDetailGeometry.js +55 -0
- package/dist/catalog/stagedDetailGeometry.js.map +1 -0
- package/dist/catalog/stagedDockGeometry.d.ts +66 -0
- package/dist/catalog/stagedDockGeometry.d.ts.map +1 -0
- package/dist/catalog/stagedDockGeometry.js +66 -0
- package/dist/catalog/stagedDockGeometry.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/spatial-element/ResponsiveViewportMetrics.d.ts +18 -0
- package/dist/spatial-element/ResponsiveViewportMetrics.d.ts.map +1 -0
- package/dist/spatial-element/ResponsiveViewportMetrics.js +68 -0
- package/dist/spatial-element/ResponsiveViewportMetrics.js.map +1 -0
- package/dist/spatial-element/SectionSurfaceRegistry.d.ts +24 -0
- package/dist/spatial-element/SectionSurfaceRegistry.d.ts.map +1 -0
- package/dist/spatial-element/SectionSurfaceRegistry.js +48 -0
- package/dist/spatial-element/SectionSurfaceRegistry.js.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts +19 -9
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.js +189 -93
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
- package/dist/spatial-element/SpatialElementPaneController.d.ts +67 -0
- package/dist/spatial-element/SpatialElementPaneController.d.ts.map +1 -0
- package/dist/spatial-element/SpatialElementPaneController.js +245 -0
- package/dist/spatial-element/SpatialElementPaneController.js.map +1 -0
- package/dist/spatial-element/activeDetailSection.d.ts +8 -0
- package/dist/spatial-element/activeDetailSection.d.ts.map +1 -0
- package/dist/spatial-element/activeDetailSection.js +19 -0
- package/dist/spatial-element/activeDetailSection.js.map +1 -0
- package/dist/spatial-element/layoutTokens.json +53 -0
- package/dist/spatial-element/responsiveLayout.d.ts +1389 -0
- package/dist/spatial-element/responsiveLayout.d.ts.map +1 -0
- package/dist/spatial-element/responsiveLayout.js +265 -0
- package/dist/spatial-element/responsiveLayout.js.map +1 -0
- package/dist/spatial-element/sectionBackground.d.ts +29 -0
- package/dist/spatial-element/sectionBackground.d.ts.map +1 -0
- package/dist/spatial-element/sectionBackground.js +66 -0
- package/dist/spatial-element/sectionBackground.js.map +1 -0
- package/dist/spatial-element/spatialElement.d.ts +1 -0
- package/dist/spatial-element/spatialElement.d.ts.map +1 -1
- package/dist/spatial-element/spatialElement.js +1 -0
- package/dist/spatial-element/spatialElement.js.map +1 -1
- package/dist/spatial-element/spatialElementDock.d.ts +15 -0
- package/dist/spatial-element/spatialElementDock.d.ts.map +1 -1
- package/dist/spatial-element/spatialElementDock.js +22 -0
- package/dist/spatial-element/spatialElementDock.js.map +1 -1
- package/dist/spatial-element/spatialElementMedia.d.ts +16 -0
- package/dist/spatial-element/spatialElementMedia.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementMedia.js +29 -0
- package/dist/spatial-element/spatialElementMedia.js.map +1 -0
- package/dist/spatial-element/spatialTheme.d.ts +12 -1
- package/dist/spatial-element/spatialTheme.d.ts.map +1 -1
- package/dist/spatial-element/spatialTheme.js +30 -1
- package/dist/spatial-element/spatialTheme.js.map +1 -1
- package/dist/spatial-element/types.d.ts +50 -2
- package/dist/spatial-element/types.d.ts.map +1 -1
- package/dist/spatial-element/types.js.map +1 -1
- package/dist/stage/BackgroundLayerOutput.d.ts +76 -0
- package/dist/stage/BackgroundLayerOutput.d.ts.map +1 -0
- package/dist/stage/BackgroundLayerOutput.js +333 -0
- package/dist/stage/BackgroundLayerOutput.js.map +1 -0
- package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
- package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
- package/dist/stage/DeviceGeometryMotion.js +37 -0
- package/dist/stage/DeviceGeometryMotion.js.map +1 -0
- package/dist/stage/LiquidGlassPanel.d.ts +3 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
- package/dist/stage/LiquidGlassPanel.js +27 -2
- package/dist/stage/LiquidGlassPanel.js.map +1 -1
- package/dist/stage/MinimapController.d.ts +1 -0
- package/dist/stage/MinimapController.d.ts.map +1 -1
- package/dist/stage/MinimapController.js +35 -47
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/PageBindingController.d.ts +4 -0
- package/dist/stage/PageBindingController.d.ts.map +1 -1
- package/dist/stage/PageBindingController.js +12 -4
- package/dist/stage/PageBindingController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts +17 -0
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +83 -22
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/SpatialElementInteractionController.d.ts +7 -0
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
- package/dist/stage/SpatialElementInteractionController.js +9 -0
- package/dist/stage/SpatialElementInteractionController.js.map +1 -1
- package/dist/stage/SpatialElementPresentationController.d.ts +14 -2
- package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -1
- package/dist/stage/SpatialElementPresentationController.js +47 -2
- package/dist/stage/SpatialElementPresentationController.js.map +1 -1
- package/dist/stage/SpatialElementRefinement.d.ts +34 -1
- package/dist/stage/SpatialElementRefinement.d.ts.map +1 -1
- package/dist/stage/SpatialElementRefinement.js +175 -37
- package/dist/stage/SpatialElementRefinement.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +183 -5
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +421 -57
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts +76 -1
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +424 -47
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/VirtualScrollController.d.ts +7 -0
- package/dist/stage/VirtualScrollController.d.ts.map +1 -1
- package/dist/stage/VirtualScrollController.js +57 -4
- package/dist/stage/VirtualScrollController.js.map +1 -1
- package/dist/stage/minimap/MinimapModel.d.ts +2 -1
- package/dist/stage/minimap/MinimapModel.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapModel.js +34 -4
- package/dist/stage/minimap/MinimapModel.js.map +1 -1
- package/dist/stage/minimap/MinimapModelGeometry.d.ts +21 -0
- package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapModelGeometry.js +68 -0
- package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -0
- package/dist/stage/minimap/MinimapState.d.ts +3 -8
- package/dist/stage/minimap/MinimapState.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapState.js.map +1 -1
- package/dist/stage/panelContext.d.ts +7 -0
- package/dist/stage/panelContext.d.ts.map +1 -1
- package/dist/stage/panelContext.js.map +1 -1
- package/dist/stage/rendererState.d.ts +2 -0
- package/dist/stage/rendererState.d.ts.map +1 -1
- package/dist/stage/rendererState.js +13 -0
- package/dist/stage/rendererState.js.map +1 -1
- package/dist/stage/sceneEndpointEligibility.d.ts +20 -0
- package/dist/stage/sceneEndpointEligibility.d.ts.map +1 -0
- package/dist/stage/sceneEndpointEligibility.js +363 -0
- package/dist/stage/sceneEndpointEligibility.js.map +1 -0
- package/dist/stage/stageDom.d.ts.map +1 -1
- package/dist/stage/stageDom.js +6 -1
- package/dist/stage/stageDom.js.map +1 -1
- package/dist/stage/stageMath.d.ts +3 -3
- package/dist/stage/stageMath.d.ts.map +1 -1
- package/dist/stage/stageMath.js +11 -10
- package/dist/stage/stageMath.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +8 -1
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/dist/stage/stageVisualTest.d.ts +19 -0
- package/dist/stage/stageVisualTest.d.ts.map +1 -1
- package/dist/stage/stageVisualTest.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,13 +3,15 @@ import { getRefinementSize } from './SpatialElementRefinement.js';
|
|
|
3
3
|
import { getMinimapMeasurementMode } from './minimapMeasurement.js';
|
|
4
4
|
import { parseRenderMeasurement } from './renderMeasurement.js';
|
|
5
5
|
import { gaussianTargets } from './renderTargetInventory.js';
|
|
6
|
-
import { withRendererState, withVisibility } from './rendererState.js';
|
|
6
|
+
import { clearFullTarget, withRendererState, withVisibility } from './rendererState.js';
|
|
7
|
+
import { BackgroundLayerOutput } from './BackgroundLayerOutput.js';
|
|
8
|
+
import { CatalogWarmOutputContext } from '../catalog/CatalogWarmOutputContext.js';
|
|
7
9
|
import * as THREE from 'three/webgpu';
|
|
8
10
|
import { CatalogSpatialElementLayer } from '../catalog/CatalogSpatialElementLayer.js';
|
|
9
11
|
import { SpatialGeometryCapture } from '../catalog/SpatialGeometryCapture.js';
|
|
10
12
|
import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';
|
|
11
|
-
import { Fn, If, mix,
|
|
12
|
-
import { inverseAcesToneMapping, STAGE_TONE_MAPPING_EXPOSURE } from './LiquidGlassPanel.js';
|
|
13
|
+
import { Fn, If, mix, texture, uniform, uv, vec4 } from 'three/tsl';
|
|
14
|
+
import { inverseAcesToneMapping, LiquidGlassPanel, STAGE_TONE_MAPPING_EXPOSURE } from './LiquidGlassPanel.js';
|
|
13
15
|
import { isMesh } from './stageSceneUtils.js';
|
|
14
16
|
import { getStageRenderPixelRatio, resolveStageRenderSettings } from './renderSettings.js';
|
|
15
17
|
const SCROLL_RENDER_SCALE = 0.82;
|
|
@@ -27,9 +29,156 @@ export class StageRenderPipeline {
|
|
|
27
29
|
measuredBackdropSeeds = new WeakMap();
|
|
28
30
|
preparedZoomViews = new WeakSet();
|
|
29
31
|
disposed = false;
|
|
32
|
+
warmConfiguration = 0;
|
|
33
|
+
inactiveScrollWarmups = 0;
|
|
30
34
|
renderSettings = resolveStageRenderSettings();
|
|
35
|
+
backgroundOutputRequested = (() => {
|
|
36
|
+
const query = new URLSearchParams(typeof window === 'undefined' ? '' : window.location?.search ?? '');
|
|
37
|
+
return query.get('stage-test') === '1' && query.get('stage-background-output') === '1';
|
|
38
|
+
})();
|
|
39
|
+
backgroundOutputInitialized = false;
|
|
40
|
+
backgroundOutput;
|
|
41
|
+
catalogWarmOutput;
|
|
42
|
+
/** Called after renderer.init, before mounting or ever drawing the Background Canvas. */
|
|
43
|
+
initializeBackgroundOutput() {
|
|
44
|
+
if (!this.backgroundOutputRequested || this.backgroundOutputInitialized || this.disposed)
|
|
45
|
+
return;
|
|
46
|
+
this.backgroundOutputInitialized = true;
|
|
47
|
+
const renderer = this.ports.renderer, canvas = renderer.getCanvasTarget(), target = renderer.getRenderTarget();
|
|
48
|
+
try {
|
|
49
|
+
this.resizeCanvasTarget(this.ports.backgroundCanvasTarget, window.innerWidth, window.innerHeight, this.getFullPixelRatio());
|
|
50
|
+
this.backgroundOutput = BackgroundLayerOutput.create(this.ports.renderer, this.ports.backgroundCanvasTarget);
|
|
51
|
+
if (!this.backgroundOutput)
|
|
52
|
+
return;
|
|
53
|
+
try {
|
|
54
|
+
// Prepare the final Canvas-output owner during ordinary initialization,
|
|
55
|
+
// before there is any outgoing Canvas content to preserve.
|
|
56
|
+
if (!this.backgroundOutput.clearTransparent())
|
|
57
|
+
this.fallbackBackgroundOutput();
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
this.fallbackBackgroundOutput();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
renderer.setCanvasTarget(canvas);
|
|
65
|
+
renderer.setRenderTarget(target);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
invalidateCatalogWarmOutput() {
|
|
69
|
+
this.catalogWarmOutput?.dispose();
|
|
70
|
+
this.catalogWarmOutput = undefined;
|
|
71
|
+
}
|
|
72
|
+
fallbackBackgroundOutput() {
|
|
73
|
+
this.invalidateCatalogWarmOutput();
|
|
74
|
+
this.backgroundOutput?.selectFallback();
|
|
75
|
+
this.warmConfiguration++;
|
|
76
|
+
}
|
|
77
|
+
get backgroundOutputHeld() { return this.backgroundOutputRequested && this.ports.frame().outgoingBackground; }
|
|
78
|
+
/** Preparation/eligibility may acquire a lease. Diagnostics must use peek instead. */
|
|
79
|
+
ensureCatalogWarmOutputContext() {
|
|
80
|
+
const owner = this.backgroundOutput;
|
|
81
|
+
if (!owner || this.backgroundOutputHeld || this.disposed)
|
|
82
|
+
return;
|
|
83
|
+
if (owner.getStats().mode !== 'explicit') {
|
|
84
|
+
this.invalidateCatalogWarmOutput();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
return withRendererState(this.ports.renderer, () => {
|
|
88
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
89
|
+
if (this.catalogWarmOutput?.isCurrent(this.ports.renderer))
|
|
90
|
+
return this.catalogWarmOutput;
|
|
91
|
+
this.invalidateCatalogWarmOutput();
|
|
92
|
+
const handle = owner.captureScratch();
|
|
93
|
+
if (handle)
|
|
94
|
+
this.catalogWarmOutput = CatalogWarmOutputContext.createBorrowed(this.ports.renderer, handle, () => !this.disposed && this.backgroundOutput === owner);
|
|
95
|
+
if (!this.catalogWarmOutput)
|
|
96
|
+
this.fallbackBackgroundOutput();
|
|
97
|
+
return this.catalogWarmOutput;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
peekCatalogWarmOutputContext() { return this.catalogWarmOutput; }
|
|
101
|
+
getBackgroundOutputStats() {
|
|
102
|
+
// Query-gated diagnostics only: Map.has cannot allocate Three's implicit target.
|
|
103
|
+
const buffers = this.backgroundOutputRequested
|
|
104
|
+
? this.ports.renderer._frameBufferTargets : undefined;
|
|
105
|
+
return { requested: this.backgroundOutputRequested, initialized: this.backgroundOutputInitialized,
|
|
106
|
+
...(this.backgroundOutput?.getStats() ?? { mode: 'legacy' }),
|
|
107
|
+
held: this.backgroundOutputHeld,
|
|
108
|
+
targetTextureId: this.backgroundOutput?.getRenderTargets()[0]?.texture.uuid ?? null,
|
|
109
|
+
implicitBackgroundTarget: buffers instanceof Map ? Map.prototype.has.call(buffers, this.ports.backgroundCanvasTarget) : null,
|
|
110
|
+
catalogProfile: this.catalogWarmOutput?.profileKey ?? null,
|
|
111
|
+
catalogProfileCurrent: this.catalogWarmOutput?.isCurrent(this.ports.renderer) ?? false };
|
|
112
|
+
}
|
|
113
|
+
/** A held Canvas keeps both its pixels and dimensions until normal publication resumes. */
|
|
114
|
+
syncBackgroundOutputSize() {
|
|
115
|
+
const owner = this.backgroundOutput;
|
|
116
|
+
if (!owner || this.backgroundOutputHeld || owner.getStats().mode !== 'explicit')
|
|
117
|
+
return;
|
|
118
|
+
const canvas = this.ports.backgroundCanvasTarget, size = canvas.getSize(this.displaySize), ratio = this.getFullPixelRatio();
|
|
119
|
+
if (size.x !== window.innerWidth || size.y !== window.innerHeight || canvas.getPixelRatio() !== ratio) {
|
|
120
|
+
this.invalidateCatalogWarmOutput();
|
|
121
|
+
this.warmConfiguration++;
|
|
122
|
+
this.resizeCanvasTarget(canvas, window.innerWidth, window.innerHeight, ratio);
|
|
123
|
+
}
|
|
124
|
+
if (!owner.resize())
|
|
125
|
+
this.fallbackBackgroundOutput();
|
|
126
|
+
}
|
|
127
|
+
renderBackgroundOutput(publish = true) {
|
|
128
|
+
if (!this._stageDisplayQuad || (publish && this.backgroundOutputHeld))
|
|
129
|
+
return;
|
|
130
|
+
const owner = this.backgroundOutput;
|
|
131
|
+
if (owner?.getStats().mode === 'explicit') {
|
|
132
|
+
try {
|
|
133
|
+
if (owner.compose(this._stageDisplayQuad, () => this.renderBackgroundPanels(), publish))
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
catch { /* The experiment declines permanently; use the established output path. */ }
|
|
137
|
+
this.fallbackBackgroundOutput();
|
|
138
|
+
}
|
|
139
|
+
// Once the explicit owner declines, even a masked legacy Canvas draw can
|
|
140
|
+
// replace its presented image. Skip that optional warm pass while held.
|
|
141
|
+
if (!publish && this.backgroundOutputHeld)
|
|
142
|
+
return;
|
|
143
|
+
if (publish) {
|
|
144
|
+
this.renderStageDisplay();
|
|
145
|
+
this.renderBackgroundPanels();
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const renderer = this.ports.renderer, auto = renderer.autoClear;
|
|
149
|
+
try {
|
|
150
|
+
renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
151
|
+
renderer.setRenderTarget(null);
|
|
152
|
+
renderer.setScissor(new THREE.Vector4(0, 0, 0, 0));
|
|
153
|
+
renderer.setScissorTest(true);
|
|
154
|
+
renderer.autoClear = false;
|
|
155
|
+
this._stageDisplayQuad.render(renderer);
|
|
156
|
+
this.renderBackgroundPanels();
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
renderer.autoClear = auto;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
clearBackgroundOutput() {
|
|
164
|
+
if (this.backgroundOutputHeld)
|
|
165
|
+
return;
|
|
166
|
+
if (this.backgroundOutput?.getStats().mode === 'explicit') {
|
|
167
|
+
try {
|
|
168
|
+
if (this.backgroundOutput.clearTransparent())
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
catch { /* Terminal fallback, as for complete composition. */ }
|
|
172
|
+
this.fallbackBackgroundOutput();
|
|
173
|
+
}
|
|
174
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
175
|
+
this.ports.renderer.setRenderTarget(null);
|
|
176
|
+
this.ports.renderer.setClearColor(0, 0);
|
|
177
|
+
this.ports.renderer.clear();
|
|
178
|
+
}
|
|
31
179
|
/** Retain the last DETAIL background while its geometry is owned by a transition. */
|
|
32
180
|
freezeBackground() {
|
|
181
|
+
this.syncBackgroundOutputSize();
|
|
33
182
|
const targets = this._activeRenderTargets;
|
|
34
183
|
if (!targets)
|
|
35
184
|
return false;
|
|
@@ -39,8 +188,7 @@ export class StageRenderPipeline {
|
|
|
39
188
|
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
40
189
|
this.ports.renderer.setRenderTarget(targets.sceneCapture);
|
|
41
190
|
this.renderStageContents();
|
|
42
|
-
this.
|
|
43
|
-
this.renderBackgroundPanels();
|
|
191
|
+
this.renderBackgroundOutput();
|
|
44
192
|
});
|
|
45
193
|
return true;
|
|
46
194
|
}
|
|
@@ -82,6 +230,7 @@ export class StageRenderPipeline {
|
|
|
82
230
|
}
|
|
83
231
|
getRenderTargets() {
|
|
84
232
|
return [
|
|
233
|
+
...(this.backgroundOutput?.getRenderTargets() ?? []),
|
|
85
234
|
...(this.outlineMaskTarget ? [this.outlineMaskTarget] : []),
|
|
86
235
|
...[this.fullQualityTargets, this.scrollQualityTargets].flatMap((set) => set
|
|
87
236
|
? [
|
|
@@ -119,7 +268,9 @@ export class StageRenderPipeline {
|
|
|
119
268
|
this.updateInteractionTheme();
|
|
120
269
|
this.setRenderSettings(ports.renderSettings);
|
|
121
270
|
this.setPageBackground(ports.pageBackground ?? '#ffffff');
|
|
122
|
-
|
|
271
|
+
// NodeMaterial applies premultipliedAlpha in setupOutput. Supply straight
|
|
272
|
+
// RGB here; multiplying twice darkens the middle of the background reveal.
|
|
273
|
+
this.backgroundCoverMaterial.fragmentNode = vec4(inverseAcesToneMapping(this.backgroundCoverColor), this.backgroundCoverOpacity);
|
|
123
274
|
this.backgroundCoverMaterial.depthTest = this.backgroundCoverMaterial.depthWrite = false;
|
|
124
275
|
this.backgroundCoverMaterial.transparent =
|
|
125
276
|
this.backgroundCoverMaterial.premultipliedAlpha = true;
|
|
@@ -171,11 +322,14 @@ export class StageRenderPipeline {
|
|
|
171
322
|
_activeRenderTargets;
|
|
172
323
|
stageDisplayMaterial;
|
|
173
324
|
_stageDisplayQuad;
|
|
325
|
+
displayViewport = new THREE.Vector4();
|
|
326
|
+
displaySize = new THREE.Vector2();
|
|
174
327
|
stageDisplayTextureNode;
|
|
175
328
|
foregroundCanvasTarget;
|
|
176
329
|
carouselRearTarget;
|
|
177
330
|
carouselRearCanvas;
|
|
178
331
|
carouselRearSize = new THREE.Vector3();
|
|
332
|
+
carouselRearClear = false;
|
|
179
333
|
foregroundCanvas;
|
|
180
334
|
configureRenderer() {
|
|
181
335
|
this.ports.renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
@@ -186,7 +340,9 @@ export class StageRenderPipeline {
|
|
|
186
340
|
this.ports.backgroundCanvas.style.touchAction = 'pan-y';
|
|
187
341
|
}
|
|
188
342
|
renderCarouselRear() {
|
|
189
|
-
|
|
343
|
+
const layer = this.ports.catalogLayer();
|
|
344
|
+
const active = layer?.hasRearOutput() ?? false;
|
|
345
|
+
if (!this.carouselRearTarget && !active)
|
|
190
346
|
return;
|
|
191
347
|
if (!this.carouselRearTarget) {
|
|
192
348
|
const canvas = document.createElement('canvas');
|
|
@@ -198,18 +354,31 @@ export class StageRenderPipeline {
|
|
|
198
354
|
}
|
|
199
355
|
const target = this.carouselRearTarget;
|
|
200
356
|
const width = window.innerWidth, height = window.innerHeight, ratio = this.getFullPixelRatio();
|
|
201
|
-
|
|
357
|
+
const resized = (this.carouselRearSize.x !== width ||
|
|
202
358
|
this.carouselRearSize.y !== height ||
|
|
203
|
-
this.carouselRearSize.z !== ratio)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.ports.renderer
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
359
|
+
this.carouselRearSize.z !== ratio);
|
|
360
|
+
// Clear the formerly visible layer once. Keep its allocation for Back/Cancel,
|
|
361
|
+
// but do not switch canvases or submit empty passes on subsequent detail frames.
|
|
362
|
+
if (!active && this.carouselRearClear && !resized)
|
|
363
|
+
return;
|
|
364
|
+
withRendererState(this.ports.renderer, () => {
|
|
365
|
+
this.carouselRearClear = false;
|
|
366
|
+
if (resized) {
|
|
367
|
+
this.resizeCanvasTarget(target, width, height, ratio);
|
|
368
|
+
this.carouselRearSize.set(width, height, ratio);
|
|
369
|
+
}
|
|
370
|
+
this.ports.renderer.setCanvasTarget(target);
|
|
371
|
+
this.ports.renderer.setRenderTarget(null);
|
|
372
|
+
this.ports.renderer.setClearColor(0x000000, 0);
|
|
373
|
+
if (active)
|
|
374
|
+
this.ports.renderer.clear();
|
|
375
|
+
else
|
|
376
|
+
clearFullTarget(this.ports.renderer);
|
|
377
|
+
if (active)
|
|
378
|
+
layer.renderRear(this.ports.renderer);
|
|
379
|
+
else
|
|
380
|
+
this.carouselRearClear = true;
|
|
381
|
+
});
|
|
213
382
|
}
|
|
214
383
|
createForegroundCanvas() {
|
|
215
384
|
const canvas = document.createElement('canvas');
|
|
@@ -222,10 +391,7 @@ export class StageRenderPipeline {
|
|
|
222
391
|
}
|
|
223
392
|
createModelOutline(model) {
|
|
224
393
|
this.outlineMaskModel?.removeFromParent();
|
|
225
|
-
this.outlineMaskMaterial
|
|
226
|
-
this.outlineCompositeMaterial?.dispose();
|
|
227
|
-
this.outlineMaskTarget?.dispose();
|
|
228
|
-
this.outlineMaskMaterial = new THREE.MeshBasicMaterial({
|
|
394
|
+
this.outlineMaskMaterial ??= new THREE.MeshBasicMaterial({
|
|
229
395
|
color: 0xffffff,
|
|
230
396
|
depthTest: true,
|
|
231
397
|
depthWrite: true,
|
|
@@ -245,17 +411,22 @@ export class StageRenderPipeline {
|
|
|
245
411
|
});
|
|
246
412
|
this.outlineMaskModel = maskModel;
|
|
247
413
|
this.outlineMaskScene.add(maskModel);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
414
|
+
// Low/High changes replace the silhouette, not its viewport-sized storage.
|
|
415
|
+
// StageDisplay binds this sampler even while its opacity branch is zero;
|
|
416
|
+
// replacing it mid-reveal would recreate the texture and MSAA attachment.
|
|
417
|
+
if (!this.outlineMaskTarget) {
|
|
418
|
+
this.outlineMaskTarget = new THREE.RenderTarget(1, 1, {
|
|
419
|
+
depthBuffer: true,
|
|
420
|
+
stencilBuffer: false,
|
|
421
|
+
samples: 4
|
|
422
|
+
});
|
|
423
|
+
this.outlineMaskTarget.texture.minFilter = THREE.LinearFilter;
|
|
424
|
+
this.outlineMaskTarget.texture.magFilter = THREE.LinearFilter;
|
|
425
|
+
this.outlineMaskTarget.texture.generateMipmaps = false;
|
|
426
|
+
this.displayOutlineMask.value = this.outlineMaskTarget.texture;
|
|
427
|
+
this.outlineCompositeMaterial = this.createOutlineCompositeMaterial(this.outlineMaskTarget.texture);
|
|
428
|
+
this.outlineQuad = new THREE.QuadMesh(this.outlineCompositeMaterial);
|
|
429
|
+
}
|
|
259
430
|
// High refinement can replace the silhouette long after the last window resize.
|
|
260
431
|
this.resizeOutline(this.outlineWidth, this.outlineHeight);
|
|
261
432
|
}
|
|
@@ -286,6 +457,7 @@ export class StageRenderPipeline {
|
|
|
286
457
|
return material;
|
|
287
458
|
}
|
|
288
459
|
disposeSceneCapture() {
|
|
460
|
+
this.warmConfiguration++;
|
|
289
461
|
this.disposeRenderTargetSet(this.fullQualityTargets);
|
|
290
462
|
this.disposeRenderTargetSet(this.scrollQualityTargets);
|
|
291
463
|
this.stageDisplayMaterial?.dispose();
|
|
@@ -297,6 +469,7 @@ export class StageRenderPipeline {
|
|
|
297
469
|
this.stageDisplayTextureNode = undefined;
|
|
298
470
|
}
|
|
299
471
|
createSceneCapture() {
|
|
472
|
+
this.warmConfiguration++;
|
|
300
473
|
const blurKeys = new Set(this.ports.fallbackPanelOptions().map((options) => this.getPanelBlurKey(options)));
|
|
301
474
|
this.fullQualityTargets = this.createRenderTargetSet(1, blurKeys);
|
|
302
475
|
this.scrollQualityTargets = this.createRenderTargetSet(SCROLL_RENDER_SCALE, blurKeys);
|
|
@@ -360,11 +533,16 @@ export class StageRenderPipeline {
|
|
|
360
533
|
targets.panelBlurCaptures.clear();
|
|
361
534
|
}
|
|
362
535
|
resizeRenderTargets() {
|
|
536
|
+
this.warmConfiguration++;
|
|
363
537
|
const width = window.innerWidth;
|
|
364
538
|
const height = window.innerHeight;
|
|
365
539
|
const pixelRatio = this.getFullPixelRatio();
|
|
366
|
-
if (!this.ports.frame().outgoingBackground)
|
|
540
|
+
if (!this.ports.frame().outgoingBackground) {
|
|
541
|
+
this.invalidateCatalogWarmOutput();
|
|
367
542
|
this.resizeCanvasTarget(this.ports.backgroundCanvasTarget, width, height, pixelRatio);
|
|
543
|
+
if (this.backgroundOutput?.getStats().mode === 'explicit' && !this.backgroundOutput.resize())
|
|
544
|
+
this.fallbackBackgroundOutput();
|
|
545
|
+
}
|
|
368
546
|
if (this.foregroundCanvasTarget) {
|
|
369
547
|
this.resizeCanvasTarget(this.foregroundCanvasTarget, width, height, pixelRatio);
|
|
370
548
|
}
|
|
@@ -398,6 +576,7 @@ export class StageRenderPipeline {
|
|
|
398
576
|
return getStageRenderPixelRatio(window.innerWidth, window.innerHeight, window.devicePixelRatio, this.renderSettings);
|
|
399
577
|
}
|
|
400
578
|
setRenderSettings(settings) {
|
|
579
|
+
this.warmConfiguration++;
|
|
401
580
|
this.renderSettings = resolveStageRenderSettings(settings);
|
|
402
581
|
}
|
|
403
582
|
getRenderSettings() {
|
|
@@ -431,6 +610,7 @@ export class StageRenderPipeline {
|
|
|
431
610
|
});
|
|
432
611
|
}
|
|
433
612
|
warmRenderTargetSets() {
|
|
613
|
+
this.syncBackgroundOutputSize();
|
|
434
614
|
const previousTargets = this._activeRenderTargets;
|
|
435
615
|
const availableTargets = [this.fullQualityTargets, this.scrollQualityTargets].filter((targets) => Boolean(targets));
|
|
436
616
|
if (!previousTargets || !this._stageDisplayQuad || availableTargets.length !== 2)
|
|
@@ -449,8 +629,7 @@ export class StageRenderPipeline {
|
|
|
449
629
|
this.ports.renderer.setRenderTarget(targets.sceneCapture);
|
|
450
630
|
this.ports.renderStage();
|
|
451
631
|
this.renderPanelBlurCaptures(targets, true);
|
|
452
|
-
this.
|
|
453
|
-
this.renderBackgroundPanels();
|
|
632
|
+
this.renderBackgroundOutput(!this.backgroundOutputHeld);
|
|
454
633
|
this._renderTargetSetWarmups += 1;
|
|
455
634
|
});
|
|
456
635
|
});
|
|
@@ -459,10 +638,166 @@ export class StageRenderPipeline {
|
|
|
459
638
|
this.activateRenderTargetSet(previousTargets);
|
|
460
639
|
}
|
|
461
640
|
}
|
|
641
|
+
/** Capture immediately after reveal's real warm draws, before its GPU fence.
|
|
642
|
+
* The facade publishes this only after that fence and its page-owner check.
|
|
643
|
+
*/
|
|
644
|
+
captureDeferredScrollWarmup(ownerIsCurrent) {
|
|
645
|
+
const renderer = this.ports.renderer, full = this.fullQualityTargets, scroll = this.scrollQualityTargets;
|
|
646
|
+
// The explicit output has a different warmed display owner. Retain the full
|
|
647
|
+
// preparation path until its no-write Scroll shortcut is separately proven.
|
|
648
|
+
if (this.backgroundOutputRequested)
|
|
649
|
+
return;
|
|
650
|
+
if (this.disposed || !full || !scroll || this._activeRenderTargets !== full || !this._stageDisplayQuad || !this.stageDisplayMaterial ||
|
|
651
|
+
!renderer.backend.isWebGPUBackend ||
|
|
652
|
+
renderer.xr.enabled || renderer.getOutputRenderTarget() || renderer.getMRT() || renderer.getRenderObjectFunction() ||
|
|
653
|
+
this.ports.panelScene.background || this.ports.panelScene.overrideMaterial ||
|
|
654
|
+
!ownerIsCurrent())
|
|
655
|
+
return;
|
|
656
|
+
const epoch = this.warmConfiguration, canvas = this.ports.backgroundCanvasTarget, quad = this._stageDisplayQuad, display = this.stageDisplayMaterial, displayVersion = display.version;
|
|
657
|
+
const width = window.innerWidth, height = window.innerHeight, dpr = window.devicePixelRatio;
|
|
658
|
+
const canvasSize = canvas.getDrawingBufferSize(new THREE.Vector2()), canvasViewport = canvas.getViewport(new THREE.Vector4()), canvasRatio = canvas.getPixelRatio(), currentSize = new THREE.Vector2(), currentViewport = new THREE.Vector4();
|
|
659
|
+
const tone = renderer.toneMapping, exposure = renderer.toneMappingExposure, space = renderer.outputColorSpace;
|
|
660
|
+
const panels = [...this.ports.panelRuntimes()], views = [...this.ports.minimaps().values()];
|
|
661
|
+
const panelOwners = panels.map(panel => ({ panel, glass: panel.glass, group: panel.group, projection: panel.projectionRoot, options: panel.options, surface: panel.surface }));
|
|
662
|
+
const materials = [];
|
|
663
|
+
const groups = [];
|
|
664
|
+
const allowed = new Set([this.ports.panelScene]);
|
|
665
|
+
for (const panel of panels) {
|
|
666
|
+
for (let node = panel.group; node && node !== this.ports.panelScene; node = node.parent)
|
|
667
|
+
allowed.add(node);
|
|
668
|
+
if (!panel.glass)
|
|
669
|
+
continue;
|
|
670
|
+
if (!(panel.glass instanceof LiquidGlassPanel) || !panel.glass.hasOwnedRenderGraph())
|
|
671
|
+
return;
|
|
672
|
+
let supported = true;
|
|
673
|
+
panel.group.traverse(node => {
|
|
674
|
+
allowed.add(node);
|
|
675
|
+
groups.push({ node, children: [...node.children] });
|
|
676
|
+
if (!isMesh(node))
|
|
677
|
+
return;
|
|
678
|
+
const material = node.material;
|
|
679
|
+
if (Array.isArray(material) || !(material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshBasicNodeMaterial) ||
|
|
680
|
+
node.onBeforeRender !== THREE.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE.Object3D.prototype.onAfterRender) {
|
|
681
|
+
supported = false;
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
materials.push({ mesh: node, material, version: material.version });
|
|
685
|
+
});
|
|
686
|
+
if (!supported)
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
let controlledScene = true;
|
|
690
|
+
this.ports.panelScene.traverse(node => {
|
|
691
|
+
if ((!allowed.has(node) && !(node instanceof THREE.Light && !node.castShadow)) ||
|
|
692
|
+
node.onBeforeRender !== THREE.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE.Object3D.prototype.onAfterRender)
|
|
693
|
+
controlledScene = false;
|
|
694
|
+
groups.push({ node, children: [...node.children] });
|
|
695
|
+
});
|
|
696
|
+
if (!controlledScene)
|
|
697
|
+
return;
|
|
698
|
+
const targets = [full, scroll].flatMap(set => [set.sceneCapture, ...[...set.panelBlurCaptures.values()].map(capture => capture.target)])
|
|
699
|
+
.map(target => ({ target, width: target.width, height: target.height }));
|
|
700
|
+
return { owner: this, used: false, current: () => !this.disposed && ownerIsCurrent() && this.warmConfiguration === epoch &&
|
|
701
|
+
this.fullQualityTargets === full && this.scrollQualityTargets === scroll && this._activeRenderTargets === full &&
|
|
702
|
+
this._stageDisplayQuad === quad && quad.material === display && display.version === displayVersion && this.ports.backgroundCanvasTarget === canvas &&
|
|
703
|
+
window.innerWidth === width && window.innerHeight === height && window.devicePixelRatio === dpr &&
|
|
704
|
+
canvas.getPixelRatio() === canvasRatio && canvas.getDrawingBufferSize(currentSize).equals(canvasSize) && canvas.getViewport(currentViewport).equals(canvasViewport) &&
|
|
705
|
+
!renderer.xr.enabled && !renderer.getOutputRenderTarget() && !renderer.getMRT() && !renderer.getRenderObjectFunction() &&
|
|
706
|
+
!this.ports.panelScene.background && !this.ports.panelScene.overrideMaterial &&
|
|
707
|
+
renderer.toneMapping === tone && renderer.toneMappingExposure === exposure && renderer.outputColorSpace === space &&
|
|
708
|
+
!this.ports.frame().outgoingBackground &&
|
|
709
|
+
panels.length === this.ports.panelRuntimes().length && panels.every((panel, i) => panel === this.ports.panelRuntimes()[i]) &&
|
|
710
|
+
panelOwners.every(({ panel, glass, group, projection, options, surface }) => panel.glass === glass && panel.group === group &&
|
|
711
|
+
panel.projectionRoot === projection && panel.options === options && panel.surface === surface && (!glass || glass.hasOwnedRenderGraph())) &&
|
|
712
|
+
views.length === this.ports.minimaps().size && views.every(view => this.ports.minimaps().get(view.panelIndex) === view) &&
|
|
713
|
+
materials.every(({ mesh, material, version }) => mesh.material === material && material.version === version) &&
|
|
714
|
+
groups.every(({ node, children }) => node.onBeforeRender === THREE.Object3D.prototype.onBeforeRender &&
|
|
715
|
+
node.onAfterRender === THREE.Object3D.prototype.onAfterRender && node.children.length === children.length && children.every((child, i) => node.children[i] === child)) &&
|
|
716
|
+
targets.every(({ target, width, height }) => target.width === width && target.height === height) };
|
|
717
|
+
}
|
|
718
|
+
/** Warm only inactive Scroll resources without writing Canvas color/depth.
|
|
719
|
+
* A stale token performs no mutation; the caller retains the complete warm path.
|
|
720
|
+
*/
|
|
721
|
+
warmInactiveScrollTargetSet(token) {
|
|
722
|
+
if (token.owner !== this || token.used || !token.current())
|
|
723
|
+
return false;
|
|
724
|
+
token.used = true;
|
|
725
|
+
const previous = this._activeRenderTargets, renderer = this.ports.renderer;
|
|
726
|
+
const autoClear = renderer.autoClear;
|
|
727
|
+
try {
|
|
728
|
+
withRendererState(renderer, () => {
|
|
729
|
+
renderer.autoClear = false;
|
|
730
|
+
this.activateRenderTargetSet(this.scrollQualityTargets);
|
|
731
|
+
renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
732
|
+
renderer.setScissorTest(false);
|
|
733
|
+
renderer.setRenderTarget(this.scrollQualityTargets.sceneCapture);
|
|
734
|
+
this.ports.renderStage();
|
|
735
|
+
this.renderPanelBlurCaptures(this.scrollQualityTargets, true);
|
|
736
|
+
// Full reveal already drew the same display/panel materials and Canvas
|
|
737
|
+
// contexts. Scroll only replaces their sampled textures with matching
|
|
738
|
+
// types/filters. Keep preparation entirely offscreen; it must not
|
|
739
|
+
// acquire or publish another Canvas output texture.
|
|
740
|
+
this._renderTargetSetWarmups++;
|
|
741
|
+
this.inactiveScrollWarmups++;
|
|
742
|
+
});
|
|
743
|
+
return true;
|
|
744
|
+
}
|
|
745
|
+
finally {
|
|
746
|
+
renderer.autoClear = autoClear;
|
|
747
|
+
this.activateRenderTargetSet(previous);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
/** Warm the bound DETAIL's actual reveal passes while its DOM remains hidden.
|
|
751
|
+
* Unlike optional scroll/zoom preparation this uses only the active target set.
|
|
752
|
+
* Offscreen captures receive real pixels; Canvas pipelines keep their exact
|
|
753
|
+
* output context but a zero-area scissor prevents any visible warm-up draw.
|
|
754
|
+
*/
|
|
755
|
+
warmRevealFrame() {
|
|
756
|
+
const targets = this._activeRenderTargets;
|
|
757
|
+
if (this.disposed || !targets || !this._stageDisplayQuad || !this.foregroundCanvasTarget)
|
|
758
|
+
return false;
|
|
759
|
+
return withRendererState(this.ports.renderer, () => {
|
|
760
|
+
const renderer = this.ports.renderer;
|
|
761
|
+
renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
762
|
+
renderer.setRenderTarget(targets.sceneCapture);
|
|
763
|
+
renderer.setScissorTest(false);
|
|
764
|
+
this.ports.renderStage();
|
|
765
|
+
this.renderPanelBlurCaptures(targets, true);
|
|
766
|
+
const maskCanvas = (canvas) => {
|
|
767
|
+
renderer.setCanvasTarget(canvas);
|
|
768
|
+
renderer.setRenderTarget(null);
|
|
769
|
+
renderer.setScissor(new THREE.Vector4(0, 0, 0, 0));
|
|
770
|
+
renderer.setScissorTest(true);
|
|
771
|
+
};
|
|
772
|
+
// Explicit output composition stays offscreen, without publishing over
|
|
773
|
+
// the source Canvas. The legacy path retains its masked, clear-free draw.
|
|
774
|
+
this.renderBackgroundOutput(false);
|
|
775
|
+
maskCanvas(this.foregroundCanvasTarget);
|
|
776
|
+
this.renderMinimapScene();
|
|
777
|
+
return true;
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
/** Borrow the already selected scene output after all warm live passes. */
|
|
781
|
+
withSceneCapture(draw) {
|
|
782
|
+
const targets = this._activeRenderTargets;
|
|
783
|
+
if (this.disposed || !targets)
|
|
784
|
+
return;
|
|
785
|
+
return withRendererState(this.ports.renderer, () => {
|
|
786
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
787
|
+
this.ports.renderer.setRenderTarget(targets.sceneCapture);
|
|
788
|
+
this.ports.renderer.setScissorTest(false);
|
|
789
|
+
return draw();
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
isSceneCaptureCurrent(target, width, height) {
|
|
793
|
+
return !this.disposed && this._activeRenderTargets?.sceneCapture === target && target.width === width && target.height === height;
|
|
794
|
+
}
|
|
462
795
|
resizeCanvasTarget(target, width, height, pixelRatio) {
|
|
463
796
|
this.ports.renderer.setCanvasTarget(target);
|
|
464
797
|
this.ports.renderer.setPixelRatio(pixelRatio);
|
|
465
|
-
|
|
798
|
+
// The CSS display rectangle must match the camera/buffer even while mobile
|
|
799
|
+
// browser chrome animates. 100vh can represent a different viewport height.
|
|
800
|
+
this.ports.renderer.setSize(width, height, true);
|
|
466
801
|
}
|
|
467
802
|
createPanelBlurCapture(sceneTexture, blur, renderScale) {
|
|
468
803
|
const target = new THREE.RenderTarget(1, 1, {
|
|
@@ -501,6 +836,7 @@ export class StageRenderPipeline {
|
|
|
501
836
|
}
|
|
502
837
|
/** Allocate changed blur settings without replacing the scene capture or model resources. */
|
|
503
838
|
syncPanelBlurCaptures() {
|
|
839
|
+
this.warmConfiguration++;
|
|
504
840
|
const keys = new Set(this.ports.fallbackPanelOptions().map((options) => this.getPanelBlurKey(options)));
|
|
505
841
|
if (!this._activeRenderTargets && keys.size)
|
|
506
842
|
this.createSceneCapture();
|
|
@@ -775,14 +1111,51 @@ export class StageRenderPipeline {
|
|
|
775
1111
|
renderStageDisplay() {
|
|
776
1112
|
if (!this._stageDisplayQuad)
|
|
777
1113
|
return;
|
|
778
|
-
this.ports
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
this.
|
|
1114
|
+
const { renderer, backgroundCanvasTarget } = this.ports;
|
|
1115
|
+
renderer.setRenderTarget(null);
|
|
1116
|
+
renderer.setCanvasTarget(backgroundCanvasTarget);
|
|
1117
|
+
renderer.setClearColor(0xffffff, 1);
|
|
1118
|
+
if (!this.canClearWithStageDisplay()) {
|
|
1119
|
+
renderer.clear();
|
|
1120
|
+
this._stageDisplayQuad.render(renderer);
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
// Only this opaque, depth-independent fullscreen copy has no nested scene
|
|
1124
|
+
// rendering. Include its clear in the same render pass, avoiding the manual
|
|
1125
|
+
// Canvas clear's separate pass and intermediate output-color-transform draw.
|
|
1126
|
+
const { autoClear, autoClearColor, autoClearDepth, autoClearStencil } = renderer;
|
|
1127
|
+
try {
|
|
1128
|
+
renderer.autoClear = renderer.autoClearColor = renderer.autoClearDepth = renderer.autoClearStencil = true;
|
|
1129
|
+
this._stageDisplayQuad.render(renderer);
|
|
1130
|
+
}
|
|
1131
|
+
finally {
|
|
1132
|
+
renderer.autoClear = autoClear;
|
|
1133
|
+
renderer.autoClearColor = autoClearColor;
|
|
1134
|
+
renderer.autoClearDepth = autoClearDepth;
|
|
1135
|
+
renderer.autoClearStencil = autoClearStencil;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
canClearWithStageDisplay() {
|
|
1139
|
+
const { renderer, backgroundCanvasTarget } = this.ports;
|
|
1140
|
+
// Deliberately retain explicit clearing for unproved output configurations.
|
|
1141
|
+
if (!renderer.backend?.isWebGPUBackend ||
|
|
1142
|
+
renderer.xr.isPresenting || renderer.stencil || renderer.reversedDepthBuffer ||
|
|
1143
|
+
renderer.getClearDepth() !== 1 || renderer.getClearStencil() !== 0 ||
|
|
1144
|
+
renderer.getOutputRenderTarget() !== null || renderer.getMRT() !== null ||
|
|
1145
|
+
backgroundCanvasTarget.getScissorTest())
|
|
1146
|
+
return false;
|
|
1147
|
+
const viewport = backgroundCanvasTarget.getViewport(this.displayViewport);
|
|
1148
|
+
const size = backgroundCanvasTarget.getSize(this.displaySize);
|
|
1149
|
+
return size.x > 0 && size.y > 0 && viewport.x === 0 && viewport.y === 0 &&
|
|
1150
|
+
viewport.z === size.x && viewport.w === size.y;
|
|
783
1151
|
}
|
|
784
1152
|
renderStageContents() {
|
|
785
1153
|
this.ports.renderer.clear();
|
|
1154
|
+
if (this.ports.frame().detailMediaActive === false) {
|
|
1155
|
+
this.backgroundCoverOpacity.value = 1;
|
|
1156
|
+
this.backgroundCover.render(this.ports.renderer);
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
786
1159
|
this.ports.renderer.render(this.ports.backgroundScene, this.ports.camera);
|
|
787
1160
|
this.ports.renderer.render(this.ports.tintScene, this.ports.tintCamera);
|
|
788
1161
|
this.backgroundCoverOpacity.value = 1 - this.ports.frame().backgroundReveal;
|
|
@@ -826,6 +1199,8 @@ export class StageRenderPipeline {
|
|
|
826
1199
|
if (this.disposed)
|
|
827
1200
|
return;
|
|
828
1201
|
this.disposed = true;
|
|
1202
|
+
this.invalidateCatalogWarmOutput();
|
|
1203
|
+
this.backgroundOutput?.dispose();
|
|
829
1204
|
this.releaseOutline();
|
|
830
1205
|
this.emptyOutlineMask.dispose();
|
|
831
1206
|
this.disposeSceneCapture();
|
|
@@ -856,6 +1231,7 @@ export class StageRenderPipeline {
|
|
|
856
1231
|
get renderTargetSetWarmups() {
|
|
857
1232
|
return this._renderTargetSetWarmups;
|
|
858
1233
|
}
|
|
1234
|
+
get deferredScrollWarmups() { return this.inactiveScrollWarmups; }
|
|
859
1235
|
get stageModelRenderPasses() {
|
|
860
1236
|
return this._stageModelRenderPasses;
|
|
861
1237
|
}
|
|
@@ -871,13 +1247,15 @@ export class StageRenderPipeline {
|
|
|
871
1247
|
/** The facade advances owners first; this command submits the ordered GPU passes. */
|
|
872
1248
|
renderFrame(contentOnly, outline) {
|
|
873
1249
|
this.displayOutlineOpacity.value = 0;
|
|
1250
|
+
// After a held resize, update before the outer state snapshot so restoring
|
|
1251
|
+
// that scope cannot put the obsolete viewport back on the resized Canvas.
|
|
1252
|
+
this.syncBackgroundOutputSize();
|
|
874
1253
|
return withRendererState(this.ports.renderer, () => {
|
|
875
1254
|
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
876
1255
|
if (contentOnly) {
|
|
877
1256
|
this.ports.renderer.setRenderTarget(null);
|
|
878
1257
|
if (!this.ports.frame().outgoingBackground) {
|
|
879
|
-
this.
|
|
880
|
-
this.ports.renderer.clear();
|
|
1258
|
+
this.clearBackgroundOutput();
|
|
881
1259
|
}
|
|
882
1260
|
}
|
|
883
1261
|
else {
|
|
@@ -886,10 +1264,9 @@ export class StageRenderPipeline {
|
|
|
886
1264
|
this.ports.renderer.setRenderTarget(this._activeRenderTargets.sceneCapture);
|
|
887
1265
|
this.ports.renderStage();
|
|
888
1266
|
this.renderPanelBlurCaptures(this._activeRenderTargets);
|
|
889
|
-
if (outline)
|
|
1267
|
+
if (outline && this.ports.frame().detailMediaActive !== false)
|
|
890
1268
|
this.renderModelOutline(this._activeRenderTargets.sceneCapture, 1);
|
|
891
|
-
this.
|
|
892
|
-
this.renderBackgroundPanels();
|
|
1269
|
+
this.renderBackgroundOutput();
|
|
893
1270
|
}
|
|
894
1271
|
this.renderCarouselRear();
|
|
895
1272
|
this.renderForegroundLayer();
|