@spatial-elements/core 0.1.0-beta.1
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/LICENSE +373 -0
- package/README.md +17 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts +24 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -0
- package/dist/catalog/CarouselGlassCompositor.js +132 -0
- package/dist/catalog/CarouselGlassCompositor.js.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts +59 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.js +187 -0
- package/dist/catalog/CatalogEndpointRegistry.js.map +1 -0
- package/dist/catalog/CatalogGeometryFade.d.ts +12 -0
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -0
- package/dist/catalog/CatalogGeometryFade.js +67 -0
- package/dist/catalog/CatalogGeometryFade.js.map +1 -0
- package/dist/catalog/CatalogPreparation.d.ts +40 -0
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -0
- package/dist/catalog/CatalogPreparation.js +141 -0
- package/dist/catalog/CatalogPreparation.js.map +1 -0
- package/dist/catalog/CatalogSections.d.ts +36 -0
- package/dist/catalog/CatalogSections.d.ts.map +1 -0
- package/dist/catalog/CatalogSections.js +51 -0
- package/dist/catalog/CatalogSections.js.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +149 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.js +920 -0
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -0
- package/dist/catalog/CatalogTransition.d.ts +93 -0
- package/dist/catalog/CatalogTransition.d.ts.map +1 -0
- package/dist/catalog/CatalogTransition.js +1299 -0
- package/dist/catalog/CatalogTransition.js.map +1 -0
- package/dist/catalog/EnvironmentCache.d.ts +30 -0
- package/dist/catalog/EnvironmentCache.d.ts.map +1 -0
- package/dist/catalog/EnvironmentCache.js +128 -0
- package/dist/catalog/EnvironmentCache.js.map +1 -0
- package/dist/catalog/PreparationGate.d.ts +10 -0
- package/dist/catalog/PreparationGate.d.ts.map +1 -0
- package/dist/catalog/PreparationGate.js +66 -0
- package/dist/catalog/PreparationGate.js.map +1 -0
- package/dist/catalog/PresentationLease.d.ts +16 -0
- package/dist/catalog/PresentationLease.d.ts.map +1 -0
- package/dist/catalog/PresentationLease.js +33 -0
- package/dist/catalog/PresentationLease.js.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts +63 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.js +158 -0
- package/dist/catalog/SpatialGeometryCapture.js.map +1 -0
- package/dist/catalog/assets/SpatialElementAssetManager.d.ts +92 -0
- package/dist/catalog/assets/SpatialElementAssetManager.d.ts.map +1 -0
- package/dist/catalog/assets/SpatialElementAssetManager.js +305 -0
- package/dist/catalog/assets/SpatialElementAssetManager.js.map +1 -0
- package/dist/catalog/assets/assetCosts.d.ts +4 -0
- package/dist/catalog/assets/assetCosts.d.ts.map +1 -0
- package/dist/catalog/assets/assetCosts.js +33 -0
- package/dist/catalog/assets/assetCosts.js.map +1 -0
- package/dist/catalog/assets/spatialElementAssetResources.d.ts +25 -0
- package/dist/catalog/assets/spatialElementAssetResources.d.ts.map +1 -0
- package/dist/catalog/assets/spatialElementAssetResources.js +100 -0
- package/dist/catalog/assets/spatialElementAssetResources.js.map +1 -0
- package/dist/catalog/carouselPanelProjection.d.ts +9 -0
- package/dist/catalog/carouselPanelProjection.d.ts.map +1 -0
- package/dist/catalog/carouselPanelProjection.js +33 -0
- package/dist/catalog/carouselPanelProjection.js.map +1 -0
- package/dist/catalog/carouselSelection.d.ts +7 -0
- package/dist/catalog/carouselSelection.d.ts.map +1 -0
- package/dist/catalog/carouselSelection.js +15 -0
- package/dist/catalog/carouselSelection.js.map +1 -0
- package/dist/catalog/catalogAction.d.ts +4 -0
- package/dist/catalog/catalogAction.d.ts.map +1 -0
- package/dist/catalog/catalogAction.js +9 -0
- package/dist/catalog/catalogAction.js.map +1 -0
- package/dist/catalog/catalogGeometryRequest.d.ts +13 -0
- package/dist/catalog/catalogGeometryRequest.d.ts.map +1 -0
- package/dist/catalog/catalogGeometryRequest.js +8 -0
- package/dist/catalog/catalogGeometryRequest.js.map +1 -0
- package/dist/catalog/catalogItems.d.ts +10 -0
- package/dist/catalog/catalogItems.d.ts.map +1 -0
- package/dist/catalog/catalogItems.js +23 -0
- package/dist/catalog/catalogItems.js.map +1 -0
- package/dist/catalog/catalogJourney.d.ts +38 -0
- package/dist/catalog/catalogJourney.d.ts.map +1 -0
- package/dist/catalog/catalogJourney.js +64 -0
- package/dist/catalog/catalogJourney.js.map +1 -0
- package/dist/catalog/catalogPage.d.ts +11 -0
- package/dist/catalog/catalogPage.d.ts.map +1 -0
- package/dist/catalog/catalogPage.js +2 -0
- package/dist/catalog/catalogPage.js.map +1 -0
- package/dist/catalog/catalogPose.d.ts +30 -0
- package/dist/catalog/catalogPose.d.ts.map +1 -0
- package/dist/catalog/catalogPose.js +35 -0
- package/dist/catalog/catalogPose.js.map +1 -0
- package/dist/catalog/catalogPresentation.d.ts +24 -0
- package/dist/catalog/catalogPresentation.d.ts.map +1 -0
- package/dist/catalog/catalogPresentation.js +56 -0
- package/dist/catalog/catalogPresentation.js.map +1 -0
- package/dist/catalog/catalogRecipes.d.ts +21 -0
- package/dist/catalog/catalogRecipes.d.ts.map +1 -0
- package/dist/catalog/catalogRecipes.js +84 -0
- package/dist/catalog/catalogRecipes.js.map +1 -0
- package/dist/catalog/catalogSurfaceCapture.d.ts +11 -0
- package/dist/catalog/catalogSurfaceCapture.d.ts.map +1 -0
- package/dist/catalog/catalogSurfaceCapture.js +11 -0
- package/dist/catalog/catalogSurfaceCapture.js.map +1 -0
- package/dist/catalog/catalogViewLink.d.ts +8 -0
- package/dist/catalog/catalogViewLink.d.ts.map +1 -0
- package/dist/catalog/catalogViewLink.js +37 -0
- package/dist/catalog/catalogViewLink.js.map +1 -0
- package/dist/catalog/rebasePresentation.d.ts +3 -0
- package/dist/catalog/rebasePresentation.d.ts.map +1 -0
- package/dist/catalog/rebasePresentation.js +26 -0
- package/dist/catalog/rebasePresentation.js.map +1 -0
- package/dist/catalog/spatialElementAssets.d.ts +158 -0
- package/dist/catalog/spatialElementAssets.d.ts.map +1 -0
- package/dist/catalog/spatialElementAssets.js +92 -0
- package/dist/catalog/spatialElementAssets.js.map +1 -0
- package/dist/catalog/spatialElementLodPair.d.ts +17 -0
- package/dist/catalog/spatialElementLodPair.d.ts.map +1 -0
- package/dist/catalog/spatialElementLodPair.js +5 -0
- package/dist/catalog/spatialElementLodPair.js.map +1 -0
- package/dist/catalog/transitionTiming.d.ts +15 -0
- package/dist/catalog/transitionTiming.d.ts.map +1 -0
- package/dist/catalog/transitionTiming.js +22 -0
- package/dist/catalog/transitionTiming.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts +101 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.js +627 -0
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -0
- package/dist/spatial-element/spatialElement.d.ts +28 -0
- package/dist/spatial-element/spatialElement.d.ts.map +1 -0
- package/dist/spatial-element/spatialElement.js +45 -0
- package/dist/spatial-element/spatialElement.js.map +1 -0
- package/dist/spatial-element/spatialElementDock.d.ts +43 -0
- package/dist/spatial-element/spatialElementDock.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementDock.js +126 -0
- package/dist/spatial-element/spatialElementDock.js.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts +29 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.js +67 -0
- package/dist/spatial-element/spatialElementSectionRegistry.js.map +1 -0
- package/dist/spatial-element/types.d.ts +165 -0
- package/dist/spatial-element/types.d.ts.map +1 -0
- package/dist/spatial-element/types.js +2 -0
- package/dist/spatial-element/types.js.map +1 -0
- package/dist/stage/LiquidGlassPanel.d.ts +55 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -0
- package/dist/stage/LiquidGlassPanel.js +447 -0
- package/dist/stage/LiquidGlassPanel.js.map +1 -0
- package/dist/stage/MinimapBlurPipeline.d.ts +34 -0
- package/dist/stage/MinimapBlurPipeline.d.ts.map +1 -0
- package/dist/stage/MinimapBlurPipeline.js +147 -0
- package/dist/stage/MinimapBlurPipeline.js.map +1 -0
- package/dist/stage/MinimapController.d.ts +113 -0
- package/dist/stage/MinimapController.d.ts.map +1 -0
- package/dist/stage/MinimapController.js +803 -0
- package/dist/stage/MinimapController.js.map +1 -0
- package/dist/stage/OrbitControlsInterop.d.ts +8 -0
- package/dist/stage/OrbitControlsInterop.d.ts.map +1 -0
- package/dist/stage/OrbitControlsInterop.js +19 -0
- package/dist/stage/OrbitControlsInterop.js.map +1 -0
- package/dist/stage/PageBindingController.d.ts +41 -0
- package/dist/stage/PageBindingController.d.ts.map +1 -0
- package/dist/stage/PageBindingController.js +92 -0
- package/dist/stage/PageBindingController.js.map +1 -0
- package/dist/stage/PanelPresentationController.d.ts +92 -0
- package/dist/stage/PanelPresentationController.d.ts.map +1 -0
- package/dist/stage/PanelPresentationController.js +569 -0
- package/dist/stage/PanelPresentationController.js.map +1 -0
- package/dist/stage/PresentationReadiness.d.ts +30 -0
- package/dist/stage/PresentationReadiness.d.ts.map +1 -0
- package/dist/stage/PresentationReadiness.js +94 -0
- package/dist/stage/PresentationReadiness.js.map +1 -0
- package/dist/stage/SpaceMouseAdapter.d.ts +76 -0
- package/dist/stage/SpaceMouseAdapter.d.ts.map +1 -0
- package/dist/stage/SpaceMouseAdapter.js +197 -0
- package/dist/stage/SpaceMouseAdapter.js.map +1 -0
- package/dist/stage/SpatialElementInteractionController.d.ts +126 -0
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -0
- package/dist/stage/SpatialElementInteractionController.js +581 -0
- package/dist/stage/SpatialElementInteractionController.js.map +1 -0
- package/dist/stage/SpatialElementPresentationController.d.ts +82 -0
- package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -0
- package/dist/stage/SpatialElementPresentationController.js +372 -0
- package/dist/stage/SpatialElementPresentationController.js.map +1 -0
- package/dist/stage/SpatialElementRefinement.d.ts +26 -0
- package/dist/stage/SpatialElementRefinement.d.ts.map +1 -0
- package/dist/stage/SpatialElementRefinement.js +105 -0
- package/dist/stage/SpatialElementRefinement.js.map +1 -0
- package/dist/stage/StageExperience.d.ts +536 -0
- package/dist/stage/StageExperience.d.ts.map +1 -0
- package/dist/stage/StageExperience.js +2399 -0
- package/dist/stage/StageExperience.js.map +1 -0
- package/dist/stage/StagePanelLayout.d.ts +15 -0
- package/dist/stage/StagePanelLayout.d.ts.map +1 -0
- package/dist/stage/StagePanelLayout.js +20 -0
- package/dist/stage/StagePanelLayout.js.map +1 -0
- package/dist/stage/StagePanelRuntime.d.ts +20 -0
- package/dist/stage/StagePanelRuntime.d.ts.map +1 -0
- package/dist/stage/StagePanelRuntime.js +2 -0
- package/dist/stage/StagePanelRuntime.js.map +1 -0
- package/dist/stage/StageRenderPipeline.d.ts +179 -0
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -0
- package/dist/stage/StageRenderPipeline.js +901 -0
- package/dist/stage/StageRenderPipeline.js.map +1 -0
- package/dist/stage/VirtualScrollController.d.ts +64 -0
- package/dist/stage/VirtualScrollController.d.ts.map +1 -0
- package/dist/stage/VirtualScrollController.js +329 -0
- package/dist/stage/VirtualScrollController.js.map +1 -0
- package/dist/stage/cssProjection.d.ts +18 -0
- package/dist/stage/cssProjection.d.ts.map +1 -0
- package/dist/stage/cssProjection.js +52 -0
- package/dist/stage/cssProjection.js.map +1 -0
- package/dist/stage/damping.d.ts +3 -0
- package/dist/stage/damping.d.ts.map +1 -0
- package/dist/stage/damping.js +8 -0
- package/dist/stage/damping.js.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts +31 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.js +163 -0
- package/dist/stage/minimap/MinimapGeometry.js.map +1 -0
- package/dist/stage/minimap/MinimapModel.d.ts +16 -0
- package/dist/stage/minimap/MinimapModel.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapModel.js +51 -0
- package/dist/stage/minimap/MinimapModel.js.map +1 -0
- package/dist/stage/minimap/MinimapProjection.d.ts +41 -0
- package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapProjection.js +113 -0
- package/dist/stage/minimap/MinimapProjection.js.map +1 -0
- package/dist/stage/minimap/MinimapState.d.ts +102 -0
- package/dist/stage/minimap/MinimapState.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapState.js +2 -0
- package/dist/stage/minimap/MinimapState.js.map +1 -0
- package/dist/stage/minimapMeasurement.d.ts +5 -0
- package/dist/stage/minimapMeasurement.d.ts.map +1 -0
- package/dist/stage/minimapMeasurement.js +11 -0
- package/dist/stage/minimapMeasurement.js.map +1 -0
- package/dist/stage/panelContext.d.ts +71 -0
- package/dist/stage/panelContext.d.ts.map +1 -0
- package/dist/stage/panelContext.js +6 -0
- package/dist/stage/panelContext.js.map +1 -0
- package/dist/stage/panelShadow.d.ts +20 -0
- package/dist/stage/panelShadow.d.ts.map +1 -0
- package/dist/stage/panelShadow.js +22 -0
- package/dist/stage/panelShadow.js.map +1 -0
- package/dist/stage/renderMeasurement.d.ts +3 -0
- package/dist/stage/renderMeasurement.d.ts.map +1 -0
- package/dist/stage/renderMeasurement.js +19 -0
- package/dist/stage/renderMeasurement.js.map +1 -0
- package/dist/stage/renderTargetInventory.d.ts +17 -0
- package/dist/stage/renderTargetInventory.d.ts.map +1 -0
- package/dist/stage/renderTargetInventory.js +27 -0
- package/dist/stage/renderTargetInventory.js.map +1 -0
- package/dist/stage/rendererState.d.ts +14 -0
- package/dist/stage/rendererState.d.ts.map +1 -0
- package/dist/stage/rendererState.js +35 -0
- package/dist/stage/rendererState.js.map +1 -0
- package/dist/stage/resolveStageProfile.d.ts +44 -0
- package/dist/stage/resolveStageProfile.d.ts.map +1 -0
- package/dist/stage/resolveStageProfile.js +30 -0
- package/dist/stage/resolveStageProfile.js.map +1 -0
- package/dist/stage/scrollAnimation.d.ts +10 -0
- package/dist/stage/scrollAnimation.d.ts.map +1 -0
- package/dist/stage/scrollAnimation.js +11 -0
- package/dist/stage/scrollAnimation.js.map +1 -0
- package/dist/stage/scrollFrame.d.ts +43 -0
- package/dist/stage/scrollFrame.d.ts.map +1 -0
- package/dist/stage/scrollFrame.js +232 -0
- package/dist/stage/scrollFrame.js.map +1 -0
- package/dist/stage/spatialElementFrame.d.ts +6 -0
- package/dist/stage/spatialElementFrame.d.ts.map +1 -0
- package/dist/stage/spatialElementFrame.js +22 -0
- package/dist/stage/spatialElementFrame.js.map +1 -0
- package/dist/stage/stageConstants.d.ts +85 -0
- package/dist/stage/stageConstants.d.ts.map +1 -0
- package/dist/stage/stageConstants.js +85 -0
- package/dist/stage/stageConstants.js.map +1 -0
- package/dist/stage/stageDom.d.ts +10 -0
- package/dist/stage/stageDom.d.ts.map +1 -0
- package/dist/stage/stageDom.js +22 -0
- package/dist/stage/stageDom.js.map +1 -0
- package/dist/stage/stageMath.d.ts +187 -0
- package/dist/stage/stageMath.d.ts.map +1 -0
- package/dist/stage/stageMath.js +344 -0
- package/dist/stage/stageMath.js.map +1 -0
- package/dist/stage/stageSceneUtils.d.ts +42 -0
- package/dist/stage/stageSceneUtils.d.ts.map +1 -0
- package/dist/stage/stageSceneUtils.js +154 -0
- package/dist/stage/stageSceneUtils.js.map +1 -0
- package/dist/stage/stageTypes.d.ts +189 -0
- package/dist/stage/stageTypes.d.ts.map +1 -0
- package/dist/stage/stageTypes.js +2 -0
- package/dist/stage/stageTypes.js.map +1 -0
- package/dist/stage/stageVisualTest.d.ts +92 -0
- package/dist/stage/stageVisualTest.d.ts.map +1 -0
- package/dist/stage/stageVisualTest.js +5 -0
- package/dist/stage/stageVisualTest.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,901 @@
|
|
|
1
|
+
import { getRefinementSize } from './SpatialElementRefinement.js';
|
|
2
|
+
import { getMinimapMeasurementMode } from './minimapMeasurement.js';
|
|
3
|
+
import { parseRenderMeasurement } from './renderMeasurement.js';
|
|
4
|
+
import { gaussianTargets } from './renderTargetInventory.js';
|
|
5
|
+
import { withRendererState, withVisibility } from './rendererState.js';
|
|
6
|
+
import * as THREE from 'three/webgpu';
|
|
7
|
+
import { CatalogSpatialElementLayer } from '../catalog/CatalogSpatialElementLayer.js';
|
|
8
|
+
import { SpatialGeometryCapture } from '../catalog/SpatialGeometryCapture.js';
|
|
9
|
+
import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';
|
|
10
|
+
import { Fn, float, If, mix, color, max as tslMax, min as tslMin, premultiplyAlpha, texture, uniform, uv, vec2, vec4 } from 'three/tsl';
|
|
11
|
+
import { inverseAcesToneMapping, STAGE_TONE_MAPPING_EXPOSURE } from './LiquidGlassPanel.js';
|
|
12
|
+
import { isMesh } from './stageSceneUtils.js';
|
|
13
|
+
const SCROLL_RENDER_SCALE = 0.82;
|
|
14
|
+
/** Owns GPU output bands, passes and target lifetimes; never schedules frames or navigation. */
|
|
15
|
+
export class StageRenderPipeline {
|
|
16
|
+
ports;
|
|
17
|
+
measurementMode = getMinimapMeasurementMode();
|
|
18
|
+
renderMeasurement = parseRenderMeasurement(typeof window === 'undefined' ? '' : (window.location?.search ?? ''));
|
|
19
|
+
fuseOutline = ![
|
|
20
|
+
'halo-separate',
|
|
21
|
+
'halo-mask-only',
|
|
22
|
+
'halo-frozen-mask',
|
|
23
|
+
'halo-half-mask'
|
|
24
|
+
].includes(this.renderMeasurement);
|
|
25
|
+
measuredBackdropSeeds = new WeakMap();
|
|
26
|
+
preparedZoomViews = new WeakSet();
|
|
27
|
+
disposed = false;
|
|
28
|
+
/** Retain the last DETAIL background while its geometry is owned by a transition. */
|
|
29
|
+
freezeBackground() {
|
|
30
|
+
const targets = this._activeRenderTargets;
|
|
31
|
+
if (!targets)
|
|
32
|
+
return false;
|
|
33
|
+
withRendererState(this.ports.renderer, () => {
|
|
34
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
35
|
+
this.ports.renderer.setRenderTarget(targets.sceneCapture);
|
|
36
|
+
this.renderStageContents();
|
|
37
|
+
this.renderStageDisplay();
|
|
38
|
+
this.renderBackgroundPanels();
|
|
39
|
+
});
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
async warmHigh(high, environment, drawLow) {
|
|
43
|
+
const scene = new THREE.Scene();
|
|
44
|
+
scene.environment = environment;
|
|
45
|
+
scene.environmentIntensity = 0.5;
|
|
46
|
+
scene.add(high.pose);
|
|
47
|
+
const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100);
|
|
48
|
+
camera.position.z = 5;
|
|
49
|
+
const size = this.ports.renderer.getDrawingBufferSize(new THREE.Vector2());
|
|
50
|
+
const warmSize = getRefinementSize(size.x, size.y);
|
|
51
|
+
const target = new THREE.RenderTarget(warmSize.width, warmSize.height, {
|
|
52
|
+
type: THREE.HalfFloatType,
|
|
53
|
+
samples: 4
|
|
54
|
+
});
|
|
55
|
+
const destination = this.ports.renderer.getRenderTarget();
|
|
56
|
+
const clear = this.ports.renderer.getClearColor(new THREE.Color());
|
|
57
|
+
const alpha = this.ports.renderer.getClearAlpha();
|
|
58
|
+
try {
|
|
59
|
+
this.ports.renderer.setRenderTarget(target);
|
|
60
|
+
this.ports.renderer.setClearColor(0, 0);
|
|
61
|
+
high.blend.render(this.ports.renderer, (useHigh) => {
|
|
62
|
+
this.ports.renderer.clear();
|
|
63
|
+
if (useHigh)
|
|
64
|
+
this.ports.renderer.render(scene, camera);
|
|
65
|
+
else
|
|
66
|
+
drawLow();
|
|
67
|
+
}, false, 0);
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
this.ports.renderer.setRenderTarget(destination);
|
|
71
|
+
this.ports.renderer.setClearColor(clear, alpha);
|
|
72
|
+
high.pose.removeFromParent();
|
|
73
|
+
target.dispose();
|
|
74
|
+
}
|
|
75
|
+
const device = this.ports.renderer.backend.device;
|
|
76
|
+
await device?.queue.onSubmittedWorkDone();
|
|
77
|
+
}
|
|
78
|
+
getRenderTargets() {
|
|
79
|
+
return [
|
|
80
|
+
...(this.outlineMaskTarget ? [this.outlineMaskTarget] : []),
|
|
81
|
+
...[this.fullQualityTargets, this.scrollQualityTargets].flatMap((set) => set
|
|
82
|
+
? [
|
|
83
|
+
set.sceneCapture,
|
|
84
|
+
...[...set.panelBlurCaptures.values()].flatMap((blur) => [
|
|
85
|
+
blur.target,
|
|
86
|
+
...gaussianTargets(blur.effect)
|
|
87
|
+
])
|
|
88
|
+
]
|
|
89
|
+
: [])
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
getCanvasOutputs() {
|
|
93
|
+
return [
|
|
94
|
+
this.ports.backgroundCanvasTarget,
|
|
95
|
+
this.foregroundCanvasTarget,
|
|
96
|
+
this.carouselRearTarget
|
|
97
|
+
].flatMap((target, index) => {
|
|
98
|
+
if (!target)
|
|
99
|
+
return [];
|
|
100
|
+
const size = target.getDrawingBufferSize(new THREE.Vector2());
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
band: ['background', 'foreground', 'carousel-rear'][index],
|
|
104
|
+
width: size.x,
|
|
105
|
+
height: size.y,
|
|
106
|
+
colorAttachments: 1,
|
|
107
|
+
depthAttachments: 1
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
constructor(ports) {
|
|
113
|
+
this.ports = ports;
|
|
114
|
+
this.setPageBackground(ports.pageBackground ?? '#ffffff');
|
|
115
|
+
this.backgroundCoverMaterial.fragmentNode = premultiplyAlpha(vec4(inverseAcesToneMapping(this.backgroundCoverColor), this.backgroundCoverOpacity));
|
|
116
|
+
this.backgroundCoverMaterial.depthTest = this.backgroundCoverMaterial.depthWrite = false;
|
|
117
|
+
this.backgroundCoverMaterial.transparent =
|
|
118
|
+
this.backgroundCoverMaterial.premultipliedAlpha = true;
|
|
119
|
+
this.backgroundCoverMaterial.toneMapped = false;
|
|
120
|
+
}
|
|
121
|
+
backgroundCoverOpacity = uniform(0);
|
|
122
|
+
backgroundCoverColor = uniform(new THREE.Vector3(1, 1, 1));
|
|
123
|
+
setPageBackground(value) {
|
|
124
|
+
const color = new THREE.Color(value);
|
|
125
|
+
this.backgroundCoverColor.value.set(color.r, color.g, color.b);
|
|
126
|
+
}
|
|
127
|
+
backgroundCoverMaterial = new THREE.NodeMaterial();
|
|
128
|
+
backgroundCover = new THREE.QuadMesh(this.backgroundCoverMaterial);
|
|
129
|
+
outlineMaskScene = new THREE.Scene();
|
|
130
|
+
_minimapOverlayCapturePasses = 0;
|
|
131
|
+
_renderTargetSetCreations = 0;
|
|
132
|
+
_renderTargetSetResizes = 0;
|
|
133
|
+
_renderTargetSetWarmups = 0;
|
|
134
|
+
_stageModelRenderPasses = 0;
|
|
135
|
+
_panelBlurRenderPasses = 0;
|
|
136
|
+
_panelSceneRenderPasses = 0;
|
|
137
|
+
_minimapSceneRenderPasses = 0;
|
|
138
|
+
outlineMaskModel;
|
|
139
|
+
outlineMaskMaterial;
|
|
140
|
+
outlineCompositeMaterial;
|
|
141
|
+
outlineQuad;
|
|
142
|
+
outlineMaskTarget;
|
|
143
|
+
outlineMaskValid = false;
|
|
144
|
+
emptyOutlineMask = new THREE.DataTexture(new Uint8Array(4), 1, 1);
|
|
145
|
+
displayOutlineMask = texture(this.emptyOutlineMask);
|
|
146
|
+
displayOutlineOpacity = uniform(0);
|
|
147
|
+
outlineWidth = 1;
|
|
148
|
+
outlineHeight = 1;
|
|
149
|
+
outlineTexel = uniform(new THREE.Vector2(1, 1));
|
|
150
|
+
outlineGlowTexel = uniform(new THREE.Vector2(1, 1));
|
|
151
|
+
outlineOpacityScale = uniform(1);
|
|
152
|
+
fullQualityTargets;
|
|
153
|
+
scrollQualityTargets;
|
|
154
|
+
_activeRenderTargets;
|
|
155
|
+
stageDisplayMaterial;
|
|
156
|
+
_stageDisplayQuad;
|
|
157
|
+
stageDisplayTextureNode;
|
|
158
|
+
foregroundCanvasTarget;
|
|
159
|
+
carouselRearTarget;
|
|
160
|
+
carouselRearCanvas;
|
|
161
|
+
carouselRearSize = new THREE.Vector3();
|
|
162
|
+
foregroundCanvas;
|
|
163
|
+
configureRenderer() {
|
|
164
|
+
this.ports.renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
165
|
+
this.ports.renderer.toneMappingExposure = STAGE_TONE_MAPPING_EXPOSURE;
|
|
166
|
+
this.ports.renderer.setClearColor(0xffffff, 1);
|
|
167
|
+
this.ports.renderer.autoClear = false;
|
|
168
|
+
this.ports.backgroundCanvas.tabIndex = -1;
|
|
169
|
+
this.ports.backgroundCanvas.style.touchAction = 'pan-y';
|
|
170
|
+
}
|
|
171
|
+
renderCarouselRear() {
|
|
172
|
+
if (!this.carouselRearTarget && !this.ports.catalogLayer()?.hasCarousel())
|
|
173
|
+
return;
|
|
174
|
+
if (!this.carouselRearTarget) {
|
|
175
|
+
const canvas = document.createElement('canvas');
|
|
176
|
+
canvas.className = 'stage-webgpu-carousel-rear';
|
|
177
|
+
canvas.setAttribute('aria-hidden', 'true');
|
|
178
|
+
this.carouselRearCanvas = canvas;
|
|
179
|
+
this.carouselRearTarget = new THREE.CanvasTarget(canvas);
|
|
180
|
+
this.ports.container.appendChild(canvas);
|
|
181
|
+
}
|
|
182
|
+
const target = this.carouselRearTarget;
|
|
183
|
+
const width = window.innerWidth, height = window.innerHeight, ratio = this.getFullPixelRatio();
|
|
184
|
+
if (this.carouselRearSize.x !== width ||
|
|
185
|
+
this.carouselRearSize.y !== height ||
|
|
186
|
+
this.carouselRearSize.z !== ratio) {
|
|
187
|
+
this.resizeCanvasTarget(target, width, height, ratio);
|
|
188
|
+
this.carouselRearSize.set(width, height, ratio);
|
|
189
|
+
}
|
|
190
|
+
this.ports.renderer.setCanvasTarget(target);
|
|
191
|
+
this.ports.renderer.setRenderTarget(null);
|
|
192
|
+
this.ports.renderer.setClearColor(0x000000, 0);
|
|
193
|
+
this.ports.renderer.clear();
|
|
194
|
+
this.ports.catalogLayer()?.renderRear(this.ports.renderer);
|
|
195
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
196
|
+
}
|
|
197
|
+
createForegroundCanvas() {
|
|
198
|
+
const canvas = document.createElement('canvas');
|
|
199
|
+
canvas.className = 'stage-webgpu-foreground';
|
|
200
|
+
canvas.setAttribute('aria-hidden', 'true');
|
|
201
|
+
this.foregroundCanvas = canvas;
|
|
202
|
+
this.foregroundCanvasTarget = new THREE.CanvasTarget(canvas);
|
|
203
|
+
this.ports.container.appendChild(canvas);
|
|
204
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
205
|
+
}
|
|
206
|
+
createModelOutline(model) {
|
|
207
|
+
this.outlineMaskModel?.removeFromParent();
|
|
208
|
+
this.outlineMaskMaterial?.dispose();
|
|
209
|
+
this.outlineCompositeMaterial?.dispose();
|
|
210
|
+
this.outlineMaskTarget?.dispose();
|
|
211
|
+
this.outlineMaskMaterial = new THREE.MeshBasicMaterial({
|
|
212
|
+
color: 0xffffff,
|
|
213
|
+
depthTest: true,
|
|
214
|
+
depthWrite: true,
|
|
215
|
+
side: THREE.DoubleSide,
|
|
216
|
+
toneMapped: false
|
|
217
|
+
});
|
|
218
|
+
const maskModel = model.clone(true);
|
|
219
|
+
maskModel.traverse((child) => {
|
|
220
|
+
if (!isMesh(child))
|
|
221
|
+
return;
|
|
222
|
+
const sourceMesh = this.findSourceMeshByName(model, child.name);
|
|
223
|
+
const include = sourceMesh
|
|
224
|
+
? this.ports.isInteractionMesh(sourceMesh)
|
|
225
|
+
: this.ports.isInteractionMesh(child);
|
|
226
|
+
child.visible = include;
|
|
227
|
+
child.material = this.outlineMaskMaterial;
|
|
228
|
+
});
|
|
229
|
+
this.outlineMaskModel = maskModel;
|
|
230
|
+
this.outlineMaskScene.add(maskModel);
|
|
231
|
+
this.outlineMaskTarget = new THREE.RenderTarget(1, 1, {
|
|
232
|
+
depthBuffer: true,
|
|
233
|
+
stencilBuffer: false,
|
|
234
|
+
samples: 4
|
|
235
|
+
});
|
|
236
|
+
this.outlineMaskTarget.texture.minFilter = THREE.LinearFilter;
|
|
237
|
+
this.outlineMaskTarget.texture.magFilter = THREE.LinearFilter;
|
|
238
|
+
this.outlineMaskTarget.texture.generateMipmaps = false;
|
|
239
|
+
this.displayOutlineMask.value = this.outlineMaskTarget.texture;
|
|
240
|
+
this.outlineCompositeMaterial = this.createOutlineCompositeMaterial(this.outlineMaskTarget.texture);
|
|
241
|
+
this.outlineQuad = new THREE.QuadMesh(this.outlineCompositeMaterial);
|
|
242
|
+
// High refinement can replace the silhouette long after the last window resize.
|
|
243
|
+
this.resizeOutline(this.outlineWidth, this.outlineHeight);
|
|
244
|
+
}
|
|
245
|
+
findSourceMeshByName(root, name) {
|
|
246
|
+
let source;
|
|
247
|
+
root.traverse((child) => {
|
|
248
|
+
if (!source && isMesh(child) && child.name === name)
|
|
249
|
+
source = child;
|
|
250
|
+
});
|
|
251
|
+
return source;
|
|
252
|
+
}
|
|
253
|
+
createOutlineOpacity(mask) {
|
|
254
|
+
const calculate = () => {
|
|
255
|
+
const texel = this.outlineTexel;
|
|
256
|
+
const glowTexel = this.outlineGlowTexel;
|
|
257
|
+
const sampleMaskRing = (sampleTexel, scale = 1) => {
|
|
258
|
+
const centerUv = uv();
|
|
259
|
+
const sampleX = sampleTexel.x.mul(scale);
|
|
260
|
+
const sampleY = sampleTexel.y.mul(scale);
|
|
261
|
+
const left = mask.sample(centerUv.sub(vec2(sampleX, 0))).r;
|
|
262
|
+
const right = mask.sample(centerUv.add(vec2(sampleX, 0))).r;
|
|
263
|
+
const up = mask.sample(centerUv.add(vec2(0, sampleY))).r;
|
|
264
|
+
const down = mask.sample(centerUv.sub(vec2(0, sampleY))).r;
|
|
265
|
+
const upLeft = mask.sample(centerUv.add(vec2(0, sampleY)).sub(vec2(sampleX, 0))).r;
|
|
266
|
+
const upRight = mask.sample(centerUv.add(vec2(sampleX, sampleY))).r;
|
|
267
|
+
const downLeft = mask.sample(centerUv.sub(vec2(sampleX, sampleY))).r;
|
|
268
|
+
const downRight = mask.sample(centerUv.add(vec2(sampleX, 0)).sub(vec2(0, sampleY))).r;
|
|
269
|
+
return {
|
|
270
|
+
average: left
|
|
271
|
+
.add(right)
|
|
272
|
+
.add(up)
|
|
273
|
+
.add(down)
|
|
274
|
+
.add(upLeft)
|
|
275
|
+
.add(upRight)
|
|
276
|
+
.add(downLeft)
|
|
277
|
+
.add(downRight)
|
|
278
|
+
.div(8),
|
|
279
|
+
max: tslMax(tslMax(tslMax(left, right), tslMax(up, down)), tslMax(tslMax(upLeft, upRight), tslMax(downLeft, downRight))),
|
|
280
|
+
min: tslMin(tslMin(tslMin(left, right), tslMin(up, down)), tslMin(tslMin(upLeft, upRight), tslMin(downLeft, downRight)))
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
const edgeNeighbor = sampleMaskRing(texel);
|
|
284
|
+
const glowNearNeighbor = sampleMaskRing(glowTexel, 0.45);
|
|
285
|
+
const glowMidNeighbor = sampleMaskRing(glowTexel, 0.7);
|
|
286
|
+
const glowFarNeighbor = sampleMaskRing(glowTexel);
|
|
287
|
+
const center = mask.sample(uv()).r;
|
|
288
|
+
const outside = center.oneMinus();
|
|
289
|
+
const edgeGradient = edgeNeighbor.max.sub(center).max(0);
|
|
290
|
+
const core = edgeGradient.mul(this.ports.interactionTheme().outlineOpacity);
|
|
291
|
+
// Average neighbouring coverage, rather than dilating a solid band. Keep the
|
|
292
|
+
// halo outside the spatialElement so it cannot be mistaken for painted geometry.
|
|
293
|
+
const glowNear = glowNearNeighbor.average
|
|
294
|
+
.mul(outside)
|
|
295
|
+
.mul(this.ports.interactionTheme().outlineGlow * 0.6);
|
|
296
|
+
const glowMid = glowMidNeighbor.average
|
|
297
|
+
.mul(outside)
|
|
298
|
+
.mul(this.ports.interactionTheme().outlineGlow * 0.3);
|
|
299
|
+
const glowFar = glowFarNeighbor.average
|
|
300
|
+
.mul(outside)
|
|
301
|
+
.mul(this.ports.interactionTheme().outlineGlow * 0.1);
|
|
302
|
+
const opacity = tslMin(core.add(glowNear).add(glowMid).add(glowFar), 1).mul(this.outlineOpacityScale);
|
|
303
|
+
return opacity;
|
|
304
|
+
};
|
|
305
|
+
if (this.renderMeasurement === 'halo-unconditional')
|
|
306
|
+
return calculate();
|
|
307
|
+
return Fn(() => {
|
|
308
|
+
const opacity = float(0).toVar();
|
|
309
|
+
// A fully covered pixel has zero outer halo. Skip all 32 neighbour taps there.
|
|
310
|
+
If(mask.sample(uv()).r.lessThan(1), () => {
|
|
311
|
+
opacity.assign(calculate());
|
|
312
|
+
});
|
|
313
|
+
return opacity;
|
|
314
|
+
})();
|
|
315
|
+
}
|
|
316
|
+
createOutlineCompositeMaterial(maskTexture) {
|
|
317
|
+
const material = new THREE.MeshBasicNodeMaterial({
|
|
318
|
+
blending: THREE.NormalBlending,
|
|
319
|
+
depthTest: false,
|
|
320
|
+
depthWrite: false,
|
|
321
|
+
transparent: true
|
|
322
|
+
});
|
|
323
|
+
material.colorNode = color(new THREE.Color(this.ports.interactionTheme().outlineColor));
|
|
324
|
+
material.opacityNode = this.createOutlineOpacity(texture(maskTexture));
|
|
325
|
+
material.toneMapped = false;
|
|
326
|
+
return material;
|
|
327
|
+
}
|
|
328
|
+
disposeSceneCapture() {
|
|
329
|
+
this.disposeRenderTargetSet(this.fullQualityTargets);
|
|
330
|
+
this.disposeRenderTargetSet(this.scrollQualityTargets);
|
|
331
|
+
this.stageDisplayMaterial?.dispose();
|
|
332
|
+
this.fullQualityTargets = undefined;
|
|
333
|
+
this.scrollQualityTargets = undefined;
|
|
334
|
+
this._activeRenderTargets = undefined;
|
|
335
|
+
this.stageDisplayMaterial = undefined;
|
|
336
|
+
this._stageDisplayQuad = undefined;
|
|
337
|
+
this.stageDisplayTextureNode = undefined;
|
|
338
|
+
}
|
|
339
|
+
createSceneCapture() {
|
|
340
|
+
const blurKeys = new Set(this.ports.fallbackPanelOptions().map((options) => this.getPanelBlurKey(options)));
|
|
341
|
+
this.fullQualityTargets = this.createRenderTargetSet(1, blurKeys);
|
|
342
|
+
this.scrollQualityTargets = this.createRenderTargetSet(SCROLL_RENDER_SCALE, blurKeys);
|
|
343
|
+
this._activeRenderTargets = this.fullQualityTargets;
|
|
344
|
+
this.stageDisplayTextureNode = texture(this.fullQualityTargets.sceneCapture.texture);
|
|
345
|
+
this.stageDisplayMaterial = new THREE.NodeMaterial();
|
|
346
|
+
// CanvasTarget already runs WebGPURenderer's output transform after this
|
|
347
|
+
// fullscreen copy. Keep the capture linear here so ACES and sRGB are applied
|
|
348
|
+
// exactly once; using renderOutput() here would wash out the entire stage.
|
|
349
|
+
// CanvasTarget unpremultiplies before tone mapping and premultiplies afterwards.
|
|
350
|
+
// Environment visibility is applied before the hero; the composed capture stays opaque.
|
|
351
|
+
this.stageDisplayMaterial.fragmentNode = vec4(this.stageDisplayTextureNode.rgb, 1);
|
|
352
|
+
if (this.fuseOutline) {
|
|
353
|
+
this.emptyOutlineMask.needsUpdate = true;
|
|
354
|
+
const source = this.stageDisplayTextureNode;
|
|
355
|
+
const haloColor = color(new THREE.Color(this.ports.interactionTheme().outlineColor));
|
|
356
|
+
const haloOpacity = this.createOutlineOpacity(this.displayOutlineMask);
|
|
357
|
+
// Merge into the existing linear display pass before the canvas output transform.
|
|
358
|
+
this.stageDisplayMaterial.fragmentNode = Fn(() => {
|
|
359
|
+
const rgb = source.rgb.toVar();
|
|
360
|
+
If(this.displayOutlineOpacity.greaterThan(0), () => {
|
|
361
|
+
rgb.assign(mix(rgb, haloColor, haloOpacity.mul(this.displayOutlineOpacity)));
|
|
362
|
+
});
|
|
363
|
+
return vec4(rgb, 1);
|
|
364
|
+
})();
|
|
365
|
+
}
|
|
366
|
+
this.stageDisplayMaterial.depthTest = false;
|
|
367
|
+
this.stageDisplayMaterial.depthWrite = false;
|
|
368
|
+
this.stageDisplayMaterial.blending = THREE.NoBlending;
|
|
369
|
+
this.stageDisplayMaterial.toneMapped = false;
|
|
370
|
+
this.stageDisplayMaterial.needsUpdate = true;
|
|
371
|
+
this._stageDisplayQuad = new THREE.QuadMesh(this.stageDisplayMaterial);
|
|
372
|
+
}
|
|
373
|
+
createRenderTargetSet(scale, blurKeys) {
|
|
374
|
+
this._renderTargetSetCreations += 1;
|
|
375
|
+
const sceneCapture = new THREE.RenderTarget(1, 1, {
|
|
376
|
+
depthBuffer: true,
|
|
377
|
+
stencilBuffer: false,
|
|
378
|
+
samples: 4,
|
|
379
|
+
type: THREE.HalfFloatType
|
|
380
|
+
});
|
|
381
|
+
sceneCapture.texture.minFilter = THREE.LinearFilter;
|
|
382
|
+
sceneCapture.texture.magFilter = THREE.LinearFilter;
|
|
383
|
+
sceneCapture.texture.generateMipmaps = false;
|
|
384
|
+
sceneCapture.texture.colorSpace = THREE.NoColorSpace;
|
|
385
|
+
const panelBlurCaptures = new Map();
|
|
386
|
+
blurKeys.forEach((blur) => {
|
|
387
|
+
panelBlurCaptures.set(blur, this.createPanelBlurCapture(sceneCapture.texture, blur, scale));
|
|
388
|
+
});
|
|
389
|
+
return { scale, sceneCapture, panelBlurCaptures };
|
|
390
|
+
}
|
|
391
|
+
disposeRenderTargetSet(targets) {
|
|
392
|
+
if (!targets)
|
|
393
|
+
return;
|
|
394
|
+
targets.sceneCapture.dispose();
|
|
395
|
+
targets.panelBlurCaptures.forEach(({ target, material, effect }) => {
|
|
396
|
+
target.dispose();
|
|
397
|
+
material.dispose();
|
|
398
|
+
effect?.dispose();
|
|
399
|
+
});
|
|
400
|
+
targets.panelBlurCaptures.clear();
|
|
401
|
+
}
|
|
402
|
+
resizeRenderTargets() {
|
|
403
|
+
const width = window.innerWidth;
|
|
404
|
+
const height = window.innerHeight;
|
|
405
|
+
const pixelRatio = this.getFullPixelRatio();
|
|
406
|
+
if (!this.ports.frame().outgoingBackground)
|
|
407
|
+
this.resizeCanvasTarget(this.ports.backgroundCanvasTarget, width, height, pixelRatio);
|
|
408
|
+
if (this.foregroundCanvasTarget) {
|
|
409
|
+
this.resizeCanvasTarget(this.foregroundCanvasTarget, width, height, pixelRatio);
|
|
410
|
+
}
|
|
411
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
412
|
+
this.resizeRenderTargetSet(this.fullQualityTargets, width, height, pixelRatio);
|
|
413
|
+
this.resizeRenderTargetSet(this.scrollQualityTargets, width, height, pixelRatio);
|
|
414
|
+
}
|
|
415
|
+
resizeRenderTargetSet(targets, width, height, pixelRatio) {
|
|
416
|
+
if (!targets)
|
|
417
|
+
return;
|
|
418
|
+
this._renderTargetSetResizes += 1;
|
|
419
|
+
const captureWidth = Math.max(1, Math.round(width * pixelRatio * targets.scale));
|
|
420
|
+
const captureHeight = Math.max(1, Math.round(height * pixelRatio * targets.scale));
|
|
421
|
+
targets.sceneCapture.setSize(captureWidth, captureHeight);
|
|
422
|
+
targets.panelBlurCaptures.forEach(({ target, effect, resolutionScale }) => {
|
|
423
|
+
target.setSize(captureWidth, captureHeight);
|
|
424
|
+
if (effect)
|
|
425
|
+
effect.resolutionScale = resolutionScale / (pixelRatio * targets.scale);
|
|
426
|
+
effect?.setSize(captureWidth, captureHeight);
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
getFullPixelRatio() {
|
|
430
|
+
return Math.min(window.devicePixelRatio || 1, 2);
|
|
431
|
+
}
|
|
432
|
+
setScrollRenderQuality(active) {
|
|
433
|
+
this.ports.container.toggleAttribute('data-stage-scroll-rendering', active);
|
|
434
|
+
const nextTargets = active ? this.scrollQualityTargets : this.fullQualityTargets;
|
|
435
|
+
if (!nextTargets || this._activeRenderTargets === nextTargets)
|
|
436
|
+
return;
|
|
437
|
+
this.activateRenderTargetSet(nextTargets);
|
|
438
|
+
}
|
|
439
|
+
activateRenderTargetSet(nextTargets) {
|
|
440
|
+
this._activeRenderTargets = nextTargets;
|
|
441
|
+
if (this.stageDisplayTextureNode) {
|
|
442
|
+
this.stageDisplayTextureNode.value = nextTargets.sceneCapture.texture;
|
|
443
|
+
}
|
|
444
|
+
this.ports.panelRuntimes().forEach((runtime) => {
|
|
445
|
+
runtime.glass?.setBackdropTexture(this.getPanelBlurTexture(runtime.options, nextTargets));
|
|
446
|
+
});
|
|
447
|
+
this.ports.minimaps().forEach((minimap) => {
|
|
448
|
+
minimap.stageCaptureTexture.value = nextTargets.sceneCapture.texture;
|
|
449
|
+
const panel = this.ports.panelRuntimes()[minimap.panelIndex];
|
|
450
|
+
if (panel) {
|
|
451
|
+
minimap.stageBlurTexture.value =
|
|
452
|
+
panel.surface === 'solid'
|
|
453
|
+
? nextTargets.sceneCapture.texture
|
|
454
|
+
: this.getPanelBlurTexture(panel.options, nextTargets);
|
|
455
|
+
}
|
|
456
|
+
minimap.overlayCaptureDirty = true;
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
warmRenderTargetSets() {
|
|
460
|
+
const previousTargets = this._activeRenderTargets;
|
|
461
|
+
const availableTargets = [this.fullQualityTargets, this.scrollQualityTargets].filter((targets) => Boolean(targets));
|
|
462
|
+
if (!previousTargets || !this._stageDisplayQuad || availableTargets.length !== 2)
|
|
463
|
+
return;
|
|
464
|
+
// Finish with the active/full-quality set so the warm-up itself cannot
|
|
465
|
+
// leave a lower-resolution frame on the visible canvas.
|
|
466
|
+
const targetSets = [
|
|
467
|
+
...availableTargets.filter((targets) => targets !== previousTargets),
|
|
468
|
+
previousTargets
|
|
469
|
+
];
|
|
470
|
+
try {
|
|
471
|
+
withRendererState(this.ports.renderer, () => {
|
|
472
|
+
targetSets.forEach((targets) => {
|
|
473
|
+
this.activateRenderTargetSet(targets);
|
|
474
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
475
|
+
this.ports.renderer.setRenderTarget(targets.sceneCapture);
|
|
476
|
+
this.ports.renderStage();
|
|
477
|
+
this.renderPanelBlurCaptures(targets, true);
|
|
478
|
+
this.renderStageDisplay();
|
|
479
|
+
this.renderBackgroundPanels();
|
|
480
|
+
this._renderTargetSetWarmups += 1;
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
finally {
|
|
485
|
+
this.activateRenderTargetSet(previousTargets);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
resizeCanvasTarget(target, width, height, pixelRatio) {
|
|
489
|
+
this.ports.renderer.setCanvasTarget(target);
|
|
490
|
+
this.ports.renderer.setPixelRatio(pixelRatio);
|
|
491
|
+
this.ports.renderer.setSize(width, height, false);
|
|
492
|
+
}
|
|
493
|
+
createPanelBlurCapture(sceneTexture, blur, renderScale) {
|
|
494
|
+
const target = new THREE.RenderTarget(1, 1, {
|
|
495
|
+
depthBuffer: false,
|
|
496
|
+
stencilBuffer: false
|
|
497
|
+
});
|
|
498
|
+
target.texture.minFilter = THREE.LinearFilter;
|
|
499
|
+
target.texture.magFilter = THREE.LinearFilter;
|
|
500
|
+
target.texture.generateMipmaps = false;
|
|
501
|
+
target.texture.colorSpace = THREE.NoColorSpace;
|
|
502
|
+
const sourceTexture = texture(sceneTexture);
|
|
503
|
+
// Scale resolution and sample offsets together to retain the CSS blur radius.
|
|
504
|
+
// The final full-size texture still uses the existing screen-space mapping.
|
|
505
|
+
const query = new URLSearchParams(typeof window === 'undefined' ? '' : window.location?.search);
|
|
506
|
+
const fullResolutionProbe = query.get('stage-test') === '1' && query.get('stage-backdrop') === 'full';
|
|
507
|
+
const blurResolution = blur >= 4 && !fullResolutionProbe ? 0.5 : 1;
|
|
508
|
+
const effect = blur > 0
|
|
509
|
+
? gaussianBlur(sourceTexture, blurResolution, Math.max(1, Math.round(blur)), {
|
|
510
|
+
resolutionScale: blurResolution / (this.getFullPixelRatio() * renderScale)
|
|
511
|
+
})
|
|
512
|
+
: undefined;
|
|
513
|
+
const material = new THREE.NodeMaterial();
|
|
514
|
+
material.colorNode = effect ?? sourceTexture;
|
|
515
|
+
material.needsUpdate = true;
|
|
516
|
+
return {
|
|
517
|
+
resolutionScale: blurResolution,
|
|
518
|
+
effect,
|
|
519
|
+
material,
|
|
520
|
+
quad: new THREE.QuadMesh(material),
|
|
521
|
+
target
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
getPanelBlurKey(options) {
|
|
525
|
+
const value = Number.isFinite(options.backdropBlur) ? (options.backdropBlur ?? 0) : 0;
|
|
526
|
+
return Math.round(THREE.MathUtils.clamp(value, 0, 100) * 100) / 100;
|
|
527
|
+
}
|
|
528
|
+
getPanelBlurTexture(options, targets = this._activeRenderTargets) {
|
|
529
|
+
const blur = this.getPanelBlurKey(options);
|
|
530
|
+
const capture = targets?.panelBlurCaptures.get(blur);
|
|
531
|
+
if (!capture) {
|
|
532
|
+
throw new Error(`No backdrop capture exists for panel blur ${blur}`);
|
|
533
|
+
}
|
|
534
|
+
return capture.target.texture;
|
|
535
|
+
}
|
|
536
|
+
/** Prepare hidden close-up effects during page binding, never during camera motion.
|
|
537
|
+
* Captures stay invalid: the first visible frame must still sample the live element.
|
|
538
|
+
* Only compile the foreground scene, so preparation cannot paint an overlay on screen.
|
|
539
|
+
*/
|
|
540
|
+
async prepareZoomEffects() {
|
|
541
|
+
if (!this.foregroundCanvasTarget || this.disposed)
|
|
542
|
+
return;
|
|
543
|
+
const views = [...this.ports.minimaps().values()].filter((view) => !this.preparedZoomViews.has(view));
|
|
544
|
+
if (!views.length)
|
|
545
|
+
return;
|
|
546
|
+
const pending = [];
|
|
547
|
+
for (const view of views) {
|
|
548
|
+
withRendererState(this.ports.renderer, () => {
|
|
549
|
+
this.ports.renderMinimapBlur(view);
|
|
550
|
+
if (this.ports.panelRuntimes()[view.panelIndex]?.surface === 'glass')
|
|
551
|
+
this.ports.renderMinimapPanelCapture(view);
|
|
552
|
+
this.ports.renderer.setCanvasTarget(this.foregroundCanvasTarget);
|
|
553
|
+
this.ports.renderer.setRenderTarget(null);
|
|
554
|
+
const ringMaterial = view.overlayRing.material;
|
|
555
|
+
const compositeCulled = view.overlayComposite.frustumCulled;
|
|
556
|
+
const ringCulled = view.overlayRing.frustumCulled;
|
|
557
|
+
try {
|
|
558
|
+
// A newly bound minimap camera may not yet have its screen projection.
|
|
559
|
+
// Compile the hidden effects even if that initial frustum excludes them.
|
|
560
|
+
view.overlayComposite.frustumCulled = false;
|
|
561
|
+
view.overlayRing.frustumCulled = false;
|
|
562
|
+
withVisibility([
|
|
563
|
+
...[...this.ports.minimaps().values()].map((entry) => entry.layer),
|
|
564
|
+
view.overlayComposite,
|
|
565
|
+
view.overlayRing
|
|
566
|
+
], () => {
|
|
567
|
+
for (const entry of this.ports.minimaps().values())
|
|
568
|
+
entry.layer.visible = entry === view;
|
|
569
|
+
view.overlayComposite.visible = true;
|
|
570
|
+
view.overlayRing.visible = true;
|
|
571
|
+
for (const material of [view.ringRestMaterial, view.ringForegroundMaterial]) {
|
|
572
|
+
view.overlayRing.material = material;
|
|
573
|
+
pending.push(this.ports.renderer.compileAsync(this.ports.minimapScene(), view.screenCamera));
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
view.overlayRing.material = ringMaterial;
|
|
579
|
+
view.overlayComposite.frustumCulled = compositeCulled;
|
|
580
|
+
view.overlayRing.frustumCulled = ringCulled;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
await Promise.all(pending);
|
|
585
|
+
const device = this.ports.renderer.backend.device;
|
|
586
|
+
await device?.queue.onSubmittedWorkDone();
|
|
587
|
+
if (!this.disposed)
|
|
588
|
+
for (const view of views)
|
|
589
|
+
this.preparedZoomViews.add(view);
|
|
590
|
+
}
|
|
591
|
+
renderForegroundLayer() {
|
|
592
|
+
if (!this.foregroundCanvasTarget)
|
|
593
|
+
return;
|
|
594
|
+
this.ports.renderer.setCanvasTarget(this.foregroundCanvasTarget);
|
|
595
|
+
this.ports.renderer.setRenderTarget(null);
|
|
596
|
+
this.ports.renderer.setClearColor(0x000000, 0);
|
|
597
|
+
this.ports.renderer.clear();
|
|
598
|
+
this.renderMinimapScene();
|
|
599
|
+
for (const entry of this.ports.exitingMinimaps())
|
|
600
|
+
if (entry.minimap.displayOpacity > 0)
|
|
601
|
+
entry.capture.render(this.ports.renderer);
|
|
602
|
+
this.ports.catalogLayer()?.draw(this.ports.renderer, 'front');
|
|
603
|
+
for (const entry of this.ports.contentSecondaries())
|
|
604
|
+
entry.capture.render(this.ports.renderer);
|
|
605
|
+
this.ports.spatialCapture()?.render(this.ports.renderer);
|
|
606
|
+
}
|
|
607
|
+
renderBackgroundPanels() {
|
|
608
|
+
return withVisibility(this.ports.panelRuntimes().map((panel) => panel.group), () => {
|
|
609
|
+
const minimaps = Array.from(this.ports.minimaps().values());
|
|
610
|
+
const minimapPanelIndices = new Set(minimaps.map((minimap) => minimap.panelIndex));
|
|
611
|
+
const panelVisibility = this.ports.panelRuntimes().map((panel) => panel.group.visible);
|
|
612
|
+
const visibleMinimaps = minimaps.filter((minimap) => minimap.viewportVisible &&
|
|
613
|
+
panelVisibility[minimap.panelIndex] &&
|
|
614
|
+
Boolean(this.ports.panelRuntimes()[minimap.panelIndex]?.glass));
|
|
615
|
+
const hasVisibleRegularPanel = this.ports
|
|
616
|
+
.panelRuntimes()
|
|
617
|
+
.some((panel, index) => Boolean(panel.glass) && panelVisibility[index] && !minimapPanelIndices.has(index));
|
|
618
|
+
// Regular panels share the stage camera. Minimap panels use an off-axis
|
|
619
|
+
// screen camera, so leave them out of this pass and draw them separately.
|
|
620
|
+
this.ports.panelRuntimes().forEach((panel, index) => {
|
|
621
|
+
if (panel.glass) {
|
|
622
|
+
panel.group.visible = panelVisibility[index] && !minimapPanelIndices.has(index);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
if (hasVisibleRegularPanel) {
|
|
626
|
+
this.ports.renderer.clearDepth();
|
|
627
|
+
this.ports.renderer.render(this.ports.panelScene, this.ports.panelCamera);
|
|
628
|
+
this._panelSceneRenderPasses += 1;
|
|
629
|
+
}
|
|
630
|
+
// Keep the glass body in the same compositing layer as the other panels,
|
|
631
|
+
// but retain the exact camera and transform used by its foreground model.
|
|
632
|
+
visibleMinimaps.forEach((active) => {
|
|
633
|
+
this.ports.panelRuntimes().forEach((panel, index) => {
|
|
634
|
+
if (panel.glass) {
|
|
635
|
+
panel.group.visible = panelVisibility[index] && index === active.panelIndex;
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
this.ports.renderer.clearDepth();
|
|
639
|
+
this.ports.renderer.render(this.ports.panelScene, active.screenCamera);
|
|
640
|
+
this._panelSceneRenderPasses += 1;
|
|
641
|
+
});
|
|
642
|
+
this.ports.panelRuntimes().forEach((panel, index) => {
|
|
643
|
+
panel.group.visible = panelVisibility[index];
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
renderMinimapScene() {
|
|
648
|
+
return withVisibility([
|
|
649
|
+
...this.ports.panelRuntimes().map((panel) => panel.group),
|
|
650
|
+
...[...this.ports.minimaps().values()].flatMap((view) => [view.layer, view.spatialElementRoot])
|
|
651
|
+
], () => {
|
|
652
|
+
if (!this.ports.minimaps().size)
|
|
653
|
+
return;
|
|
654
|
+
const minimaps = Array.from(this.ports.minimaps().values());
|
|
655
|
+
const visibleMinimaps = minimaps.filter((minimap) => minimap.viewportVisible &&
|
|
656
|
+
this.ports.getPanelTransitionOpacity(this.ports.panelRuntimes()[minimap.panelIndex]) >
|
|
657
|
+
0.001);
|
|
658
|
+
if (!visibleMinimaps.length)
|
|
659
|
+
return;
|
|
660
|
+
const panelVisibility = this.ports.panelRuntimes().map((panel) => panel.group.visible);
|
|
661
|
+
visibleMinimaps.forEach((active) => {
|
|
662
|
+
minimaps.forEach((minimap) => {
|
|
663
|
+
minimap.layer.visible = minimap === active;
|
|
664
|
+
});
|
|
665
|
+
this.ports.panelRuntimes().forEach((panel, index) => {
|
|
666
|
+
if (panel.glass)
|
|
667
|
+
panel.group.visible = index === active.panelIndex;
|
|
668
|
+
});
|
|
669
|
+
if (active.overlayComposite.visible &&
|
|
670
|
+
(!active.overlayCaptureValid ||
|
|
671
|
+
(this.measurementMode !== 'reuse-capture' && active.overlayCaptureDirty))) {
|
|
672
|
+
this.ports.renderMinimapBlur(active);
|
|
673
|
+
active.overlayCaptureDirty = false;
|
|
674
|
+
active.overlayCaptureValid = true;
|
|
675
|
+
this._minimapOverlayCapturePasses += 1;
|
|
676
|
+
}
|
|
677
|
+
if (active.overlayComposite.visible &&
|
|
678
|
+
this.ports.panelRuntimes()[active.panelIndex]?.surface === 'glass' &&
|
|
679
|
+
(!active.panelCaptureValid ||
|
|
680
|
+
(this.measurementMode !== 'reuse-capture' && active.panelCaptureDirty))) {
|
|
681
|
+
this.ports.renderMinimapPanelCapture(active);
|
|
682
|
+
active.panelCaptureDirty = false;
|
|
683
|
+
active.panelCaptureValid = true;
|
|
684
|
+
}
|
|
685
|
+
this.ports.renderer.clearDepth();
|
|
686
|
+
const spatialElementVisible = active.spatialElementRoot.visible;
|
|
687
|
+
if (this.ports.frame().catalogDockTarget &&
|
|
688
|
+
this.ports.frame().catalogHandoff &&
|
|
689
|
+
!this.ports.frame().catalogMotionComplete)
|
|
690
|
+
active.spatialElementRoot.visible = false;
|
|
691
|
+
this.ports.renderer.render(this.ports.minimapScene(), active.screenCamera);
|
|
692
|
+
active.spatialElementRoot.visible = spatialElementVisible;
|
|
693
|
+
this._minimapSceneRenderPasses += 1;
|
|
694
|
+
});
|
|
695
|
+
this.ports.panelRuntimes().forEach((panel, index) => {
|
|
696
|
+
panel.group.visible = panelVisibility[index];
|
|
697
|
+
});
|
|
698
|
+
minimaps.forEach((minimap) => {
|
|
699
|
+
minimap.layer.visible =
|
|
700
|
+
minimap.viewportVisible &&
|
|
701
|
+
this.ports.getPanelTransitionOpacity(this.ports.panelRuntimes()[minimap.panelIndex]) >
|
|
702
|
+
0.001;
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
renderModelOutline(target, opacity = 1) {
|
|
707
|
+
this.displayOutlineOpacity.value = 0;
|
|
708
|
+
if (this.renderMeasurement === 'no-halo')
|
|
709
|
+
return;
|
|
710
|
+
const opacityBefore = this.outlineOpacityScale.value;
|
|
711
|
+
try {
|
|
712
|
+
return withRendererState(this.ports.renderer, () => {
|
|
713
|
+
if (!this.ports.frame().stageViewportVisible ||
|
|
714
|
+
!(this.ports.frame().modelHover || this.ports.frame().modelInteractionActive) ||
|
|
715
|
+
!this.outlineMaskTarget ||
|
|
716
|
+
!this.outlineQuad)
|
|
717
|
+
return;
|
|
718
|
+
const previousClearAlpha = this.ports.renderer.getClearAlpha();
|
|
719
|
+
const previousClearColor = this.ports.renderer.getClearColor(new THREE.Color());
|
|
720
|
+
const previousOpacity = this.outlineOpacityScale.value;
|
|
721
|
+
if (this.renderMeasurement !== 'halo-frozen-mask' || !this.outlineMaskValid) {
|
|
722
|
+
this.ports.renderer.setRenderTarget(this.outlineMaskTarget);
|
|
723
|
+
this.ports.renderer.setClearColor(0x000000, 0);
|
|
724
|
+
this.ports.renderer.clear();
|
|
725
|
+
this.ports.renderer.render(this.outlineMaskScene, this.ports.camera);
|
|
726
|
+
this.outlineMaskValid = true;
|
|
727
|
+
}
|
|
728
|
+
this.ports.renderer.setClearColor(previousClearColor, previousClearAlpha);
|
|
729
|
+
this.ports.renderer.setRenderTarget(target);
|
|
730
|
+
this.outlineOpacityScale.value = opacity;
|
|
731
|
+
// Glass can refract the sharp scene capture, so keep the halo in that
|
|
732
|
+
// capture while a glass surface is visible. Forced fusion is a test probe.
|
|
733
|
+
const fuseThisFrame = this.fuseOutline &&
|
|
734
|
+
(this.renderMeasurement === 'halo-fused' ||
|
|
735
|
+
!this.ports
|
|
736
|
+
.panelRuntimes()
|
|
737
|
+
.some((panel) => panel.surface === 'glass' && panel.group.visible));
|
|
738
|
+
if (fuseThisFrame)
|
|
739
|
+
this.displayOutlineOpacity.value = opacity;
|
|
740
|
+
else if (this.renderMeasurement !== 'halo-mask-only')
|
|
741
|
+
this.outlineQuad.render(this.ports.renderer);
|
|
742
|
+
this.outlineOpacityScale.value = previousOpacity;
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
finally {
|
|
746
|
+
this.outlineOpacityScale.value = opacityBefore;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
renderPanelBlurCaptures(renderTargets, forceAll = false) {
|
|
750
|
+
const visibleBlurKeys = forceAll
|
|
751
|
+
? undefined
|
|
752
|
+
: new Set(this.ports.panelRuntimes().flatMap((panel, index) => {
|
|
753
|
+
if (!panel.group.visible)
|
|
754
|
+
return [];
|
|
755
|
+
const needsGlassCapture = panel.surface === 'glass' && Boolean(panel.glass);
|
|
756
|
+
const needsFrostedMinimapCapture = panel.surface === 'frosted' &&
|
|
757
|
+
Boolean(this.ports.minimaps().get(index)?.overlayComposite.visible);
|
|
758
|
+
return needsGlassCapture || needsFrostedMinimapCapture
|
|
759
|
+
? [this.getPanelBlurKey(panel.options)]
|
|
760
|
+
: [];
|
|
761
|
+
}));
|
|
762
|
+
renderTargets.panelBlurCaptures.forEach(({ target, quad }, blurKey) => {
|
|
763
|
+
if (visibleBlurKeys && !visibleBlurKeys.has(blurKey))
|
|
764
|
+
return;
|
|
765
|
+
const size = `${target.width}:${target.height}`;
|
|
766
|
+
if (this.renderMeasurement === 'frozen-backdrop' &&
|
|
767
|
+
this.measuredBackdropSeeds.get(target) === size)
|
|
768
|
+
return;
|
|
769
|
+
this.ports.renderer.setRenderTarget(target);
|
|
770
|
+
this.ports.renderer.clear();
|
|
771
|
+
quad.render(this.ports.renderer);
|
|
772
|
+
if (this.renderMeasurement === 'frozen-backdrop')
|
|
773
|
+
this.measuredBackdropSeeds.set(target, size);
|
|
774
|
+
this._panelBlurRenderPasses += 1;
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
renderStageDisplay() {
|
|
778
|
+
if (!this._stageDisplayQuad)
|
|
779
|
+
return;
|
|
780
|
+
this.ports.renderer.setRenderTarget(null);
|
|
781
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
782
|
+
this.ports.renderer.setClearColor(0xffffff, 1);
|
|
783
|
+
this.ports.renderer.clear();
|
|
784
|
+
this._stageDisplayQuad.render(this.ports.renderer);
|
|
785
|
+
}
|
|
786
|
+
renderStageContents() {
|
|
787
|
+
this.ports.renderer.clear();
|
|
788
|
+
this.ports.renderer.render(this.ports.backgroundScene, this.ports.camera);
|
|
789
|
+
this.ports.renderer.render(this.ports.tintScene, this.ports.tintCamera);
|
|
790
|
+
this.backgroundCoverOpacity.value = 1 - this.ports.frame().backgroundReveal;
|
|
791
|
+
if (this.backgroundCoverOpacity.value > 0)
|
|
792
|
+
this.backgroundCover.render(this.ports.renderer);
|
|
793
|
+
if (this.ports.frame().stageViewportVisible &&
|
|
794
|
+
(!this.ports.frame().catalogHandoff || this.ports.frame().catalogMotionComplete) &&
|
|
795
|
+
(!this.ports.frame().catalog || this.ports.frame().pageModelReady)) {
|
|
796
|
+
this.ports.renderer.clearDepth();
|
|
797
|
+
this.ports.renderer.render(this.ports.scene, this.ports.camera);
|
|
798
|
+
this._stageModelRenderPasses += 1;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
releaseOutline() {
|
|
802
|
+
this.displayOutlineOpacity.value = 0;
|
|
803
|
+
this.displayOutlineMask.value = this.emptyOutlineMask;
|
|
804
|
+
this.outlineMaskModel?.removeFromParent();
|
|
805
|
+
this.outlineMaskMaterial?.dispose();
|
|
806
|
+
this.outlineCompositeMaterial?.dispose();
|
|
807
|
+
this.outlineMaskTarget?.dispose();
|
|
808
|
+
this.outlineMaskModel = undefined;
|
|
809
|
+
this.outlineMaskMaterial = undefined;
|
|
810
|
+
this.outlineCompositeMaterial = undefined;
|
|
811
|
+
this.outlineMaskTarget = undefined;
|
|
812
|
+
this.outlineQuad = undefined;
|
|
813
|
+
}
|
|
814
|
+
resizeOutline(width, height) {
|
|
815
|
+
this.outlineWidth = width;
|
|
816
|
+
this.outlineHeight = height;
|
|
817
|
+
const scale = this.renderMeasurement === 'halo-half-mask' ? 0.5 : 1;
|
|
818
|
+
this.outlineMaskTarget?.setSize(Math.max(1, Math.round(width * scale)), Math.max(1, Math.round(height * scale)));
|
|
819
|
+
this.outlineMaskValid = false;
|
|
820
|
+
this.outlineTexel.value.set(this.ports.interactionTheme().outlineThickness / Math.max(width, 1), this.ports.interactionTheme().outlineThickness / Math.max(height, 1));
|
|
821
|
+
this.outlineGlowTexel.value.set((this.ports.interactionTheme().outlineThickness *
|
|
822
|
+
this.ports.interactionTheme().outlineGlowThickness) /
|
|
823
|
+
Math.max(width, 1), (this.ports.interactionTheme().outlineThickness *
|
|
824
|
+
this.ports.interactionTheme().outlineGlowThickness) /
|
|
825
|
+
Math.max(height, 1));
|
|
826
|
+
}
|
|
827
|
+
dispose() {
|
|
828
|
+
if (this.disposed)
|
|
829
|
+
return;
|
|
830
|
+
this.disposed = true;
|
|
831
|
+
this.releaseOutline();
|
|
832
|
+
this.emptyOutlineMask.dispose();
|
|
833
|
+
this.disposeSceneCapture();
|
|
834
|
+
this.backgroundCoverMaterial.dispose();
|
|
835
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
836
|
+
this.foregroundCanvasTarget?.dispose();
|
|
837
|
+
this.foregroundCanvasTarget = undefined;
|
|
838
|
+
this.carouselRearTarget?.dispose();
|
|
839
|
+
this.carouselRearTarget = undefined;
|
|
840
|
+
this.carouselRearCanvas?.remove();
|
|
841
|
+
this.foregroundCanvas?.remove();
|
|
842
|
+
}
|
|
843
|
+
get activeRenderTargets() {
|
|
844
|
+
return this._activeRenderTargets;
|
|
845
|
+
}
|
|
846
|
+
get stageDisplayQuad() {
|
|
847
|
+
return this._stageDisplayQuad;
|
|
848
|
+
}
|
|
849
|
+
get minimapOverlayCapturePasses() {
|
|
850
|
+
return this._minimapOverlayCapturePasses;
|
|
851
|
+
}
|
|
852
|
+
get renderTargetSetCreations() {
|
|
853
|
+
return this._renderTargetSetCreations;
|
|
854
|
+
}
|
|
855
|
+
get renderTargetSetResizes() {
|
|
856
|
+
return this._renderTargetSetResizes;
|
|
857
|
+
}
|
|
858
|
+
get renderTargetSetWarmups() {
|
|
859
|
+
return this._renderTargetSetWarmups;
|
|
860
|
+
}
|
|
861
|
+
get stageModelRenderPasses() {
|
|
862
|
+
return this._stageModelRenderPasses;
|
|
863
|
+
}
|
|
864
|
+
get panelBlurRenderPasses() {
|
|
865
|
+
return this._panelBlurRenderPasses;
|
|
866
|
+
}
|
|
867
|
+
get panelSceneRenderPasses() {
|
|
868
|
+
return this._panelSceneRenderPasses;
|
|
869
|
+
}
|
|
870
|
+
get minimapSceneRenderPasses() {
|
|
871
|
+
return this._minimapSceneRenderPasses;
|
|
872
|
+
}
|
|
873
|
+
/** The facade advances owners first; this command submits the ordered GPU passes. */
|
|
874
|
+
renderFrame(contentOnly, outline) {
|
|
875
|
+
this.displayOutlineOpacity.value = 0;
|
|
876
|
+
return withRendererState(this.ports.renderer, () => {
|
|
877
|
+
this.ports.renderer.setCanvasTarget(this.ports.backgroundCanvasTarget);
|
|
878
|
+
if (contentOnly) {
|
|
879
|
+
this.ports.renderer.setRenderTarget(null);
|
|
880
|
+
if (!this.ports.frame().outgoingBackground) {
|
|
881
|
+
this.ports.renderer.setClearColor(0, 0);
|
|
882
|
+
this.ports.renderer.clear();
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
if (!this._activeRenderTargets)
|
|
887
|
+
return;
|
|
888
|
+
this.ports.renderer.setRenderTarget(this._activeRenderTargets.sceneCapture);
|
|
889
|
+
this.ports.renderStage();
|
|
890
|
+
this.renderPanelBlurCaptures(this._activeRenderTargets);
|
|
891
|
+
if (outline)
|
|
892
|
+
this.renderModelOutline(this._activeRenderTargets.sceneCapture, 1);
|
|
893
|
+
this.renderStageDisplay();
|
|
894
|
+
this.renderBackgroundPanels();
|
|
895
|
+
}
|
|
896
|
+
this.renderCarouselRear();
|
|
897
|
+
this.renderForegroundLayer();
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
//# sourceMappingURL=StageRenderPipeline.js.map
|