@fps-games/editor 0.2.1-beta.3 → 0.2.1-beta.4
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/build-info.json +44 -44
- package/dist/editor-commands/capabilities/assets.d.ts +8 -0
- package/dist/editor-commands/capabilities/assets.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/assets.js +41 -41
- package/dist/editor-commands/capabilities/assets.js.map +1 -0
- package/dist/editor-commands/capabilities/editor-state.d.ts +5 -0
- package/dist/editor-commands/capabilities/editor-state.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/editor-state.js +22 -22
- package/dist/editor-commands/capabilities/editor-state.js.map +1 -0
- package/dist/editor-commands/capabilities/hierarchy.d.ts +4 -0
- package/dist/editor-commands/capabilities/hierarchy.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/hierarchy.js +5 -5
- package/dist/editor-commands/capabilities/hierarchy.js.map +1 -0
- package/dist/editor-commands/capabilities/host-lifecycle.d.ts +11 -0
- package/dist/editor-commands/capabilities/host-lifecycle.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/host-lifecycle.js +149 -0
- package/dist/editor-commands/capabilities/host-lifecycle.js.map +1 -0
- package/dist/editor-commands/capabilities/prefabs.d.ts +5 -0
- package/dist/editor-commands/capabilities/prefabs.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/prefabs.js +93 -93
- package/dist/editor-commands/capabilities/prefabs.js.map +1 -0
- package/dist/editor-commands/capabilities/scene-objects.d.ts +8 -0
- package/dist/editor-commands/capabilities/scene-objects.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/scene-objects.js +480 -0
- package/dist/editor-commands/capabilities/scene-objects.js.map +1 -0
- package/dist/editor-commands/capabilities/selection.d.ts +5 -0
- package/dist/editor-commands/capabilities/selection.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/selection.js +60 -0
- package/dist/editor-commands/capabilities/selection.js.map +1 -0
- package/dist/editor-commands/capabilities/shadows.d.ts +5 -0
- package/dist/editor-commands/capabilities/shadows.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/shadows.js +74 -74
- package/dist/editor-commands/capabilities/shadows.js.map +1 -0
- package/dist/editor-commands/capabilities/transform.d.ts +5 -0
- package/dist/editor-commands/capabilities/transform.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/transform.js +164 -0
- package/dist/editor-commands/capabilities/transform.js.map +1 -0
- package/dist/editor-commands/capabilities/ui-regions.d.ts +4 -0
- package/dist/editor-commands/capabilities/ui-regions.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/ui-regions.js +55 -57
- package/dist/editor-commands/capabilities/ui-regions.js.map +1 -0
- package/dist/editor-commands/capabilities/viewport.d.ts +5 -0
- package/dist/editor-commands/capabilities/viewport.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/viewport.js +100 -100
- package/dist/editor-commands/capabilities/viewport.js.map +1 -0
- package/dist/editor-commands/command-sources.d.ts +7 -0
- package/dist/editor-commands/command-sources.d.ts.map +1 -0
- package/dist/editor-commands/command-sources.js +34 -0
- package/dist/editor-commands/command-sources.js.map +1 -0
- package/dist/editor-commands/diagnostics.d.ts +12 -0
- package/dist/editor-commands/diagnostics.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/diagnostics.js +4 -4
- package/dist/editor-commands/diagnostics.js.map +1 -0
- package/dist/{agent-bridge → editor-commands}/index.d.ts +1 -1
- package/dist/editor-commands/index.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/index.js +1 -1
- package/dist/editor-commands/index.js.map +1 -0
- package/dist/editor-commands/register.d.ts +4 -0
- package/dist/editor-commands/register.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/register.js +323 -286
- package/dist/editor-commands/register.js.map +1 -0
- package/dist/{agent-bridge → editor-commands}/shared.d.ts +80 -80
- package/dist/editor-commands/shared.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/shared.js +29 -29
- package/dist/editor-commands/shared.js.map +1 -0
- package/dist/editor-commands/source-types.d.ts +110 -0
- package/dist/editor-commands/source-types.d.ts.map +1 -0
- package/dist/editor-commands/source-types.js.map +1 -0
- package/dist/editor-plugin-commands.d.ts +4 -0
- package/dist/editor-plugin-commands.d.ts.map +1 -0
- package/dist/editor-plugin-commands.js +18 -0
- package/dist/editor-plugin-commands.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/local-editor-commands.d.ts +2 -0
- package/dist/local-editor-commands.d.ts.map +1 -0
- package/dist/local-editor-commands.js +2 -0
- package/dist/local-editor-commands.js.map +1 -0
- package/dist/local-editor-harness.d.ts +35 -21
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +1721 -367
- package/dist/local-editor-harness.js.map +1 -1
- package/dist/local-editor-prefab-stage-transaction.d.ts +2 -1
- package/dist/local-editor-prefab-stage-transaction.d.ts.map +1 -1
- package/dist/local-editor-prefab-stage-transaction.js +6 -5
- package/dist/local-editor-prefab-stage-transaction.js.map +1 -1
- package/dist/local-editor-scene-view-interaction-runtime.d.ts.map +1 -1
- package/dist/local-editor-scene-view-interaction-runtime.js +2 -5
- package/dist/local-editor-scene-view-interaction-runtime.js.map +1 -1
- package/dist/playable-local-editor-entry.d.ts +10 -0
- package/dist/playable-local-editor-entry.d.ts.map +1 -1
- package/dist/playable-local-editor-entry.js +10 -2
- package/dist/playable-local-editor-entry.js.map +1 -1
- package/dist/playable-local-editor-host.d.ts +3 -32
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js +6 -70
- package/dist/playable-local-editor-host.js.map +1 -1
- package/dist/playable-product-local-editor.d.ts +1 -2
- package/dist/playable-product-local-editor.d.ts.map +1 -1
- package/dist/playable-product-local-editor.js +0 -1
- package/dist/playable-product-local-editor.js.map +1 -1
- package/dist/playable-product-projection-preview.d.ts.map +1 -1
- package/dist/playable-product-projection-preview.js +1 -1
- package/dist/playable-product-projection-preview.js.map +1 -1
- package/dist/playable-product-scene-capabilities.d.ts +0 -2
- package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
- package/dist/playable-product-scene-capabilities.js +33 -6
- package/dist/playable-product-scene-capabilities.js.map +1 -1
- package/dist/playable-runtime-babylon.d.ts +4 -0
- package/dist/playable-runtime-babylon.d.ts.map +1 -1
- package/dist/playable-runtime-babylon.js +4 -0
- package/dist/playable-runtime-babylon.js.map +1 -1
- package/dist/playable-sdk.d.ts +1 -1
- package/dist/playable-sdk.d.ts.map +1 -1
- package/dist/playable-sdk.js.map +1 -1
- package/dist/playable-standard-project.d.ts +0 -2
- package/dist/playable-standard-project.d.ts.map +1 -1
- package/dist/playable-standard-project.js +1 -2
- package/dist/playable-standard-project.js.map +1 -1
- package/dist/project-service-projection.d.ts +16 -0
- package/dist/project-service-projection.d.ts.map +1 -0
- package/dist/project-service-projection.js +67 -0
- package/dist/project-service-projection.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.d.ts +18 -0
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.js +54 -18
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +9 -9
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +127 -13
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +66 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +6 -6
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.d.ts +32 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.js +254 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +3 -1
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js +2 -0
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.d.ts +68 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.js +650 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.d.ts +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.js +22 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts +8 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js +117 -6
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts +14 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js +100 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +8 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +75 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +37 -12
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +25 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +332 -107
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +7 -7
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.d.ts +107 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.js +1211 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.d.ts +34 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.js +260 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.d.ts +9 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.js +14 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.d.ts +18 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.js +113 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.d.ts +82 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.js +1098 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.d.ts +6 -7
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.js +62 -103
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.d.ts +30 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.js +540 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.d.ts +9 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.js +61 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts +55 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-session.js +247 -6
- package/node_modules/@fps-games/editor-core/dist/editor-session.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.d.ts +6 -2
- package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.js +6 -2
- package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-core/package.json +6 -6
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.js +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/bridge-command/protocol.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/bridge-command/protocol.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js +41 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.d.ts +27 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.js +214 -7
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.js +11 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.d.ts +2 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.js +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.js +77 -31
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.d.ts +8 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.d.ts +21 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.js +90 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts +27 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js +161 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.d.ts +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.js +5 -92
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.d.ts +7 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.js +26 -9
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.d.ts +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.js +19 -8
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.js +16 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.d.ts +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.js +12 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.d.ts +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.js +10 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.js +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.d.ts +17 -82
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.js +53 -57
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.js +3 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.d.ts +10 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.js +256 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.js +7 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +8 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js +134 -12
- package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.js +47 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.d.ts +27 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.js +592 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +3 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.js +61 -6
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.d.ts +0 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.js +1 -10
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +21 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.d.ts +13 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.js +18 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.d.ts +28 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.js +863 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.d.ts +1626 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/{agent-bridge.js → editor-command-capabilities.js} +766 -620
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.d.ts +69 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.js +22 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.d.ts +136 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.js +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.d.ts +225 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.js +4 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +6 -3
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.js +6 -3
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/package.json +2 -2
- package/node_modules/@fps-games/editor-tooling/package.json +3 -3
- package/node_modules/@fps-games/editor-ui/package.json +1 -1
- package/node_modules/@fps-games/playable-assets/package.json +1 -1
- package/node_modules/@fps-games/playable-contracts/package.json +1 -1
- package/node_modules/@fps-games/playable-rendering/package.json +2 -2
- package/node_modules/@fps-games/playable-runtime/package.json +12 -12
- package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
- package/node_modules/@fps-games/playable-scene/package.json +2 -2
- package/node_modules/@fps-games/plugin-api/package.json +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-assets/package.json +6 -6
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.d.ts +1 -0
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.d.ts.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.js +78 -4
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.js.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
- package/node_modules/@fps-games/plugin-host/package.json +2 -2
- package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-markers/package.json +5 -5
- package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-materials/package.json +5 -5
- package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
- package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-scene/package.json +5 -5
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
- package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
- package/package.json +23 -23
- package/dist/agent-bridge/capabilities/assets.d.ts +0 -8
- package/dist/agent-bridge/capabilities/assets.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/assets.js.map +0 -1
- package/dist/agent-bridge/capabilities/editor-state.d.ts +0 -5
- package/dist/agent-bridge/capabilities/editor-state.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/editor-state.js.map +0 -1
- package/dist/agent-bridge/capabilities/hierarchy.d.ts +0 -4
- package/dist/agent-bridge/capabilities/hierarchy.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/hierarchy.js.map +0 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts +0 -11
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.js +0 -149
- package/dist/agent-bridge/capabilities/host-lifecycle.js.map +0 -1
- package/dist/agent-bridge/capabilities/prefabs.d.ts +0 -5
- package/dist/agent-bridge/capabilities/prefabs.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/prefabs.js.map +0 -1
- package/dist/agent-bridge/capabilities/scene-objects.d.ts +0 -8
- package/dist/agent-bridge/capabilities/scene-objects.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/scene-objects.js +0 -480
- package/dist/agent-bridge/capabilities/scene-objects.js.map +0 -1
- package/dist/agent-bridge/capabilities/selection.d.ts +0 -5
- package/dist/agent-bridge/capabilities/selection.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/selection.js +0 -60
- package/dist/agent-bridge/capabilities/selection.js.map +0 -1
- package/dist/agent-bridge/capabilities/shadows.d.ts +0 -5
- package/dist/agent-bridge/capabilities/shadows.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/shadows.js.map +0 -1
- package/dist/agent-bridge/capabilities/transform.d.ts +0 -5
- package/dist/agent-bridge/capabilities/transform.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/transform.js +0 -164
- package/dist/agent-bridge/capabilities/transform.js.map +0 -1
- package/dist/agent-bridge/capabilities/ui-regions.d.ts +0 -4
- package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/ui-regions.js.map +0 -1
- package/dist/agent-bridge/capabilities/viewport.d.ts +0 -5
- package/dist/agent-bridge/capabilities/viewport.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/viewport.js.map +0 -1
- package/dist/agent-bridge/capability-sources.d.ts +0 -7
- package/dist/agent-bridge/capability-sources.d.ts.map +0 -1
- package/dist/agent-bridge/capability-sources.js +0 -34
- package/dist/agent-bridge/capability-sources.js.map +0 -1
- package/dist/agent-bridge/diagnostics.d.ts +0 -12
- package/dist/agent-bridge/diagnostics.d.ts.map +0 -1
- package/dist/agent-bridge/diagnostics.js.map +0 -1
- package/dist/agent-bridge/index.d.ts.map +0 -1
- package/dist/agent-bridge/index.js.map +0 -1
- package/dist/agent-bridge/register.d.ts +0 -4
- package/dist/agent-bridge/register.d.ts.map +0 -1
- package/dist/agent-bridge/register.js.map +0 -1
- package/dist/agent-bridge/shared.d.ts.map +0 -1
- package/dist/agent-bridge/shared.js.map +0 -1
- package/dist/agent-bridge/source-types.d.ts +0 -110
- package/dist/agent-bridge/source-types.d.ts.map +0 -1
- package/dist/agent-bridge/source-types.js.map +0 -1
- package/dist/editor-plugin-agent-capabilities.d.ts +0 -4
- package/dist/editor-plugin-agent-capabilities.d.ts.map +0 -1
- package/dist/editor-plugin-agent-capabilities.js +0 -64
- package/dist/editor-plugin-agent-capabilities.js.map +0 -1
- package/dist/local-editor-agent-actions.d.ts +0 -43
- package/dist/local-editor-agent-actions.d.ts.map +0 -1
- package/dist/local-editor-agent-actions.js +0 -321
- package/dist/local-editor-agent-actions.js.map +0 -1
- package/dist/local-editor-agent-bridge-transport.d.ts +0 -129
- package/dist/local-editor-agent-bridge-transport.d.ts.map +0 -1
- package/dist/local-editor-agent-bridge-transport.js +0 -403
- package/dist/local-editor-agent-bridge-transport.js.map +0 -1
- package/dist/local-editor-agent-bridge.d.ts +0 -2
- package/dist/local-editor-agent-bridge.d.ts.map +0 -1
- package/dist/local-editor-agent-bridge.js +0 -2
- package/dist/local-editor-agent-bridge.js.map +0 -1
- package/dist/local-editor-agent-context.d.ts +0 -68
- package/dist/local-editor-agent-context.d.ts.map +0 -1
- package/dist/local-editor-agent-context.js +0 -716
- package/dist/local-editor-agent-context.js.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts +0 -22
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js +0 -106
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.d.ts +0 -17
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.js +0 -14
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.js.map +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.d.ts +0 -23
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.js +0 -47
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.js.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.d.ts +0 -112
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.js +0 -159
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.js.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.d.ts +0 -15
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.js +0 -76
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts +0 -1622
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts +0 -68
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js +0 -23
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +0 -187
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.js +0 -5
- package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +0 -1
- /package/dist/{agent-bridge → editor-commands}/source-types.js +0 -0
package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-presentation-controller.js","sourceRoot":"","sources":["../src/selection-presentation-controller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,4BAA4B,GAE7B,MAAM,2BAA2B,CAAC;AAGnC,MAAM,oCAAoC,GAAG,8BAA8B,CAAC;AAC5E,MAAM,gCAAgC,GAAG,oCAAoC,CAAC;AAC9E,MAAM,4BAA4B,GAAG,CAAC,CAAC;AACvC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AACxC,MAAM,8BAA8B,GAAG,CAAC,CAAC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,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC7B,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,IAAI,aAAa,IAAI,IAAI,IAAI,aAAa,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3F,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACpE,+BAA+B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,OAAkD,EAClD,gBAAoF;IAEpF,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC;YACf,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,+DAA+D;YACxE,KAAK;SACN,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { EditorSelectionState } from '@fps-games/editor-core';\nimport {\n BabylonSelectionIdentityPass,\n type BabylonSelectionIdentityGroup,\n} from './selection-identity-pass';\nimport type { BabylonRuntimeGlobal, RuntimeCamera, RuntimeScene } from './types';\n\nconst SELECTION_OCCUPANCY_MASK_SHADER_NAME = 'editorSelectionOccupancyMask';\nconst SELECTION_SILHOUETTE_SHADER_NAME = 'editorSelectionSilhouetteComposite';\nconst MAX_SELECTION_SOURCE_DENSITY = 2;\nconst TEXTURE_TYPE_UNSIGNED_BYTE = 0;\nconst TEXTURE_TYPE_FLOAT = 1;\nconst TEXTURE_TYPE_HALF_FLOAT = 2;\nconst TEXTURE_NEAREST_SAMPLING_MODE = 1;\nconst TEXTURE_BILINEAR_SAMPLING_MODE = 2;\nconst SELECTION_PRESENTATION_PADDING_PX = 6;\nconst SELECTION_PRESENTATION_COLOR = [1, 0.9, 0.22] as const;\n\nexport type BabylonEditorSelectionUvBounds = readonly [number, number, number, number];\nexport type BabylonEditorSelectionSceneDepthSourceKind = 'external' | 'prepass' | 'dedicated';\n\nexport interface BabylonEditorSelectionSceneDepthSourceLease {\n readonly kind: BabylonEditorSelectionSceneDepthSourceKind;\n readonly packed: boolean;\n readonly backgroundDepth: 0 | 1;\n getTexture(): any;\n activate(): void;\n deactivate(): void;\n resize(width: number, height: number): void;\n dispose(): void;\n}\n\nexport interface BabylonEditorSelectionSceneDepthSourceRequest {\n babylon: BabylonRuntimeGlobal & Record<string, any>;\n scene: RuntimeScene;\n camera: RuntimeCamera;\n consumerPostProcess: any;\n textureType: number;\n width: number;\n height: number;\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void;\n}\n\nexport interface BabylonEditorSelectionSceneDepthSourceProvider {\n acquire(request: BabylonEditorSelectionSceneDepthSourceRequest): BabylonEditorSelectionSceneDepthSourceLease;\n}\n\nconst SELECTION_OCCUPANCY_MASK_FRAGMENT_SHADER = `\nprecision highp float;\nvarying vec2 vUV;\nuniform sampler2D editorSelectedDepthSampler;\nuniform sampler2D editorSelectionIdentitySampler;\nuniform vec2 editorSelectedDepthTexelSize;\nuniform vec2 editorOutputTexelSize;\nuniform vec2 editorPresentationTexelSize;\nuniform vec4 editorSelectionUvBounds;\nuniform float editorSelectedPackedDepth;\nuniform float editorSelectionIdentityEnabled;\n\nfloat unpackEditorDepth(vec4 color) {\n const vec4 bitShift = vec4(\n 1.0 / (255.0 * 255.0 * 255.0),\n 1.0 / (255.0 * 255.0),\n 1.0 / 255.0,\n 1.0\n );\n return dot(color, bitShift);\n}\n\nfloat selectionOccupancyAt(vec2 uv) {\n vec2 sampleUv = clamp(uv, vec2(0.0), vec2(1.0));\n vec4 selectedDepthSample = texture2D(editorSelectedDepthSampler, sampleUv);\n float selectedDepth = mix(\n selectedDepthSample.r,\n unpackEditorDepth(selectedDepthSample),\n editorSelectedPackedDepth\n );\n return 1.0 - step(0.999999, selectedDepth);\n}\n\nfloat selectionIdentityValue(vec4 color) {\n vec3 bytes = floor(color.rgb * 255.0 + 0.5);\n return dot(bytes, vec3(65536.0, 256.0, 1.0));\n}\n\nfloat selectionIdentityBoundaryAgainst(\n vec2 neighborUv,\n float centerSelected,\n float centerValue\n) {\n vec4 neighborIdentity = texture2D(editorSelectionIdentitySampler, neighborUv);\n float neighborValue = selectionIdentityValue(neighborIdentity);\n float identitiesDiffer = step(0.5, abs(centerValue - neighborValue));\n // The object-ID target already depth-resolves the selected surface. Pick one\n // deterministic owner for each differing-ID edge to avoid double thickness.\n float stableIdentityOwner = step(0.5, centerValue - neighborValue);\n return centerSelected * identitiesDiffer * stableIdentityOwner;\n}\n\nfloat selectionIdentityBoundarySampleAt(vec2 uv, vec2 identityTexel) {\n vec4 centerIdentity = texture2D(editorSelectionIdentitySampler, uv);\n float centerSelected = step(0.001, centerIdentity.a);\n float centerValue = selectionIdentityValue(centerIdentity);\n float boundary = 0.0;\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(-identityTexel.x, 0.0), centerSelected, centerValue\n ));\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(identityTexel.x, 0.0), centerSelected, centerValue\n ));\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(0.0, -identityTexel.y), centerSelected, centerValue\n ));\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(0.0, identityTexel.y), centerSelected, centerValue\n ));\n return boundary;\n}\n\nfloat selectionIdentityBoundaryCoverageAt(\n vec2 uv,\n vec2 outputTexel,\n vec2 boundaryStep\n) {\n vec2 ringWide = outputTexel * vec2(0.32476, 0.1875);\n vec2 ringTall = outputTexel * vec2(0.0, 0.375);\n float coverage = selectionIdentityBoundarySampleAt(uv - ringTall, boundaryStep);\n coverage += selectionIdentityBoundarySampleAt(\n uv + vec2(ringWide.x, -ringWide.y), boundaryStep\n );\n coverage += selectionIdentityBoundarySampleAt(uv + ringWide, boundaryStep);\n coverage += selectionIdentityBoundarySampleAt(uv + ringTall, boundaryStep);\n coverage += selectionIdentityBoundarySampleAt(\n uv + vec2(-ringWide.x, ringWide.y), boundaryStep\n );\n coverage += selectionIdentityBoundarySampleAt(uv - ringWide, boundaryStep);\n return coverage / 6.0;\n}\n\nvoid main(void) {\n if (\n vUV.x < editorSelectionUvBounds.x\n || vUV.y < editorSelectionUvBounds.y\n || vUV.x > editorSelectionUvBounds.z\n || vUV.y > editorSelectionUvBounds.w\n ) {\n gl_FragColor = vec4(0.0);\n return;\n }\n vec2 subpixelOffset = editorSelectedDepthTexelSize * 0.5;\n float coverage = 0.0;\n coverage += selectionOccupancyAt(vUV + vec2(-subpixelOffset.x, -subpixelOffset.y));\n coverage += selectionOccupancyAt(vUV + vec2(subpixelOffset.x, -subpixelOffset.y));\n coverage += selectionOccupancyAt(vUV + vec2(-subpixelOffset.x, subpixelOffset.y));\n coverage += selectionOccupancyAt(vUV + vec2(subpixelOffset.x, subpixelOffset.y));\n float identityBoundary = 0.0;\n if (editorSelectionIdentityEnabled > 0.5) {\n identityBoundary = selectionIdentityBoundaryCoverageAt(\n vUV,\n editorOutputTexelSize,\n editorPresentationTexelSize\n );\n }\n gl_FragColor = vec4(identityBoundary, 0.0, 0.0, coverage * 0.25);\n}\n`;\n\nconst SELECTION_SILHOUETTE_FRAGMENT_SHADER = `\nprecision highp float;\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D editorSceneColorSampler;\nuniform sampler2D editorSceneDepthSampler;\nuniform sampler2D editorSelectedDepthSampler;\nuniform vec2 editorOutputTexelSize;\nuniform vec2 editorPresentationTexelSize;\nuniform vec4 editorSelectionUvBounds;\nuniform vec3 editorSelectionColor;\nuniform float editorScenePackedDepth;\nuniform float editorSelectedPackedDepth;\nuniform float editorSelectionIdentityEnabled;\nuniform float editorSceneBackgroundDepth;\nuniform float editorDepthEpsilon;\n\nfloat unpackEditorDepth(vec4 color) {\n const vec4 bitShift = vec4(\n 1.0 / (255.0 * 255.0 * 255.0),\n 1.0 / (255.0 * 255.0),\n 1.0 / 255.0,\n 1.0\n );\n return dot(color, bitShift);\n}\n\nfloat readEditorDepth(sampler2D depthSampler, vec2 uv, float packedDepth) {\n vec4 sampleValue = texture2D(depthSampler, clamp(uv, vec2(0.0), vec2(1.0)));\n return mix(sampleValue.r, unpackEditorDepth(sampleValue), packedDepth);\n}\n\nfloat selectionCoverageAt(vec2 uv) {\n return texture2D(textureSampler, clamp(uv, vec2(0.0), vec2(1.0))).a;\n}\n\nfloat resolvedSelectionIdentityBoundaryAt(vec2 uv, vec2 outputTexel) {\n vec2 halfTexel = outputTexel * 0.5;\n float coverage = texture2D(\n textureSampler,\n uv + vec2(-halfTexel.x, -halfTexel.y)\n ).r;\n coverage += texture2D(\n textureSampler,\n uv + vec2(halfTexel.x, -halfTexel.y)\n ).r;\n coverage += texture2D(\n textureSampler,\n uv + vec2(-halfTexel.x, halfTexel.y)\n ).r;\n coverage += texture2D(\n textureSampler,\n uv + vec2(halfTexel.x, halfTexel.y)\n ).r;\n return coverage * 0.25;\n}\n\nvoid considerStrongestSelectionNeighbor(\n inout vec3 strongestSample,\n vec2 uv,\n vec2 texel,\n vec2 offset\n) {\n float coverage = selectionCoverageAt(uv + offset * texel);\n float isStronger = step(strongestSample.x, coverage);\n strongestSample = mix(\n strongestSample,\n vec3(coverage, offset),\n isStronger\n );\n}\n\nvec3 strongestSelectionNeighbor(vec2 uv, vec2 texel) {\n vec3 strongestSample = vec3(0.0, 0.0, 0.0);\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n if (x != 0 || y != 0) {\n considerStrongestSelectionNeighbor(\n strongestSample,\n uv,\n texel,\n vec2(float(x), float(y))\n );\n }\n }\n }\n return strongestSample;\n}\n\nfloat selectionSubpixelVisibilityAt(vec2 uv) {\n float selectedDepth = readEditorDepth(\n editorSelectedDepthSampler,\n uv,\n editorSelectedPackedDepth\n );\n float sceneDepth = readEditorDepth(editorSceneDepthSampler, uv, editorScenePackedDepth);\n float sceneBackgroundIsZero = 1.0 - step(0.5, editorSceneBackgroundDepth);\n float emptyZeroDepth = sceneBackgroundIsZero * (1.0 - step(0.000001, sceneDepth));\n sceneDepth = mix(sceneDepth, 1.0, emptyZeroDepth);\n float hasSelection = 1.0 - step(0.999999, selectedDepth);\n float depthDelta = selectedDepth - sceneDepth;\n float isVisible = 1.0 - smoothstep(\n editorDepthEpsilon,\n editorDepthEpsilon * 4.0,\n depthDelta\n );\n return hasSelection * isVisible;\n}\n\nfloat selectionSurfaceVisibilityAt(vec2 uv, vec2 texel) {\n vec2 subpixelOffset = texel * 0.25;\n float visibility = 0.0;\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(-subpixelOffset.x, -subpixelOffset.y))\n );\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(subpixelOffset.x, -subpixelOffset.y))\n );\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(-subpixelOffset.x, subpixelOffset.y))\n );\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(subpixelOffset.x, subpixelOffset.y))\n );\n return visibility;\n}\n\nvoid main(void) {\n vec4 sceneColor = texture2D(editorSceneColorSampler, vUV);\n float center = texture2D(textureSampler, vUV).a;\n if (\n vUV.x < editorSelectionUvBounds.x\n || vUV.y < editorSelectionUvBounds.y\n || vUV.x > editorSelectionUvBounds.z\n || vUV.y > editorSelectionUvBounds.w\n ) {\n gl_FragColor = vec4(sceneColor.rgb, 1.0);\n return;\n }\n float identityAlpha = 0.0;\n if (editorSelectionIdentityEnabled > 0.5) {\n float identityBoundary = resolvedSelectionIdentityBoundaryAt(\n vUV,\n editorOutputTexelSize\n );\n float perceptualIdentityCoverage = pow(\n clamp(identityBoundary, 0.0, 1.0),\n 0.75\n );\n identityAlpha = perceptualIdentityCoverage * selectionSurfaceVisibilityAt(\n vUV,\n editorOutputTexelSize\n );\n }\n float unionAlpha = 0.0;\n if (editorSelectionIdentityEnabled < 0.5 && center < 0.999) {\n float outsideCoverage = 1.0 - clamp(center, 0.0, 1.0);\n vec3 strongestSample = strongestSelectionNeighbor(vUV, editorPresentationTexelSize);\n vec2 strongestSampleUv = vUV + strongestSample.yz * editorPresentationTexelSize;\n float boundaryVisibility = selectionSurfaceVisibilityAt(\n strongestSampleUv,\n editorOutputTexelSize\n );\n unionAlpha = smoothstep(\n 0.0,\n 1.0,\n strongestSample.x * outsideCoverage\n ) * boundaryVisibility;\n }\n float alpha = max(unionAlpha, identityAlpha);\n gl_FragColor = vec4(mix(sceneColor.rgb, editorSelectionColor, alpha), 1.0);\n}\n`;\n\nexport interface BabylonEditorSelectionPresentationProjectedNode {\n nodeId: string;\n outlineMeshes: readonly any[];\n selectionMeshes?: readonly any[];\n selectionPresentationTargets?: readonly BabylonEditorSelectionPresentationTarget[];\n}\n\nexport interface BabylonEditorSelectionPresentationTarget {\n selectionNodeId: string;\n renderMeshes: readonly any[];\n}\n\nexport type BabylonEditorSelectionPresentationDiagnosticCode =\n | 'backend-initialization-failed'\n | 'shader-not-ready'\n | 'camera-replacement-failed'\n | 'resource-dispose-failed';\n\nexport interface BabylonEditorSelectionPresentationDiagnostic {\n code: BabylonEditorSelectionPresentationDiagnosticCode;\n message: string;\n cause?: unknown;\n}\n\nexport interface BabylonEditorSelectionPresentationDiagnostics {\n status: 'idle' | 'active' | 'failed' | 'disposed';\n projectedNodeCount: number;\n selectedNodeCount: number;\n selectedMeshCount: number;\n backendResourceCount: number;\n sceneDepthSource: BabylonEditorSelectionSceneDepthSourceKind | null;\n cameraId: string | null;\n lastDiagnostic: BabylonEditorSelectionPresentationDiagnostic | null;\n}\n\nexport interface BabylonEditorSelectionPresentationBackend {\n setSelectedMeshes(\n meshes: readonly any[],\n groups?: readonly BabylonSelectionIdentityGroup[],\n ): void;\n setEnabled(enabled: boolean): void;\n prewarm?(meshes: readonly any[]): void;\n prepareFrame(): void;\n getResourceCount(): number;\n getSceneDepthSourceKind?(): BabylonEditorSelectionSceneDepthSourceKind | null;\n getCameraId(): string | null;\n dispose(): void;\n}\n\nexport interface BabylonEditorSelectionPresentationControllerOptions {\n babylon: BabylonRuntimeGlobal & Record<string, any>;\n scene: RuntimeScene;\n logger?: Pick<Console, 'warn'>;\n onDiagnostic?: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void;\n sceneDepthSourceProvider?: BabylonEditorSelectionSceneDepthSourceProvider;\n prewarm?: boolean;\n createBackend?: (\n options: BabylonEditorSelectionPresentationControllerOptions,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n ) => BabylonEditorSelectionPresentationBackend;\n}\n\nexport interface BabylonEditorSelectionPresentationController {\n attachProjectedNode(node: BabylonEditorSelectionPresentationProjectedNode): void;\n updateProjectedNode(node: BabylonEditorSelectionPresentationProjectedNode): void;\n detachProjectedNode(nodeId: string): void;\n syncSelection(selection: EditorSelectionState): void;\n prepareFrame(): void;\n getDiagnostics(): BabylonEditorSelectionPresentationDiagnostics;\n dispose(): void;\n}\n\ntype SceneDepthLease = {\n camera: RuntimeCamera;\n renderer: any;\n depthMap: any;\n type: number;\n packed: boolean;\n refs: number;\n activeRefs: number;\n width: number;\n height: number;\n};\n\nconst sceneDepthLeases = new WeakMap<object, Map<object, SceneDepthLease>>();\n\ntype PrePassSceneDepthState = {\n prePassRenderer: any;\n configuration: {\n name: string;\n enabled: boolean;\n texturesRequired: number[];\n needsImageProcessing: boolean;\n };\n activeLeaseCount: number;\n};\n\nconst prePassSceneDepthStates = new WeakMap<object, PrePassSceneDepthState>();\nconst PREPASS_SELECTION_DEPTH_CONFIGURATION_NAME = 'fpsEditorSelectionSceneDepth';\n\ntype CameraSelectionPostProcessSlot = {\n index: number | null;\n postProcess: any;\n vacantTopology: readonly any[] | null;\n};\n\ntype CameraSelectionPostProcessSlotRegistry = {\n owners: Map<object, CameraSelectionPostProcessSlot>;\n releasedSlots: Map<number, readonly any[]>;\n};\n\nconst cameraSelectionPostProcessSlots = new WeakMap<object, CameraSelectionPostProcessSlotRegistry>();\n\nexport function createBabylonEditorSelectionPresentationController(\n options: BabylonEditorSelectionPresentationControllerOptions,\n): BabylonEditorSelectionPresentationController {\n const nodes = new Map<string, BabylonEditorSelectionPresentationProjectedNode>();\n const reportedDiagnosticCodes = new Set<BabylonEditorSelectionPresentationDiagnosticCode>();\n let selection: EditorSelectionState = { selectedIds: [], activeId: null };\n let backend: BabylonEditorSelectionPresentationBackend | null = null;\n let failed = false;\n let disposed = false;\n let selectedMeshCount = 0;\n let prewarmed = false;\n const prewarmedMeshes = new Set<any>();\n let lastDiagnostic: BabylonEditorSelectionPresentationDiagnostic | null = null;\n\n const reportDiagnostic = (diagnostic: BabylonEditorSelectionPresentationDiagnostic): void => {\n lastDiagnostic = diagnostic;\n if (reportedDiagnosticCodes.has(diagnostic.code)) return;\n reportedDiagnosticCodes.add(diagnostic.code);\n options.logger?.warn(`[selection-presentation:${diagnostic.code}] ${diagnostic.message}`, diagnostic.cause);\n options.onDiagnostic?.(diagnostic);\n };\n\n const ensureBackend = (): BabylonEditorSelectionPresentationBackend | null => {\n if (disposed || failed) return null;\n if (backend) return backend;\n try {\n backend = (options.createBackend ?? createDepthAwareSelectionPresentationBackend)(options, reportDiagnostic);\n return backend;\n } catch (cause) {\n failed = true;\n reportDiagnostic({\n code: 'backend-initialization-failed',\n message: 'Selection silhouette resources could not be initialized; visual selection feedback is disabled.',\n cause,\n });\n return null;\n }\n };\n\n const syncBackendMembership = (): void => {\n if (disposed) return;\n const previousSelectedMeshCount = selectedMeshCount;\n const groups = selection.selectedIds\n .map(selectionId => ({\n selectionId,\n meshes: collectSelectedPresentationMeshes(nodes, {\n selectedIds: [selectionId],\n activeId: selectionId,\n }),\n }))\n .filter(group => group.meshes.length > 0);\n const meshes: any[] = [];\n const seenMeshes = new Set<any>();\n for (const group of groups) {\n for (const mesh of group.meshes) appendPresentationMesh(meshes, seenMeshes, mesh);\n }\n selectedMeshCount = meshes.length;\n if (meshes.length === 0) {\n // Projection attaches nodes incrementally. Once a cold-start prewarm has\n // begun, later empty-selection membership updates must not cancel it\n // before the first warm frame has rendered. A real deselection still\n // clears the backend because it transitions from a non-empty selection.\n if (prewarmed && previousSelectedMeshCount === 0) return;\n backend?.setSelectedMeshes([], groups);\n backend?.setEnabled(false);\n return;\n }\n const nextBackend = ensureBackend();\n if (!nextBackend) return;\n try {\n nextBackend.setSelectedMeshes(meshes, groups);\n nextBackend.setEnabled(true);\n nextBackend.prepareFrame();\n } catch (cause) {\n failed = true;\n safelyDisposeBackend(nextBackend, reportDiagnostic);\n backend = null;\n reportDiagnostic({\n code: 'backend-initialization-failed',\n message: 'Selection silhouette synchronization failed; visual selection feedback is disabled.',\n cause,\n });\n }\n };\n\n const prewarmBackendIfNeeded = (\n node: BabylonEditorSelectionPresentationProjectedNode,\n ): void => {\n if (!options.prewarm || disposed || failed || selection.selectedIds.length > 0) return;\n const candidates = collectSelectedPresentationMeshes(\n new Map([[node.nodeId, node]]),\n { selectedIds: [node.nodeId], activeId: node.nodeId },\n ).filter(mesh => !prewarmedMeshes.has(mesh));\n if (candidates.length === 0) return;\n const nextBackend = ensureBackend();\n if (!nextBackend?.prewarm) return;\n // Mark the controller before entering the backend because depth/pre-pass\n // allocation can synchronously re-enter projection membership updates.\n // Those empty-selection updates must observe the in-flight prewarm.\n prewarmed = true;\n for (const candidate of candidates) prewarmedMeshes.add(candidate);\n try {\n nextBackend.prewarm(candidates);\n } catch (cause) {\n for (const candidate of candidates) prewarmedMeshes.delete(candidate);\n prewarmed = prewarmedMeshes.size > 0;\n reportDiagnostic({\n code: 'backend-initialization-failed',\n message: 'Selection silhouette prewarm failed; the first selection may compile resources on demand.',\n cause,\n });\n }\n };\n\n return {\n attachProjectedNode(node) {\n if (disposed) return;\n nodes.set(node.nodeId, node);\n syncBackendMembership();\n prewarmBackendIfNeeded(node);\n },\n updateProjectedNode(node) {\n if (disposed) return;\n nodes.set(node.nodeId, node);\n syncBackendMembership();\n prewarmBackendIfNeeded(node);\n },\n detachProjectedNode(nodeId) {\n if (disposed) return;\n nodes.delete(nodeId);\n syncBackendMembership();\n },\n syncSelection(nextSelection) {\n if (disposed) return;\n selection = {\n selectedIds: [...new Set(nextSelection.selectedIds)],\n activeId: nextSelection.activeId,\n };\n syncBackendMembership();\n },\n prepareFrame() {\n if (disposed || failed || selectedMeshCount === 0) return;\n try {\n backend?.prepareFrame();\n } catch (cause) {\n failed = true;\n if (backend) safelyDisposeBackend(backend, reportDiagnostic);\n backend = null;\n reportDiagnostic({\n code: 'camera-replacement-failed',\n message: 'Selection silhouette camera resources could not be refreshed; visual selection feedback is disabled.',\n cause,\n });\n }\n },\n getDiagnostics() {\n return {\n status: disposed ? 'disposed' : failed ? 'failed' : selectedMeshCount > 0 ? 'active' : 'idle',\n projectedNodeCount: nodes.size,\n selectedNodeCount: selection.selectedIds.length,\n selectedMeshCount,\n backendResourceCount: backend?.getResourceCount() ?? 0,\n sceneDepthSource: backend?.getSceneDepthSourceKind?.() ?? null,\n cameraId: backend?.getCameraId() ?? null,\n lastDiagnostic,\n };\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n nodes.clear();\n selectedMeshCount = 0;\n if (backend) safelyDisposeBackend(backend, reportDiagnostic);\n backend = null;\n },\n };\n}\n\nexport function collectSelectedPresentationMeshes(\n nodes: ReadonlyMap<string, BabylonEditorSelectionPresentationProjectedNode>,\n selection: EditorSelectionState,\n): any[] {\n const selectedIds = new Set(selection.selectedIds);\n const meshes: any[] = [];\n const seen = new Set<any>();\n for (const [nodeId, node] of nodes) {\n const rootSelected = selectedIds.has(nodeId);\n const mappedSelectionNodeIds = new Set(\n (node.selectionPresentationTargets ?? []).map(target => target.selectionNodeId),\n );\n const proxyNodeIds = new Set(\n (node.selectionMeshes ?? [])\n .map(readPresentationMeshSelectionNodeId)\n .filter((id): id is string => !!id),\n );\n for (const mesh of node.outlineMeshes) {\n const meshNodeId = readPresentationMeshSelectionNodeId(mesh) ?? nodeId;\n if (!rootSelected && (proxyNodeIds.has(meshNodeId) || !selectedIds.has(meshNodeId))) continue;\n appendPresentationMesh(meshes, seen, mesh);\n }\n for (const target of node.selectionPresentationTargets ?? []) {\n if (!selectedIds.has(target.selectionNodeId)) continue;\n for (const mesh of target.renderMeshes) appendPresentationMesh(meshes, seen, mesh);\n }\n for (const mesh of node.selectionMeshes ?? []) {\n const meshNodeId = readPresentationMeshSelectionNodeId(mesh) ?? nodeId;\n if (mappedSelectionNodeIds.has(meshNodeId)) continue;\n if (!selectedIds.has(meshNodeId)) continue;\n appendPresentationMesh(meshes, seen, mesh);\n }\n }\n return meshes;\n}\n\nfunction appendPresentationMesh(meshes: any[], seen: Set<any>, mesh: any): void {\n if (!mesh || seen.has(mesh) || mesh.isDisposed?.()) return;\n seen.add(mesh);\n meshes.push(mesh);\n}\n\nfunction readPresentationMeshSelectionNodeId(mesh: any): string | null {\n const nodeId = mesh?.metadata?.editorProjection?.nodeId;\n return typeof nodeId === 'string' && nodeId.length > 0 ? nodeId : null;\n}\n\nfunction createDepthAwareSelectionPresentationBackend(\n options: BabylonEditorSelectionPresentationControllerOptions,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n): BabylonEditorSelectionPresentationBackend {\n const { babylon, scene } = options;\n const beforeRenderObservable = scene?.onBeforeRenderObservable;\n let beforeRenderObserver: unknown = null;\n let enabled = false;\n let disposed = false;\n let selectedMeshes: any[] = [];\n let selectionGroups: readonly BabylonSelectionIdentityGroup[] = [];\n let camera: RuntimeCamera | null = null;\n let sceneDepthLease: BabylonEditorSelectionSceneDepthSourceLease | null = null;\n let selectedDepthRenderer: any = null;\n let selectedDepthMap: any = null;\n let selectionIdentityPass: BabylonSelectionIdentityPass | null = null;\n const occupancyMaskPass = {\n resource: null as any,\n attached: false,\n insertIndex: null as number | null,\n slotOwner: {},\n };\n const compositePass = {\n resource: null as any,\n attached: false,\n insertIndex: null as number | null,\n slotOwner: {},\n };\n let width = 0;\n let height = 0;\n let selectionSourceRatio = MAX_SELECTION_SOURCE_DENSITY;\n let shaderNotReadyFrames = 0;\n let prewarming = false;\n let prewarmCleanupQueued = false;\n let prewarmReadyFrameCount = 0;\n let prewarmRenderedFrameCount = 0;\n let prewarmAfterRenderObserver: unknown = null;\n let resourcesActive = false;\n let sceneDepthLeaseActive = false;\n let selectedDepthMapActive = false;\n let selectionUvBounds: BabylonEditorSelectionUvBounds = [0, 0, 1, 1];\n\n registerSelectionSilhouetteShader(babylon);\n\n const requiresSelectionIdentityPass = (): boolean => (\n selectionGroups.length > 1\n && !!babylon.ShaderMaterial\n && !!babylon.Effect?.ShadersStore\n );\n\n const detachPostProcessPass = (pass: typeof occupancyMaskPass): void => {\n if (!camera || !pass.resource || !pass.attached) return;\n const topologyBeforeDetach = Array.isArray(camera._postProcesses)\n ? camera._postProcesses.slice()\n : null;\n try {\n const attachedIndex = findCameraPostProcessIndex(camera, pass.resource);\n if (attachedIndex >= 0) pass.insertIndex = attachedIndex;\n camera.detachPostProcess?.(pass.resource);\n pass.attached = false;\n reserveOwnedCameraPostProcessSlot(\n camera,\n pass.slotOwner,\n pass.insertIndex,\n topologyBeforeDetach,\n );\n } catch (cause) {\n if (forceDetachCameraPostProcess(camera, pass.resource)) {\n pass.attached = false;\n reserveOwnedCameraPostProcessSlot(\n camera,\n pass.slotOwner,\n pass.insertIndex,\n topologyBeforeDetach,\n );\n }\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A selection silhouette post-process could not be detached cleanly.',\n cause,\n });\n }\n };\n\n const deactivateResources = (): void => {\n resourcesActive = false;\n selectionIdentityPass?.setEnabled(false);\n if (sceneDepthLease && sceneDepthLeaseActive) {\n try {\n sceneDepthLease.deactivate();\n sceneDepthLeaseActive = false;\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The shared scene depth lease could not be deactivated cleanly.',\n cause,\n });\n }\n }\n if (selectedDepthMap && selectedDepthMapActive) {\n try {\n removeCustomRenderTarget(scene, selectedDepthMap);\n selectedDepthMapActive = false;\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The selected depth target could not be detached cleanly.',\n cause,\n });\n }\n }\n detachPostProcessPass(compositePass);\n detachPostProcessPass(occupancyMaskPass);\n };\n\n const clearPrewarmAfterRenderObserver = (): void => {\n if (prewarmAfterRenderObserver == null) return;\n scene?.onAfterRenderObservable?.remove?.(prewarmAfterRenderObserver);\n prewarmAfterRenderObserver = null;\n };\n\n const finishPrewarm = (): void => {\n if (!prewarming) return;\n prewarming = false;\n clearPrewarmAfterRenderObserver();\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n selectedMeshes = [];\n selectionGroups = [];\n if (selectedDepthMap) selectedDepthMap.renderList = selectedMeshes;\n enabled = false;\n deactivateResources();\n };\n\n const activateResources = (): void => {\n if (\n !enabled\n || !sceneDepthLease\n || !selectedDepthMap\n || !occupancyMaskPass.resource\n || !compositePass.resource\n || requiresSelectionIdentityPass() !== !!selectionIdentityPass\n || !camera\n ) return;\n if (resourcesActive) return;\n if (!occupancyMaskPass.attached) {\n occupancyMaskPass.insertIndex = attachOwnedCameraPostProcess(\n camera,\n occupancyMaskPass.slotOwner,\n occupancyMaskPass.resource,\n );\n occupancyMaskPass.attached = true;\n }\n if (!compositePass.attached) {\n compositePass.insertIndex = attachOwnedCameraPostProcess(\n camera,\n compositePass.slotOwner,\n compositePass.resource,\n );\n compositePass.attached = true;\n }\n if (!sceneDepthLeaseActive) {\n sceneDepthLease.activate();\n sceneDepthLeaseActive = true;\n }\n if (!selectedDepthMapActive) {\n selectedDepthMapActive = true;\n addCustomRenderTarget(scene, selectedDepthMap);\n }\n selectionIdentityPass?.setEnabled(true);\n resourcesActive = true;\n };\n\n const disposePostProcessPass = (pass: typeof occupancyMaskPass, ownedCamera: RuntimeCamera | null): void => {\n const resource = pass.resource;\n if (resource) {\n try {\n resource.dispose?.(ownedCamera ?? undefined);\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A selection silhouette post-process resource could not be disposed cleanly.',\n cause,\n });\n }\n releaseOwnedCameraPostProcessSlot(\n ownedCamera,\n pass.slotOwner,\n pass.insertIndex,\n resource,\n );\n }\n pass.resource = null;\n pass.attached = false;\n pass.insertIndex = null;\n };\n\n const disposeCameraResources = (preservePrewarm = false): void => {\n if (!preservePrewarm) {\n clearPrewarmAfterRenderObserver();\n prewarming = false;\n }\n deactivateResources();\n const ownedCamera = camera;\n disposePostProcessPass(compositePass, ownedCamera);\n disposePostProcessPass(occupancyMaskPass, ownedCamera);\n const ownedSelectedDepthMap = selectedDepthMap;\n if (selectedDepthRenderer) {\n try {\n selectedDepthRenderer.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A selection silhouette depth resource could not be disposed cleanly.',\n cause,\n });\n }\n }\n if (ownedSelectedDepthMap) {\n try {\n ownedSelectedDepthMap.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The owned selected depth target could not be disposed cleanly.',\n cause,\n });\n }\n }\n if (selectionIdentityPass) {\n try {\n selectionIdentityPass.dispose();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The selection identity pass could not be disposed cleanly.',\n cause,\n });\n }\n }\n selectedDepthRenderer = null;\n selectedDepthMap = null;\n selectedDepthMapActive = false;\n selectionIdentityPass = null;\n if (sceneDepthLease) {\n try {\n sceneDepthLease.dispose();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The leased scene depth source could not be disposed cleanly.',\n cause,\n });\n }\n }\n sceneDepthLease = null;\n sceneDepthLeaseActive = false;\n camera = null;\n width = 0;\n height = 0;\n selectionSourceRatio = MAX_SELECTION_SOURCE_DENSITY;\n shaderNotReadyFrames = 0;\n resourcesActive = false;\n };\n\n const createCameraResources = (nextCamera: RuntimeCamera): void => {\n const DepthRenderer = babylon.DepthRenderer;\n const RenderTargetTexture = babylon.RenderTargetTexture;\n const PostProcess = babylon.PostProcess;\n if (!DepthRenderer || !RenderTargetTexture || !PostProcess) {\n throw new Error('Babylon runtime is missing DepthRenderer, RenderTargetTexture, or PostProcess.');\n }\n const engine = scene.getEngine?.();\n if (!engine) throw new Error('Selection silhouette requires an active Babylon engine.');\n const nextWidth = Math.max(1, Number(engine.getRenderWidth?.() ?? 1));\n const nextHeight = Math.max(1, Number(engine.getRenderHeight?.() ?? 1));\n const nextSelectionSourceRatio = resolveSelectionSourceRatio(engine);\n const sceneDepthType = resolveDepthTextureType(engine);\n let nextLease: BabylonEditorSelectionSceneDepthSourceLease | null = null;\n let nextSelectedRenderer: any = null;\n let nextSelectedMap: any = null;\n let nextSelectionIdentityPass: BabylonSelectionIdentityPass | null = null;\n let nextOccupancyMaskPass: any = null;\n let nextCompositePass: any = null;\n let adopted = false;\n try {\n nextSelectedMap = new RenderTargetTexture(\n 'editorSelectionSelectedDepth',\n {\n width: Math.max(1, Math.ceil(nextWidth * nextSelectionSourceRatio)),\n height: Math.max(1, Math.ceil(nextHeight * nextSelectionSourceRatio)),\n },\n scene,\n {\n generateMipMaps: false,\n doNotChangeAspectRatio: true,\n type: sceneDepthType,\n samplingMode: TEXTURE_NEAREST_SAMPLING_MODE,\n generateDepthBuffer: true,\n generateStencilBuffer: false,\n },\n );\n nextSelectedRenderer = new DepthRenderer(\n scene,\n sceneDepthType,\n nextCamera,\n true,\n TEXTURE_NEAREST_SAMPLING_MODE,\n false,\n 'editorSelectionSelectedDepthRenderer',\n nextSelectedMap,\n );\n nextSelectedRenderer.forceDepthWriteTransparentMeshes = true;\n nextSelectedMap.renderList = selectedMeshes;\n if (requiresSelectionIdentityPass()) {\n nextSelectionIdentityPass = new BabylonSelectionIdentityPass({\n babylon,\n scene,\n camera: nextCamera,\n width: Math.max(1, Math.ceil(nextWidth * nextSelectionSourceRatio)),\n height: Math.max(1, Math.ceil(nextHeight * nextSelectionSourceRatio)),\n });\n nextSelectionIdentityPass.setSelection(selectionGroups);\n }\n nextOccupancyMaskPass = new PostProcess(\n 'editorSelectionOccupancyMask',\n SELECTION_OCCUPANCY_MASK_SHADER_NAME,\n [\n 'editorSelectedDepthTexelSize',\n 'editorOutputTexelSize',\n 'editorPresentationTexelSize',\n 'editorSelectionUvBounds',\n 'editorSelectedPackedDepth',\n 'editorSelectionIdentityEnabled',\n ],\n [\n 'editorSelectedDepthSampler',\n 'editorSelectionIdentitySampler',\n ],\n 1,\n null,\n TEXTURE_BILINEAR_SAMPLING_MODE,\n engine,\n false,\n );\n nextOccupancyMaskPass.onApply = (effect: any) => {\n const outputWidth = Math.max(1, Number(engine.getRenderWidth?.() ?? width ?? nextWidth));\n const outputHeight = Math.max(1, Number(engine.getRenderHeight?.() ?? height ?? nextHeight));\n const presentationSize = resolveSelectionPresentationSize(\n engine,\n outputWidth,\n outputHeight,\n );\n selectionUvBounds = prewarming\n ? [1, 1, 0, 0]\n : computeSelectionPresentationUvBounds(\n babylon,\n scene,\n nextCamera,\n selectedMeshes,\n outputWidth,\n outputHeight,\n SELECTION_PRESENTATION_PADDING_PX,\n );\n effect.setTexture?.('editorSelectedDepthSampler', nextSelectedMap);\n const selectedSize = nextSelectedMap.getSize?.() ?? {\n width: nextWidth * nextSelectionSourceRatio,\n height: nextHeight * nextSelectionSourceRatio,\n };\n effect.setFloat2?.(\n 'editorSelectedDepthTexelSize',\n 1 / Math.max(1, Number(selectedSize.width)),\n 1 / Math.max(1, Number(selectedSize.height)),\n );\n effect.setFloat4?.('editorSelectionUvBounds', ...selectionUvBounds);\n effect.setFloat?.('editorSelectedPackedDepth', nextSelectedRenderer?.isPacked ? 1 : 0);\n effect.setTexture?.(\n 'editorSelectionIdentitySampler',\n nextSelectionIdentityPass?.texture ?? nextSelectedMap,\n );\n effect.setFloat2?.('editorOutputTexelSize', 1 / outputWidth, 1 / outputHeight);\n effect.setFloat2?.(\n 'editorPresentationTexelSize',\n 1 / presentationSize.width,\n 1 / presentationSize.height,\n );\n effect.setFloat?.(\n 'editorSelectionIdentityEnabled',\n nextSelectionIdentityPass ? 1 : 0,\n );\n };\n nextCompositePass = new PostProcess(\n 'editorSelectionSilhouetteComposite',\n SELECTION_SILHOUETTE_SHADER_NAME,\n [\n 'editorOutputTexelSize',\n 'editorPresentationTexelSize',\n 'editorSelectionUvBounds',\n 'editorSelectionColor',\n 'editorScenePackedDepth',\n 'editorSelectedPackedDepth',\n 'editorSelectionIdentityEnabled',\n 'editorSceneBackgroundDepth',\n 'editorDepthEpsilon',\n ],\n [\n 'editorSceneColorSampler',\n 'editorSceneDepthSampler',\n 'editorSelectedDepthSampler',\n ],\n 1,\n null,\n TEXTURE_BILINEAR_SAMPLING_MODE,\n engine,\n false,\n );\n nextLease = (options.sceneDepthSourceProvider ?? defaultSelectionSceneDepthSourceProvider).acquire({\n babylon,\n scene,\n camera: nextCamera,\n consumerPostProcess: nextCompositePass,\n textureType: sceneDepthType,\n width: nextWidth,\n height: nextHeight,\n reportDiagnostic,\n });\n nextCompositePass.onApply = (effect: any) => {\n const outputWidth = Math.max(1, Number(engine.getRenderWidth?.() ?? width ?? nextWidth));\n const outputHeight = Math.max(1, Number(engine.getRenderHeight?.() ?? height ?? nextHeight));\n const presentationSize = resolveSelectionPresentationSize(\n engine,\n outputWidth,\n outputHeight,\n );\n effect.setTextureFromPostProcess?.(\n 'editorSceneColorSampler',\n nextOccupancyMaskPass,\n );\n effect.setTexture?.('editorSceneDepthSampler', nextLease?.getTexture());\n effect.setTexture?.('editorSelectedDepthSampler', nextSelectedMap);\n effect.setFloat2?.('editorOutputTexelSize', 1 / outputWidth, 1 / outputHeight);\n effect.setFloat2?.(\n 'editorPresentationTexelSize',\n 1 / presentationSize.width,\n 1 / presentationSize.height,\n );\n effect.setFloat4?.('editorSelectionUvBounds', ...selectionUvBounds);\n effect.setFloat3?.('editorSelectionColor', ...SELECTION_PRESENTATION_COLOR);\n effect.setFloat?.('editorScenePackedDepth', nextLease?.packed ? 1 : 0);\n effect.setFloat?.('editorSceneBackgroundDepth', nextLease?.backgroundDepth ?? 1);\n effect.setFloat?.('editorSelectedPackedDepth', nextSelectedRenderer?.isPacked ? 1 : 0);\n effect.setFloat?.(\n 'editorSelectionIdentityEnabled',\n nextSelectionIdentityPass ? 1 : 0,\n );\n effect.setFloat?.('editorDepthEpsilon', 0.0015);\n };\n camera = nextCamera;\n sceneDepthLease = nextLease;\n selectedDepthRenderer = nextSelectedRenderer;\n selectedDepthMap = nextSelectedMap;\n selectionIdentityPass = nextSelectionIdentityPass;\n occupancyMaskPass.resource = nextOccupancyMaskPass;\n compositePass.resource = nextCompositePass;\n width = nextWidth;\n height = nextHeight;\n selectionSourceRatio = nextSelectionSourceRatio;\n adopted = true;\n activateResources();\n } catch (cause) {\n if (adopted) {\n disposeCameraResources();\n } else {\n try { nextCompositePass?.dispose?.(nextCamera); } catch {}\n try { nextOccupancyMaskPass?.dispose?.(nextCamera); } catch {}\n try { nextSelectedRenderer?.dispose?.(); } catch {}\n try { nextSelectedMap?.dispose?.(); } catch {}\n try { nextSelectionIdentityPass?.dispose(); } catch {}\n try { nextLease?.dispose(); } catch {}\n }\n throw cause;\n }\n };\n\n const prepareFrame = (): void => {\n if (disposed || !enabled) return;\n const nextCamera = scene.activeCamera ?? null;\n if (!nextCamera) return;\n if (\n camera !== nextCamera\n || !sceneDepthLease\n || !selectedDepthMap\n || !occupancyMaskPass.resource\n || !compositePass.resource\n || requiresSelectionIdentityPass() !== !!selectionIdentityPass\n ) {\n disposeCameraResources(true);\n createCameraResources(nextCamera);\n return;\n }\n const engine = scene.getEngine?.();\n const nextWidth = Math.max(1, Number(engine?.getRenderWidth?.() ?? width));\n const nextHeight = Math.max(1, Number(engine?.getRenderHeight?.() ?? height));\n const nextSelectionSourceRatio = resolveSelectionSourceRatio(engine);\n if (\n nextWidth !== width\n || nextHeight !== height\n || nextSelectionSourceRatio !== selectionSourceRatio\n ) {\n width = nextWidth;\n height = nextHeight;\n selectionSourceRatio = nextSelectionSourceRatio;\n sceneDepthLease.resize(nextWidth, nextHeight);\n selectedDepthMap.resize?.({\n width: Math.max(1, Math.ceil(nextWidth * selectionSourceRatio)),\n height: Math.max(1, Math.ceil(nextHeight * selectionSourceRatio)),\n });\n selectionIdentityPass?.resize(\n Math.max(1, Math.ceil(nextWidth * selectionSourceRatio)),\n Math.max(1, Math.ceil(nextHeight * selectionSourceRatio)),\n );\n }\n selectedDepthMap.renderList = selectedMeshes;\n activateResources();\n if (occupancyMaskPass.resource.isSupported === false || compositePass.resource.isSupported === false) {\n throw new Error('Selection silhouette post-process is not supported by the active engine.');\n }\n if (occupancyMaskPass.resource.isReady?.() && compositePass.resource.isReady?.()) {\n shaderNotReadyFrames = 0;\n } else {\n shaderNotReadyFrames += 1;\n if (shaderNotReadyFrames > 120) {\n reportDiagnostic({\n code: 'shader-not-ready',\n message: 'Selection silhouette shader did not become ready; visual selection feedback is disabled.',\n });\n throw new Error('Selection silhouette shader readiness timed out.');\n }\n }\n };\n\n if (beforeRenderObservable?.add) {\n beforeRenderObserver = beforeRenderObservable.add(prepareFrame);\n }\n\n return {\n setSelectedMeshes(meshes, groups) {\n if (prewarming) {\n // Projected nodes can publish empty membership while the scene is\n // still being assembled. Treat that as prewarm noise; a non-empty\n // selection is the only state transition that may take ownership of\n // the warmed resources before cleanup.\n if (meshes.length === 0) return;\n prewarming = false;\n clearPrewarmAfterRenderObserver();\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n }\n const requiredBefore = requiresSelectionIdentityPass();\n selectedMeshes = [...meshes];\n selectionGroups = groups?.map(group => ({\n selectionId: group.selectionId,\n meshes: [...group.meshes],\n })) ?? [];\n if (selectedDepthMap) selectedDepthMap.renderList = selectedMeshes;\n const requiredAfter = requiresSelectionIdentityPass();\n if (camera && requiredBefore !== requiredAfter) {\n disposeCameraResources();\n if (enabled) prepareFrame();\n return;\n }\n selectionIdentityPass?.setSelection(selectionGroups);\n },\n setEnabled(nextEnabled) {\n if (prewarming && !nextEnabled) return;\n if (disposed || enabled === nextEnabled) return;\n enabled = nextEnabled;\n if (enabled) prepareFrame();\n else {\n prewarming = false;\n clearPrewarmAfterRenderObserver();\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n deactivateResources();\n }\n },\n prewarm(meshes) {\n if (disposed || meshes.length === 0 || (enabled && !prewarming)) return;\n if (prewarming) {\n const mergedMeshes = [...selectedMeshes];\n const seenMeshes = new Set(mergedMeshes);\n for (const mesh of meshes) appendPresentationMesh(mergedMeshes, seenMeshes, mesh);\n selectedMeshes = mergedMeshes;\n if (selectedDepthMap) selectedDepthMap.renderList = selectedMeshes;\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n return;\n }\n selectedMeshes = [...meshes];\n selectionGroups = [];\n prewarming = true;\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n enabled = true;\n prepareFrame();\n const afterRenderObservable = scene?.onAfterRenderObservable;\n if (afterRenderObservable?.add) {\n prewarmAfterRenderObserver = afterRenderObservable.add(() => {\n prewarmRenderedFrameCount += 1;\n const selectedDepthReady = selectedDepthMap?.isReadyForRendering?.() ?? true;\n const postProcessesReady = (occupancyMaskPass.resource?.isReady?.() ?? true)\n && (compositePass.resource?.isReady?.() ?? true);\n prewarmReadyFrameCount = selectedDepthReady && postProcessesReady\n ? prewarmReadyFrameCount + 1\n : 0;\n // One readiness probe can itself trigger deferred shader work.\n // Require a second rendered frame with all resources ready before\n // detaching them from the scene.\n if (prewarmReadyFrameCount < 2 && prewarmRenderedFrameCount < 4) return;\n clearPrewarmAfterRenderObserver();\n if (prewarmCleanupQueued) return;\n prewarmCleanupQueued = true;\n void Promise.resolve().then(() => {\n prewarmCleanupQueued = false;\n finishPrewarm();\n });\n });\n } else {\n finishPrewarm();\n }\n },\n prepareFrame,\n getResourceCount() {\n if (\n !sceneDepthLease\n && !selectedDepthRenderer\n && !selectionIdentityPass\n && !occupancyMaskPass.resource\n && !compositePass.resource\n ) return 0;\n return Number(!!sceneDepthLease)\n + Number(!!selectedDepthRenderer)\n + Number(!!selectionIdentityPass)\n + Number(!!occupancyMaskPass.resource)\n + Number(!!compositePass.resource);\n },\n getSceneDepthSourceKind() {\n return sceneDepthLease?.kind ?? null;\n },\n getCameraId() {\n const id = camera?.id;\n return typeof id === 'string' ? id : null;\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n clearPrewarmAfterRenderObserver();\n prewarming = false;\n prewarmCleanupQueued = false;\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n if (beforeRenderObserver != null) beforeRenderObservable?.remove?.(beforeRenderObserver);\n beforeRenderObserver = null;\n disposeCameraResources();\n selectedMeshes = [];\n selectionGroups = [];\n },\n };\n}\n\nfunction registerSelectionSilhouetteShader(babylon: BabylonRuntimeGlobal & Record<string, any>): void {\n const shadersStore = babylon.Effect?.ShadersStore;\n if (!shadersStore) throw new Error('Babylon runtime is missing Effect.ShadersStore.');\n const maskShaderKey = `${SELECTION_OCCUPANCY_MASK_SHADER_NAME}PixelShader`;\n const compositeShaderKey = `${SELECTION_SILHOUETTE_SHADER_NAME}PixelShader`;\n if (!shadersStore[maskShaderKey]) shadersStore[maskShaderKey] = SELECTION_OCCUPANCY_MASK_FRAGMENT_SHADER;\n if (!shadersStore[compositeShaderKey]) {\n shadersStore[compositeShaderKey] = SELECTION_SILHOUETTE_FRAGMENT_SHADER;\n }\n}\n\nexport function computeSelectionPresentationUvBounds(\n babylon: BabylonRuntimeGlobal & Record<string, any>,\n scene: RuntimeScene,\n camera: RuntimeCamera,\n meshes: readonly any[],\n width: number,\n height: number,\n paddingPx = SELECTION_PRESENTATION_PADDING_PX,\n): BabylonEditorSelectionUvBounds {\n const Vector3 = babylon.Vector3 as any;\n const Matrix = babylon.Matrix;\n const transform = scene.getTransformMatrix?.();\n if (!Vector3?.Project || !Matrix?.Identity || !transform || width <= 0 || height <= 0) {\n return [0, 0, 1, 1];\n }\n const viewport = camera.viewport?.toGlobal?.(width, height)\n ?? { x: 0, y: 0, width, height };\n let minU = 1;\n let minV = 1;\n let maxU = 0;\n let maxV = 0;\n let projectedPointCount = 0;\n try {\n for (const mesh of meshes) {\n if (!mesh || mesh.isDisposed?.()) continue;\n if (hasRuntimeDeformedBounds(mesh)) return [0, 0, 1, 1];\n mesh.computeWorldMatrix?.(true);\n const vectors = mesh.getBoundingInfo?.()?.boundingBox?.vectorsWorld;\n if (!Array.isArray(vectors) || vectors.length === 0) return [0, 0, 1, 1];\n for (const point of vectors) {\n const projected = Vector3.Project(point, Matrix.Identity(), transform, viewport);\n if (\n !Number.isFinite(projected?.x)\n || !Number.isFinite(projected?.y)\n || !Number.isFinite(projected?.z)\n || projected.z < 0\n || projected.z > 1\n ) return [0, 0, 1, 1];\n const u = projected.x / width;\n const v = 1 - (projected.y / height);\n minU = Math.min(minU, u);\n minV = Math.min(minV, v);\n maxU = Math.max(maxU, u);\n maxV = Math.max(maxV, v);\n projectedPointCount += 1;\n }\n }\n } catch {\n return [0, 0, 1, 1];\n }\n if (projectedPointCount === 0) return [0, 0, 1, 1];\n const padU = Math.max(0, paddingPx) / width;\n const padV = Math.max(0, paddingPx) / height;\n return [\n clampUnit(minU - padU),\n clampUnit(minV - padV),\n clampUnit(maxU + padU),\n clampUnit(maxV + padV),\n ];\n}\n\nfunction hasRuntimeDeformedBounds(mesh: any): boolean {\n const sourceMesh = mesh?.sourceMesh;\n return !!(\n mesh?.skeleton\n || mesh?.morphTargetManager\n || mesh?.bakedVertexAnimationManager\n || sourceMesh?.skeleton\n || sourceMesh?.morphTargetManager\n || sourceMesh?.bakedVertexAnimationManager\n );\n}\n\nfunction clampUnit(value: number): number {\n return Math.min(1, Math.max(0, value));\n}\n\nfunction resolveSelectionSourceRatio(engine: any): number {\n const hardwareScalingLevel = Number(engine?.getHardwareScalingLevel?.() ?? 1);\n if (!Number.isFinite(hardwareScalingLevel) || hardwareScalingLevel <= 0) {\n return MAX_SELECTION_SOURCE_DENSITY;\n }\n return Math.min(\n MAX_SELECTION_SOURCE_DENSITY,\n Math.max(1, MAX_SELECTION_SOURCE_DENSITY * hardwareScalingLevel),\n );\n}\n\nfunction resolveSelectionPresentationSize(\n engine: any,\n outputWidth: number,\n outputHeight: number,\n): { width: number; height: number } {\n const canvas = engine?.getRenderingCanvas?.();\n const hardwareScalingLevel = Number(engine?.getHardwareScalingLevel?.() ?? 1);\n const fallbackScale = Number.isFinite(hardwareScalingLevel) && hardwareScalingLevel > 0\n ? hardwareScalingLevel\n : 1;\n return {\n width: Math.max(1, Number(canvas?.clientWidth) || outputWidth * fallbackScale),\n height: Math.max(1, Number(canvas?.clientHeight) || outputHeight * fallbackScale),\n };\n}\n\nexport const defaultSelectionSceneDepthSourceProvider: BabylonEditorSelectionSceneDepthSourceProvider = {\n acquire(request) {\n return createAdaptiveSelectionSceneDepthSourceLease(request);\n },\n};\n\nfunction createAdaptiveSelectionSceneDepthSourceLease(\n request: BabylonEditorSelectionSceneDepthSourceRequest,\n): BabylonEditorSelectionSceneDepthSourceLease {\n let width = request.width;\n let height = request.height;\n let delegate = canUsePrePassSceneDepth(request)\n ? createPrePassSelectionSceneDepthSourceLease(request)\n : createDedicatedSelectionSceneDepthSourceLease(request);\n let disposed = false;\n let activated = false;\n\n const replaceWithDedicatedSource = (): void => {\n try { delegate.dispose(); } catch {}\n delegate = createDedicatedSelectionSceneDepthSourceLease({ ...request, width, height });\n };\n\n return {\n get kind() { return delegate.kind; },\n get packed() { return delegate.packed; },\n get backgroundDepth() { return delegate.backgroundDepth; },\n getTexture() { return delegate.getTexture(); },\n activate() {\n if (disposed || activated) return;\n try {\n delegate.activate();\n } catch (cause) {\n if (delegate.kind !== 'prepass') throw cause;\n replaceWithDedicatedSource();\n delegate.activate();\n }\n activated = true;\n },\n deactivate() {\n if (!activated) return;\n delegate.deactivate();\n activated = false;\n },\n resize(nextWidth, nextHeight) {\n width = nextWidth;\n height = nextHeight;\n delegate.resize(nextWidth, nextHeight);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n delegate.dispose();\n activated = false;\n },\n };\n}\n\nfunction canUsePrePassSceneDepth(request: BabylonEditorSelectionSceneDepthSourceRequest): boolean {\n return !!(\n request.scene?.enablePrePassRenderer\n && request.consumerPostProcess\n && typeof request.consumerPostProcess.setPrePassRenderer === 'function'\n && Number.isInteger(request.babylon.Constants?.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE)\n );\n}\n\nfunction createPrePassSelectionSceneDepthSourceLease(\n request: BabylonEditorSelectionSceneDepthSourceRequest,\n): BabylonEditorSelectionSceneDepthSourceLease {\n const depthTextureType = request.babylon.Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE;\n const consumer = request.consumerPostProcess;\n const originalSetPrePassRenderer = consumer.setPrePassRenderer;\n let state: PrePassSceneDepthState | null = null;\n let active = false;\n let disposed = false;\n\n const restoreConsumer = (): void => {\n if (consumer.setPrePassRenderer === setPrePassRenderer) {\n consumer.setPrePassRenderer = originalSetPrePassRenderer;\n }\n };\n\n const setPrePassRenderer = function (prePassRenderer: any): boolean {\n const originalNeeded = originalSetPrePassRenderer.call(consumer, prePassRenderer);\n if (!state || state.prePassRenderer !== prePassRenderer) return originalNeeded;\n state.configuration = prePassRenderer.addEffectConfiguration(state.configuration);\n state.configuration.enabled = state.activeLeaseCount > 0;\n return originalNeeded || state.configuration.enabled;\n };\n\n const deactivate = (): void => {\n if (!active) return;\n active = false;\n restoreConsumer();\n if (state) {\n state.activeLeaseCount = Math.max(0, state.activeLeaseCount - 1);\n state.configuration.enabled = state.activeLeaseCount > 0;\n state.prePassRenderer.markAsDirty?.();\n state.prePassRenderer.update?.();\n }\n };\n\n const getTexture = (): any => {\n const index = state?.prePassRenderer?.getIndex?.(depthTextureType);\n const texture = Number.isInteger(index) && index >= 0\n ? state?.prePassRenderer?.defaultRT?.textures?.[index]\n : null;\n if (!texture) throw new Error('Babylon pre-pass did not expose a compatible screen-space depth texture.');\n return texture;\n };\n\n return {\n kind: 'prepass',\n packed: false,\n backgroundDepth: 0,\n getTexture,\n activate() {\n if (disposed || active) return;\n const prePassRenderer = request.scene.enablePrePassRenderer?.();\n if (!prePassRenderer?.isSupported) {\n throw new Error('Babylon pre-pass is unavailable on the active engine.');\n }\n state = prePassSceneDepthStates.get(request.scene as object) ?? {\n prePassRenderer,\n configuration: {\n name: PREPASS_SELECTION_DEPTH_CONFIGURATION_NAME,\n enabled: false,\n texturesRequired: [depthTextureType],\n needsImageProcessing: false,\n },\n activeLeaseCount: 0,\n };\n if (state.prePassRenderer !== prePassRenderer) {\n throw new Error('The scene pre-pass renderer changed while acquiring selection depth.');\n }\n prePassSceneDepthStates.set(request.scene as object, state);\n state.activeLeaseCount += 1;\n state.configuration.enabled = true;\n consumer.setPrePassRenderer = setPrePassRenderer;\n active = true;\n try {\n prePassRenderer.markAsDirty?.();\n prePassRenderer.update?.();\n if (!prePassRenderer.enabled) throw new Error('Babylon pre-pass did not activate.');\n getTexture();\n } catch (cause) {\n deactivate();\n throw cause;\n }\n },\n deactivate,\n resize() {\n // Babylon owns this target and resizes it with the main render surface.\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n deactivate();\n restoreConsumer();\n },\n };\n}\n\nfunction createDedicatedSelectionSceneDepthSourceLease(\n request: BabylonEditorSelectionSceneDepthSourceRequest,\n): BabylonEditorSelectionSceneDepthSourceLease {\n const lease = acquireSceneDepthLease(\n request.babylon,\n request.scene,\n request.camera,\n request.textureType,\n request.width,\n request.height,\n );\n let active = false;\n let disposed = false;\n return {\n kind: 'dedicated',\n packed: lease.packed,\n backgroundDepth: 1,\n getTexture: () => lease.depthMap,\n activate() {\n if (disposed || active) return;\n activateSceneDepthLease(request.scene, lease);\n active = true;\n },\n deactivate() {\n if (!active) return;\n deactivateSceneDepthLease(request.scene, lease);\n active = false;\n },\n resize(width, height) {\n resizeSceneDepthLease(lease, width, height);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n if (active) deactivateSceneDepthLease(request.scene, lease);\n active = false;\n releaseSceneDepthLease(request.scene, lease, request.reportDiagnostic);\n },\n };\n}\n\nfunction resolveDepthTextureType(engine: any): number {\n const caps = engine.getCaps?.() ?? {};\n if (caps.textureHalfFloatRender) return TEXTURE_TYPE_HALF_FLOAT;\n if (caps.textureFloatRender) return TEXTURE_TYPE_FLOAT;\n return TEXTURE_TYPE_UNSIGNED_BYTE;\n}\n\nfunction acquireSceneDepthLease(\n babylon: BabylonRuntimeGlobal & Record<string, any>,\n scene: RuntimeScene,\n camera: RuntimeCamera,\n type: number,\n width: number,\n height: number,\n): SceneDepthLease {\n let cameraLeases = sceneDepthLeases.get(scene);\n if (!cameraLeases) {\n cameraLeases = new Map();\n sceneDepthLeases.set(scene, cameraLeases);\n }\n const existing = cameraLeases.get(camera);\n if (existing && existing.type === type) {\n resizeSceneDepthLease(existing, width, height);\n existing.refs += 1;\n return existing;\n }\n const DepthRenderer = babylon.DepthRenderer;\n if (!DepthRenderer) throw new Error('Babylon runtime is missing DepthRenderer.');\n let renderer: any = null;\n let depthMap: any = null;\n try {\n renderer = new DepthRenderer(\n scene,\n type,\n camera,\n true,\n TEXTURE_NEAREST_SAMPLING_MODE,\n false,\n 'editorSelectionSceneDepthRenderer',\n );\n renderer.forceDepthWriteTransparentMeshes = true;\n depthMap = renderer.getDepthMap();\n depthMap.renderListPredicate = (mesh: any) => !mesh?.metadata?.editorProjectionSelectionProxy;\n depthMap.resize?.({ width, height });\n const lease: SceneDepthLease = {\n camera,\n renderer,\n depthMap,\n type,\n packed: !!renderer.isPacked,\n refs: 1,\n activeRefs: 0,\n width,\n height,\n };\n cameraLeases.set(camera, lease);\n return lease;\n } catch (cause) {\n try { renderer?.dispose?.(); } catch {}\n try { depthMap?.dispose?.(); } catch {}\n if (cameraLeases.size === 0) sceneDepthLeases.delete(scene);\n throw cause;\n }\n}\n\nfunction activateSceneDepthLease(scene: RuntimeScene, lease: SceneDepthLease): void {\n if (lease.activeRefs === 0) addCustomRenderTarget(scene, lease.depthMap);\n lease.activeRefs += 1;\n}\n\nfunction deactivateSceneDepthLease(scene: RuntimeScene, lease: SceneDepthLease): void {\n if (lease.activeRefs <= 0) return;\n if (lease.activeRefs === 1) removeCustomRenderTarget(scene, lease.depthMap);\n lease.activeRefs -= 1;\n}\n\nfunction resizeSceneDepthLease(lease: SceneDepthLease, width: number, height: number): void {\n if (lease.width === width && lease.height === height) return;\n lease.depthMap.resize?.({ width, height });\n lease.width = width;\n lease.height = height;\n}\n\nfunction releaseSceneDepthLease(\n scene: RuntimeScene,\n lease: SceneDepthLease,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n): void {\n lease.refs = Math.max(0, lease.refs - 1);\n if (lease.refs > 0) return;\n lease.activeRefs = 0;\n try {\n removeCustomRenderTarget(scene, lease.depthMap);\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The owned scene depth target could not be detached cleanly.',\n cause,\n });\n }\n const cameraLeases = sceneDepthLeases.get(scene);\n cameraLeases?.delete(lease.camera);\n if (cameraLeases?.size === 0) sceneDepthLeases.delete(scene);\n try {\n lease.renderer.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A leased scene depth resource could not be disposed cleanly.',\n cause,\n });\n }\n try {\n lease.depthMap.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The owned scene depth target could not be disposed cleanly.',\n cause,\n });\n }\n}\n\nfunction addCustomRenderTarget(scene: RuntimeScene, target: any): void {\n if (!target) return;\n scene.customRenderTargets = Array.isArray(scene.customRenderTargets) ? scene.customRenderTargets : [];\n if (!scene.customRenderTargets.includes(target)) scene.customRenderTargets.push(target);\n}\n\nfunction removeCustomRenderTarget(scene: RuntimeScene, target: any): void {\n if (!target || !Array.isArray(scene.customRenderTargets)) return;\n const index = scene.customRenderTargets.indexOf(target);\n if (index >= 0) scene.customRenderTargets.splice(index, 1);\n}\n\nfunction findCameraPostProcessIndex(camera: RuntimeCamera, postProcess: any): number {\n return Array.isArray(camera?._postProcesses)\n ? camera._postProcesses.indexOf(postProcess)\n : -1;\n}\n\nfunction getCameraSelectionPostProcessSlotRegistry(\n camera: RuntimeCamera,\n): CameraSelectionPostProcessSlotRegistry {\n let registry = cameraSelectionPostProcessSlots.get(camera);\n if (!registry) {\n registry = { owners: new Map(), releasedSlots: new Map() };\n cameraSelectionPostProcessSlots.set(camera, registry);\n }\n return registry;\n}\n\nfunction cameraPostProcessTopologyMatches(\n slots: readonly any[],\n topology: readonly any[] | null,\n): boolean {\n return topology != null\n && slots.length === topology.length\n && slots.every((slot, index) => slot === topology[index]);\n}\n\nfunction reserveOwnedCameraPostProcessSlot(\n camera: RuntimeCamera,\n owner: object,\n insertIndex: number | null,\n topologyBeforeDetach: readonly any[] | null,\n): void {\n const slots = camera?._postProcesses;\n const registry = cameraSelectionPostProcessSlots.get(camera);\n const ownedSlot = registry?.owners.get(owner);\n if (!Array.isArray(slots) || !registry || !ownedSlot) return;\n const reservedIndex = insertIndex ?? ownedSlot.index;\n if (reservedIndex != null && reservedIndex < slots.length && slots[reservedIndex] === null) {\n ownedSlot.index = reservedIndex;\n ownedSlot.vacantTopology = slots.slice();\n } else {\n ownedSlot.index = null;\n ownedSlot.vacantTopology = null;\n }\n refreshProvenVacantCameraPostProcessTopologies(\n registry,\n slots,\n topologyBeforeDetach,\n owner,\n );\n}\n\nfunction refreshProvenVacantCameraPostProcessTopologies(\n registry: CameraSelectionPostProcessSlotRegistry,\n slots: readonly any[],\n topologyBeforeMutation: readonly any[] | null,\n excludedOwner: object | null = null,\n): void {\n if (!topologyBeforeMutation) return;\n const nextTopology = slots.slice();\n for (const [owner, slot] of registry.owners) {\n if (\n owner !== excludedOwner\n && slot.index != null\n && slot.index < slots.length\n && slots[slot.index] === null\n && cameraPostProcessTopologyMatches(topologyBeforeMutation, slot.vacantTopology)\n ) {\n slot.vacantTopology = nextTopology;\n }\n }\n for (const [releasedIndex, topology] of registry.releasedSlots) {\n if (\n releasedIndex < slots.length\n && slots[releasedIndex] === null\n && cameraPostProcessTopologyMatches(topologyBeforeMutation, topology)\n ) {\n registry.releasedSlots.set(releasedIndex, nextTopology);\n }\n }\n}\n\nfunction attachOwnedCameraPostProcess(\n camera: RuntimeCamera,\n owner: object,\n postProcess: any,\n): number {\n const registry = getCameraSelectionPostProcessSlotRegistry(camera);\n const slots = camera?._postProcesses;\n const topologyBeforeAttach = Array.isArray(slots) ? slots.slice() : null;\n const ownedSlot = registry.owners.get(owner);\n let reusableIndex: number | null = null;\n if (\n Array.isArray(slots)\n && ownedSlot != null\n && ownedSlot.postProcess === postProcess\n && ownedSlot.index != null\n && ownedSlot.index < slots.length\n && slots[ownedSlot.index] === null\n && cameraPostProcessTopologyMatches(slots, ownedSlot.vacantTopology)\n ) {\n reusableIndex = ownedSlot.index;\n } else if (Array.isArray(slots)) {\n if (ownedSlot) {\n ownedSlot.index = null;\n ownedSlot.vacantTopology = null;\n }\n for (const [releasedIndex, topology] of [...registry.releasedSlots.entries()]\n .sort(([left], [right]) => left - right)) {\n if (\n releasedIndex >= slots.length\n || slots[releasedIndex] !== null\n || !cameraPostProcessTopologyMatches(slots, topology)\n ) {\n registry.releasedSlots.delete(releasedIndex);\n continue;\n }\n reusableIndex = releasedIndex;\n break;\n }\n }\n\n try {\n const attachedIndex = camera.attachPostProcess?.(postProcess, reusableIndex);\n const actualIndex = Number.isInteger(attachedIndex) && attachedIndex >= 0\n ? attachedIndex\n : findCameraPostProcessIndex(camera, postProcess);\n if (actualIndex < 0) {\n throw new Error('The selection silhouette post-process was not attached to the active camera.');\n }\n registry.owners.set(owner, { index: actualIndex, postProcess, vacantTopology: null });\n registry.releasedSlots.delete(actualIndex);\n if (Array.isArray(slots)) {\n refreshProvenVacantCameraPostProcessTopologies(\n registry,\n slots,\n topologyBeforeAttach,\n owner,\n );\n }\n return actualIndex;\n } catch (cause) {\n forceDetachCameraPostProcess(camera, postProcess);\n throw cause;\n }\n}\n\nfunction forceDetachCameraPostProcess(camera: RuntimeCamera, postProcess: any): boolean {\n const slots = camera?._postProcesses;\n if (!Array.isArray(slots)) return false;\n const liveIndex = slots.indexOf(postProcess);\n if (liveIndex >= 0) slots[liveIndex] = null;\n return slots.indexOf(postProcess) < 0;\n}\n\nfunction releaseOwnedCameraPostProcessSlot(\n camera: RuntimeCamera | null,\n owner: object,\n insertIndex: number | null,\n postProcess: any,\n): void {\n const slots = camera?._postProcesses;\n if (!camera || !Array.isArray(slots)) return;\n const registry = cameraSelectionPostProcessSlots.get(camera);\n const ownedSlot = registry?.owners.get(owner);\n const liveIndex = slots.indexOf(postProcess);\n let releasedIndex: number | null = null;\n if (liveIndex >= 0) {\n slots[liveIndex] = null;\n releasedIndex = liveIndex;\n } else if (insertIndex != null && slots[insertIndex] === postProcess) {\n slots[insertIndex] = null;\n releasedIndex = insertIndex;\n } else if (\n ownedSlot?.index != null\n && ownedSlot.index < slots.length\n && slots[ownedSlot.index] === null\n && cameraPostProcessTopologyMatches(slots, ownedSlot.vacantTopology)\n ) {\n releasedIndex = ownedSlot.index;\n }\n registry?.owners.delete(owner);\n const topologyBeforeTrim = slots.slice();\n\n // Babylon uses null placeholders for detached passes. A released selection-owned hole may\n // be reclaimed by a successor controller; only trailing placeholders are removed here so\n // live passes never shift. Reserved inactive owners trimmed from the tail append on reattach.\n while (slots.length > 0 && slots[slots.length - 1] == null) slots.pop();\n if (!registry) return;\n refreshProvenVacantCameraPostProcessTopologies(registry, slots, topologyBeforeTrim);\n for (const slot of registry.owners.values()) {\n if (slot.index != null && slot.index >= slots.length) {\n slot.index = null;\n slot.vacantTopology = null;\n }\n }\n for (const released of [...registry.releasedSlots.keys()]) {\n if (released >= slots.length) {\n registry.releasedSlots.delete(released);\n }\n }\n if (releasedIndex != null && releasedIndex < slots.length && slots[releasedIndex] === null) {\n registry.releasedSlots.set(releasedIndex, slots.slice());\n }\n if (registry.owners.size === 0 && registry.releasedSlots.size === 0) {\n cameraSelectionPostProcessSlots.delete(camera);\n }\n}\n\nfunction safelyDisposeBackend(\n backend: BabylonEditorSelectionPresentationBackend,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n): void {\n try {\n backend.dispose();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'Selection silhouette resources could not be disposed cleanly.',\n cause,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"selection-presentation-controller.js","sourceRoot":"","sources":["../src/selection-presentation-controller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,4BAA4B,GAE7B,MAAM,2BAA2B,CAAC;AAGnC,MAAM,oCAAoC,GAAG,8BAA8B,CAAC;AAC5E,MAAM,gCAAgC,GAAG,oCAAoC,CAAC;AAC9E,MAAM,4BAA4B,GAAG,CAAC,CAAC;AACvC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AACxC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AACzC,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAC5C,MAAM,4BAA4B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAU,CAAC;AA+B7D,MAAM,wCAAwC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC7B,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,IAAI,aAAa,IAAI,IAAI,IAAI,aAAa,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3F,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACpE,+BAA+B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,OAAkD,EAClD,gBAAoF;IAEpF,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC;YACf,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,+DAA+D;YACxE,KAAK;SACN,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { EditorSelectionState } from '@fps-games/editor-core';\nimport {\n BabylonSelectionIdentityPass,\n type BabylonSelectionIdentityGroup,\n} from './selection-identity-pass';\nimport type { BabylonRuntimeGlobal, RuntimeCamera, RuntimeScene } from './types';\n\nconst SELECTION_OCCUPANCY_MASK_SHADER_NAME = 'editorSelectionOccupancyMask';\nconst SELECTION_SILHOUETTE_SHADER_NAME = 'editorSelectionSilhouetteComposite';\nconst MAX_SELECTION_SOURCE_DENSITY = 2;\nconst TEXTURE_TYPE_UNSIGNED_BYTE = 0;\nconst TEXTURE_TYPE_FLOAT = 1;\nconst TEXTURE_TYPE_HALF_FLOAT = 2;\nconst TEXTURE_NEAREST_SAMPLING_MODE = 1;\nconst TEXTURE_BILINEAR_SAMPLING_MODE = 2;\nconst SELECTION_PRESENTATION_PADDING_PX = 6;\nconst SELECTION_PRESENTATION_COLOR = [1, 0.9, 0.22] as const;\n\nexport type BabylonEditorSelectionUvBounds = readonly [number, number, number, number];\nexport type BabylonEditorSelectionSceneDepthSourceKind = 'external' | 'prepass' | 'dedicated';\n\nexport interface BabylonEditorSelectionSceneDepthSourceLease {\n readonly kind: BabylonEditorSelectionSceneDepthSourceKind;\n readonly packed: boolean;\n readonly backgroundDepth: 0 | 1;\n getTexture(): any;\n activate(): void;\n deactivate(): void;\n resize(width: number, height: number): void;\n dispose(): void;\n}\n\nexport interface BabylonEditorSelectionSceneDepthSourceRequest {\n babylon: BabylonRuntimeGlobal & Record<string, any>;\n scene: RuntimeScene;\n camera: RuntimeCamera;\n consumerPostProcess: any;\n textureType: number;\n width: number;\n height: number;\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void;\n}\n\nexport interface BabylonEditorSelectionSceneDepthSourceProvider {\n acquire(request: BabylonEditorSelectionSceneDepthSourceRequest): BabylonEditorSelectionSceneDepthSourceLease;\n}\n\nconst SELECTION_OCCUPANCY_MASK_FRAGMENT_SHADER = `\nprecision highp float;\nvarying vec2 vUV;\nuniform sampler2D editorSelectedDepthSampler;\nuniform sampler2D editorSelectionIdentitySampler;\nuniform vec2 editorSelectedDepthTexelSize;\nuniform vec2 editorOutputTexelSize;\nuniform vec2 editorPresentationTexelSize;\nuniform vec4 editorSelectionUvBounds;\nuniform float editorSelectedPackedDepth;\nuniform float editorSelectionIdentityEnabled;\n\nfloat unpackEditorDepth(vec4 color) {\n const vec4 bitShift = vec4(\n 1.0 / (255.0 * 255.0 * 255.0),\n 1.0 / (255.0 * 255.0),\n 1.0 / 255.0,\n 1.0\n );\n return dot(color, bitShift);\n}\n\nfloat selectionOccupancyAt(vec2 uv) {\n vec2 sampleUv = clamp(uv, vec2(0.0), vec2(1.0));\n vec4 selectedDepthSample = texture2D(editorSelectedDepthSampler, sampleUv);\n float selectedDepth = mix(\n selectedDepthSample.r,\n unpackEditorDepth(selectedDepthSample),\n editorSelectedPackedDepth\n );\n return 1.0 - step(0.999999, selectedDepth);\n}\n\nfloat selectionIdentityValue(vec4 color) {\n vec3 bytes = floor(color.rgb * 255.0 + 0.5);\n return dot(bytes, vec3(65536.0, 256.0, 1.0));\n}\n\nfloat selectionIdentityBoundaryAgainst(\n vec2 neighborUv,\n float centerSelected,\n float centerValue\n) {\n vec4 neighborIdentity = texture2D(editorSelectionIdentitySampler, neighborUv);\n float neighborValue = selectionIdentityValue(neighborIdentity);\n float identitiesDiffer = step(0.5, abs(centerValue - neighborValue));\n // The object-ID target already depth-resolves the selected surface. Pick one\n // deterministic owner for each differing-ID edge to avoid double thickness.\n float stableIdentityOwner = step(0.5, centerValue - neighborValue);\n return centerSelected * identitiesDiffer * stableIdentityOwner;\n}\n\nfloat selectionIdentityBoundarySampleAt(vec2 uv, vec2 identityTexel) {\n vec4 centerIdentity = texture2D(editorSelectionIdentitySampler, uv);\n float centerSelected = step(0.001, centerIdentity.a);\n float centerValue = selectionIdentityValue(centerIdentity);\n float boundary = 0.0;\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(-identityTexel.x, 0.0), centerSelected, centerValue\n ));\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(identityTexel.x, 0.0), centerSelected, centerValue\n ));\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(0.0, -identityTexel.y), centerSelected, centerValue\n ));\n boundary = max(boundary, selectionIdentityBoundaryAgainst(\n uv + vec2(0.0, identityTexel.y), centerSelected, centerValue\n ));\n return boundary;\n}\n\nfloat selectionIdentityBoundaryCoverageAt(\n vec2 uv,\n vec2 outputTexel,\n vec2 boundaryStep\n) {\n vec2 ringWide = outputTexel * vec2(0.32476, 0.1875);\n vec2 ringTall = outputTexel * vec2(0.0, 0.375);\n float coverage = selectionIdentityBoundarySampleAt(uv - ringTall, boundaryStep);\n coverage += selectionIdentityBoundarySampleAt(\n uv + vec2(ringWide.x, -ringWide.y), boundaryStep\n );\n coverage += selectionIdentityBoundarySampleAt(uv + ringWide, boundaryStep);\n coverage += selectionIdentityBoundarySampleAt(uv + ringTall, boundaryStep);\n coverage += selectionIdentityBoundarySampleAt(\n uv + vec2(-ringWide.x, ringWide.y), boundaryStep\n );\n coverage += selectionIdentityBoundarySampleAt(uv - ringWide, boundaryStep);\n return coverage / 6.0;\n}\n\nvoid main(void) {\n if (\n vUV.x < editorSelectionUvBounds.x\n || vUV.y < editorSelectionUvBounds.y\n || vUV.x > editorSelectionUvBounds.z\n || vUV.y > editorSelectionUvBounds.w\n ) {\n gl_FragColor = vec4(0.0);\n return;\n }\n vec2 subpixelOffset = editorSelectedDepthTexelSize * 0.5;\n float coverage = 0.0;\n coverage += selectionOccupancyAt(vUV + vec2(-subpixelOffset.x, -subpixelOffset.y));\n coverage += selectionOccupancyAt(vUV + vec2(subpixelOffset.x, -subpixelOffset.y));\n coverage += selectionOccupancyAt(vUV + vec2(-subpixelOffset.x, subpixelOffset.y));\n coverage += selectionOccupancyAt(vUV + vec2(subpixelOffset.x, subpixelOffset.y));\n float identityBoundary = 0.0;\n if (editorSelectionIdentityEnabled > 0.5) {\n identityBoundary = selectionIdentityBoundaryCoverageAt(\n vUV,\n editorOutputTexelSize,\n editorPresentationTexelSize\n );\n }\n gl_FragColor = vec4(identityBoundary, 0.0, 0.0, coverage * 0.25);\n}\n`;\n\nconst SELECTION_SILHOUETTE_FRAGMENT_SHADER = `\nprecision highp float;\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D editorSceneColorSampler;\nuniform sampler2D editorSceneDepthSampler;\nuniform sampler2D editorSelectedDepthSampler;\nuniform vec2 editorOutputTexelSize;\nuniform vec2 editorPresentationTexelSize;\nuniform vec4 editorSelectionUvBounds;\nuniform vec3 editorSelectionColor;\nuniform float editorScenePackedDepth;\nuniform float editorSelectedPackedDepth;\nuniform float editorSelectionIdentityEnabled;\nuniform float editorSceneBackgroundDepth;\nuniform float editorDepthEpsilon;\n\nfloat unpackEditorDepth(vec4 color) {\n const vec4 bitShift = vec4(\n 1.0 / (255.0 * 255.0 * 255.0),\n 1.0 / (255.0 * 255.0),\n 1.0 / 255.0,\n 1.0\n );\n return dot(color, bitShift);\n}\n\nfloat readEditorDepth(sampler2D depthSampler, vec2 uv, float packedDepth) {\n vec4 sampleValue = texture2D(depthSampler, clamp(uv, vec2(0.0), vec2(1.0)));\n return mix(sampleValue.r, unpackEditorDepth(sampleValue), packedDepth);\n}\n\nfloat selectionCoverageAt(vec2 uv) {\n return texture2D(textureSampler, clamp(uv, vec2(0.0), vec2(1.0))).a;\n}\n\nfloat resolvedSelectionIdentityBoundaryAt(vec2 uv, vec2 outputTexel) {\n vec2 halfTexel = outputTexel * 0.5;\n float coverage = texture2D(\n textureSampler,\n uv + vec2(-halfTexel.x, -halfTexel.y)\n ).r;\n coverage += texture2D(\n textureSampler,\n uv + vec2(halfTexel.x, -halfTexel.y)\n ).r;\n coverage += texture2D(\n textureSampler,\n uv + vec2(-halfTexel.x, halfTexel.y)\n ).r;\n coverage += texture2D(\n textureSampler,\n uv + vec2(halfTexel.x, halfTexel.y)\n ).r;\n return coverage * 0.25;\n}\n\nvoid considerStrongestSelectionNeighbor(\n inout vec3 strongestSample,\n vec2 uv,\n vec2 texel,\n vec2 offset\n) {\n float coverage = selectionCoverageAt(uv + offset * texel);\n float isStronger = step(strongestSample.x, coverage);\n strongestSample = mix(\n strongestSample,\n vec3(coverage, offset),\n isStronger\n );\n}\n\nvec3 strongestSelectionNeighbor(vec2 uv, vec2 texel) {\n vec3 strongestSample = vec3(0.0, 0.0, 0.0);\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n if (x != 0 || y != 0) {\n considerStrongestSelectionNeighbor(\n strongestSample,\n uv,\n texel,\n vec2(float(x), float(y))\n );\n }\n }\n }\n return strongestSample;\n}\n\nfloat selectionSubpixelVisibilityAt(vec2 uv) {\n float selectedDepth = readEditorDepth(\n editorSelectedDepthSampler,\n uv,\n editorSelectedPackedDepth\n );\n float sceneDepth = readEditorDepth(editorSceneDepthSampler, uv, editorScenePackedDepth);\n float sceneBackgroundIsZero = 1.0 - step(0.5, editorSceneBackgroundDepth);\n float emptyZeroDepth = sceneBackgroundIsZero * (1.0 - step(0.000001, sceneDepth));\n sceneDepth = mix(sceneDepth, 1.0, emptyZeroDepth);\n float hasSelection = 1.0 - step(0.999999, selectedDepth);\n float depthDelta = selectedDepth - sceneDepth;\n float isVisible = 1.0 - smoothstep(\n editorDepthEpsilon,\n editorDepthEpsilon * 4.0,\n depthDelta\n );\n return hasSelection * isVisible;\n}\n\nfloat selectionSurfaceVisibilityAt(vec2 uv, vec2 texel) {\n vec2 subpixelOffset = texel * 0.25;\n float visibility = 0.0;\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(-subpixelOffset.x, -subpixelOffset.y))\n );\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(subpixelOffset.x, -subpixelOffset.y))\n );\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(-subpixelOffset.x, subpixelOffset.y))\n );\n visibility = max(\n visibility,\n selectionSubpixelVisibilityAt(uv + vec2(subpixelOffset.x, subpixelOffset.y))\n );\n return visibility;\n}\n\nvoid main(void) {\n vec4 sceneColor = texture2D(editorSceneColorSampler, vUV);\n float center = texture2D(textureSampler, vUV).a;\n if (\n vUV.x < editorSelectionUvBounds.x\n || vUV.y < editorSelectionUvBounds.y\n || vUV.x > editorSelectionUvBounds.z\n || vUV.y > editorSelectionUvBounds.w\n ) {\n gl_FragColor = vec4(sceneColor.rgb, 1.0);\n return;\n }\n float identityAlpha = 0.0;\n if (editorSelectionIdentityEnabled > 0.5) {\n float identityBoundary = resolvedSelectionIdentityBoundaryAt(\n vUV,\n editorOutputTexelSize\n );\n float perceptualIdentityCoverage = pow(\n clamp(identityBoundary, 0.0, 1.0),\n 0.75\n );\n identityAlpha = perceptualIdentityCoverage * selectionSurfaceVisibilityAt(\n vUV,\n editorOutputTexelSize\n );\n }\n float unionAlpha = 0.0;\n if (editorSelectionIdentityEnabled < 0.5 && center < 0.999) {\n float outsideCoverage = 1.0 - clamp(center, 0.0, 1.0);\n vec3 strongestSample = strongestSelectionNeighbor(vUV, editorPresentationTexelSize);\n vec2 strongestSampleUv = vUV + strongestSample.yz * editorPresentationTexelSize;\n float boundaryVisibility = selectionSurfaceVisibilityAt(\n strongestSampleUv,\n editorOutputTexelSize\n );\n unionAlpha = smoothstep(\n 0.0,\n 1.0,\n strongestSample.x * outsideCoverage\n ) * boundaryVisibility;\n }\n float alpha = max(unionAlpha, identityAlpha);\n gl_FragColor = vec4(mix(sceneColor.rgb, editorSelectionColor, alpha), 1.0);\n}\n`;\n\nexport interface BabylonEditorSelectionPresentationProjectedNode {\n nodeId: string;\n outlineMeshes: readonly any[];\n selectionMeshes?: readonly any[];\n selectionPresentationTargets?: readonly BabylonEditorSelectionPresentationTarget[];\n}\n\nexport interface BabylonEditorSelectionPresentationTarget {\n selectionNodeId: string;\n renderMeshes: readonly any[];\n}\n\nexport type BabylonEditorSelectionPresentationDiagnosticCode =\n | 'backend-initialization-failed'\n | 'shader-not-ready'\n | 'camera-replacement-failed'\n | 'resource-dispose-failed';\n\nexport interface BabylonEditorSelectionPresentationDiagnostic {\n code: BabylonEditorSelectionPresentationDiagnosticCode;\n message: string;\n cause?: unknown;\n}\n\nexport interface BabylonEditorSelectionPresentationDiagnostics {\n status: 'idle' | 'active' | 'failed' | 'disposed';\n projectedNodeCount: number;\n selectedNodeCount: number;\n selectedMeshCount: number;\n backendResourceCount: number;\n sceneDepthSource: BabylonEditorSelectionSceneDepthSourceKind | null;\n cameraId: string | null;\n lastDiagnostic: BabylonEditorSelectionPresentationDiagnostic | null;\n}\n\nexport interface BabylonEditorSelectionPresentationBackend {\n setSelectedMeshes(\n meshes: readonly any[],\n groups?: readonly BabylonSelectionIdentityGroup[],\n ): void;\n setEnabled(enabled: boolean): void;\n prewarm?(meshes: readonly any[]): void;\n prepareFrame(): void;\n getResourceCount(): number;\n getSceneDepthSourceKind?(): BabylonEditorSelectionSceneDepthSourceKind | null;\n getCameraId(): string | null;\n dispose(): void;\n}\n\nexport interface BabylonEditorSelectionPresentationControllerOptions {\n babylon: BabylonRuntimeGlobal & Record<string, any>;\n scene: RuntimeScene;\n logger?: Pick<Console, 'warn'>;\n onDiagnostic?: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void;\n sceneDepthSourceProvider?: BabylonEditorSelectionSceneDepthSourceProvider;\n prewarm?: boolean;\n createBackend?: (\n options: BabylonEditorSelectionPresentationControllerOptions,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n ) => BabylonEditorSelectionPresentationBackend;\n}\n\nexport interface BabylonEditorSelectionPresentationController {\n attachProjectedNode(node: BabylonEditorSelectionPresentationProjectedNode): void;\n updateProjectedNode(node: BabylonEditorSelectionPresentationProjectedNode): void;\n detachProjectedNode(nodeId: string): void;\n syncSelection(selection: EditorSelectionState): void;\n prepareFrame(): void;\n getDiagnostics(): BabylonEditorSelectionPresentationDiagnostics;\n dispose(): void;\n}\n\ntype SceneDepthLease = {\n camera: RuntimeCamera;\n renderer: any;\n depthMap: any;\n type: number;\n packed: boolean;\n refs: number;\n activeRefs: number;\n width: number;\n height: number;\n};\n\nconst sceneDepthLeases = new WeakMap<object, Map<object, SceneDepthLease>>();\n\ntype PrePassSceneDepthState = {\n prePassRenderer: any;\n configuration: {\n name: string;\n enabled: boolean;\n texturesRequired: number[];\n needsImageProcessing: boolean;\n };\n activeLeaseCount: number;\n releaseSizeGuard: (() => void) | null;\n};\n\nconst prePassSceneDepthStates = new WeakMap<object, PrePassSceneDepthState>();\nconst PREPASS_SELECTION_DEPTH_CONFIGURATION_NAME = 'fpsEditorSelectionSceneDepth';\n\ntype CameraSelectionPostProcessSlot = {\n index: number | null;\n postProcess: any;\n vacantTopology: readonly any[] | null;\n};\n\ntype CameraSelectionPostProcessSlotRegistry = {\n owners: Map<object, CameraSelectionPostProcessSlot>;\n releasedSlots: Map<number, readonly any[]>;\n};\n\nconst cameraSelectionPostProcessSlots = new WeakMap<object, CameraSelectionPostProcessSlotRegistry>();\n\nexport function createBabylonEditorSelectionPresentationController(\n options: BabylonEditorSelectionPresentationControllerOptions,\n): BabylonEditorSelectionPresentationController {\n const nodes = new Map<string, BabylonEditorSelectionPresentationProjectedNode>();\n const reportedDiagnosticCodes = new Set<BabylonEditorSelectionPresentationDiagnosticCode>();\n let selection: EditorSelectionState = { selectedIds: [], activeId: null };\n let backend: BabylonEditorSelectionPresentationBackend | null = null;\n let failed = false;\n let disposed = false;\n let selectedMeshCount = 0;\n let prewarmed = false;\n const prewarmedMeshes = new Set<any>();\n let lastDiagnostic: BabylonEditorSelectionPresentationDiagnostic | null = null;\n\n const reportDiagnostic = (diagnostic: BabylonEditorSelectionPresentationDiagnostic): void => {\n lastDiagnostic = diagnostic;\n if (reportedDiagnosticCodes.has(diagnostic.code)) return;\n reportedDiagnosticCodes.add(diagnostic.code);\n options.logger?.warn(`[selection-presentation:${diagnostic.code}] ${diagnostic.message}`, diagnostic.cause);\n options.onDiagnostic?.(diagnostic);\n };\n\n const ensureBackend = (): BabylonEditorSelectionPresentationBackend | null => {\n if (disposed || failed) return null;\n if (backend) return backend;\n try {\n backend = (options.createBackend ?? createDepthAwareSelectionPresentationBackend)(options, reportDiagnostic);\n return backend;\n } catch (cause) {\n failed = true;\n reportDiagnostic({\n code: 'backend-initialization-failed',\n message: 'Selection silhouette resources could not be initialized; visual selection feedback is disabled.',\n cause,\n });\n return null;\n }\n };\n\n const syncBackendMembership = (): void => {\n if (disposed) return;\n const previousSelectedMeshCount = selectedMeshCount;\n const groups = selection.selectedIds\n .map(selectionId => ({\n selectionId,\n meshes: collectSelectedPresentationMeshes(nodes, {\n selectedIds: [selectionId],\n activeId: selectionId,\n }),\n }))\n .filter(group => group.meshes.length > 0);\n const meshes: any[] = [];\n const seenMeshes = new Set<any>();\n for (const group of groups) {\n for (const mesh of group.meshes) appendPresentationMesh(meshes, seenMeshes, mesh);\n }\n selectedMeshCount = meshes.length;\n if (meshes.length === 0) {\n // Projection attaches nodes incrementally. Once a cold-start prewarm has\n // begun, later empty-selection membership updates must not cancel it\n // before the first warm frame has rendered. A real deselection still\n // clears the backend because it transitions from a non-empty selection.\n if (prewarmed && previousSelectedMeshCount === 0) return;\n backend?.setSelectedMeshes([], groups);\n backend?.setEnabled(false);\n return;\n }\n const nextBackend = ensureBackend();\n if (!nextBackend) return;\n try {\n nextBackend.setSelectedMeshes(meshes, groups);\n nextBackend.setEnabled(true);\n nextBackend.prepareFrame();\n } catch (cause) {\n failed = true;\n safelyDisposeBackend(nextBackend, reportDiagnostic);\n backend = null;\n reportDiagnostic({\n code: 'backend-initialization-failed',\n message: 'Selection silhouette synchronization failed; visual selection feedback is disabled.',\n cause,\n });\n }\n };\n\n const prewarmBackendIfNeeded = (\n node: BabylonEditorSelectionPresentationProjectedNode,\n ): void => {\n if (!options.prewarm || disposed || failed || selection.selectedIds.length > 0) return;\n const candidates = collectSelectedPresentationMeshes(\n new Map([[node.nodeId, node]]),\n { selectedIds: [node.nodeId], activeId: node.nodeId },\n ).filter(mesh => !prewarmedMeshes.has(mesh));\n if (candidates.length === 0) return;\n const nextBackend = ensureBackend();\n if (!nextBackend?.prewarm) return;\n // Mark the controller before entering the backend because depth/pre-pass\n // allocation can synchronously re-enter projection membership updates.\n // Those empty-selection updates must observe the in-flight prewarm.\n prewarmed = true;\n for (const candidate of candidates) prewarmedMeshes.add(candidate);\n try {\n nextBackend.prewarm(candidates);\n } catch (cause) {\n for (const candidate of candidates) prewarmedMeshes.delete(candidate);\n prewarmed = prewarmedMeshes.size > 0;\n reportDiagnostic({\n code: 'backend-initialization-failed',\n message: 'Selection silhouette prewarm failed; the first selection may compile resources on demand.',\n cause,\n });\n }\n };\n\n return {\n attachProjectedNode(node) {\n if (disposed) return;\n nodes.set(node.nodeId, node);\n syncBackendMembership();\n prewarmBackendIfNeeded(node);\n },\n updateProjectedNode(node) {\n if (disposed) return;\n nodes.set(node.nodeId, node);\n syncBackendMembership();\n prewarmBackendIfNeeded(node);\n },\n detachProjectedNode(nodeId) {\n if (disposed) return;\n nodes.delete(nodeId);\n syncBackendMembership();\n },\n syncSelection(nextSelection) {\n if (disposed) return;\n selection = {\n selectedIds: [...new Set(nextSelection.selectedIds)],\n activeId: nextSelection.activeId,\n };\n syncBackendMembership();\n },\n prepareFrame() {\n if (disposed || failed || selectedMeshCount === 0) return;\n try {\n backend?.prepareFrame();\n } catch (cause) {\n failed = true;\n if (backend) safelyDisposeBackend(backend, reportDiagnostic);\n backend = null;\n reportDiagnostic({\n code: 'camera-replacement-failed',\n message: 'Selection silhouette camera resources could not be refreshed; visual selection feedback is disabled.',\n cause,\n });\n }\n },\n getDiagnostics() {\n return {\n status: disposed ? 'disposed' : failed ? 'failed' : selectedMeshCount > 0 ? 'active' : 'idle',\n projectedNodeCount: nodes.size,\n selectedNodeCount: selection.selectedIds.length,\n selectedMeshCount,\n backendResourceCount: backend?.getResourceCount() ?? 0,\n sceneDepthSource: backend?.getSceneDepthSourceKind?.() ?? null,\n cameraId: backend?.getCameraId() ?? null,\n lastDiagnostic,\n };\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n nodes.clear();\n selectedMeshCount = 0;\n if (backend) safelyDisposeBackend(backend, reportDiagnostic);\n backend = null;\n },\n };\n}\n\nexport function collectSelectedPresentationMeshes(\n nodes: ReadonlyMap<string, BabylonEditorSelectionPresentationProjectedNode>,\n selection: EditorSelectionState,\n): any[] {\n const selectedIds = new Set(selection.selectedIds);\n const meshes: any[] = [];\n const seen = new Set<any>();\n for (const [nodeId, node] of nodes) {\n const rootSelected = selectedIds.has(nodeId);\n const mappedSelectionNodeIds = new Set(\n (node.selectionPresentationTargets ?? []).map(target => target.selectionNodeId),\n );\n const proxyNodeIds = new Set(\n (node.selectionMeshes ?? [])\n .map(readPresentationMeshSelectionNodeId)\n .filter((id): id is string => !!id),\n );\n for (const mesh of node.outlineMeshes) {\n const meshNodeId = readPresentationMeshSelectionNodeId(mesh) ?? nodeId;\n if (!rootSelected && (proxyNodeIds.has(meshNodeId) || !selectedIds.has(meshNodeId))) continue;\n appendPresentationMesh(meshes, seen, mesh);\n }\n for (const target of node.selectionPresentationTargets ?? []) {\n if (!selectedIds.has(target.selectionNodeId)) continue;\n for (const mesh of target.renderMeshes) appendPresentationMesh(meshes, seen, mesh);\n }\n for (const mesh of node.selectionMeshes ?? []) {\n const meshNodeId = readPresentationMeshSelectionNodeId(mesh) ?? nodeId;\n if (mappedSelectionNodeIds.has(meshNodeId)) continue;\n if (!selectedIds.has(meshNodeId)) continue;\n appendPresentationMesh(meshes, seen, mesh);\n }\n }\n return meshes;\n}\n\nfunction appendPresentationMesh(meshes: any[], seen: Set<any>, mesh: any): void {\n if (!mesh || seen.has(mesh) || mesh.isDisposed?.()) return;\n seen.add(mesh);\n meshes.push(mesh);\n}\n\nfunction readPresentationMeshSelectionNodeId(mesh: any): string | null {\n const nodeId = mesh?.metadata?.editorProjection?.nodeId;\n return typeof nodeId === 'string' && nodeId.length > 0 ? nodeId : null;\n}\n\nfunction createDepthAwareSelectionPresentationBackend(\n options: BabylonEditorSelectionPresentationControllerOptions,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n): BabylonEditorSelectionPresentationBackend {\n const { babylon, scene } = options;\n const beforeRenderObservable = scene?.onBeforeRenderObservable;\n let beforeRenderObserver: unknown = null;\n let enabled = false;\n let disposed = false;\n let selectedMeshes: any[] = [];\n let selectionGroups: readonly BabylonSelectionIdentityGroup[] = [];\n let camera: RuntimeCamera | null = null;\n let sceneDepthLease: BabylonEditorSelectionSceneDepthSourceLease | null = null;\n let selectedDepthRenderer: any = null;\n let selectedDepthMap: any = null;\n let selectionIdentityPass: BabylonSelectionIdentityPass | null = null;\n const occupancyMaskPass = {\n resource: null as any,\n attached: false,\n insertIndex: null as number | null,\n slotOwner: {},\n };\n const compositePass = {\n resource: null as any,\n attached: false,\n insertIndex: null as number | null,\n slotOwner: {},\n };\n let width = 0;\n let height = 0;\n let selectionSourceRatio = MAX_SELECTION_SOURCE_DENSITY;\n let shaderNotReadyFrames = 0;\n let prewarming = false;\n let prewarmCleanupQueued = false;\n let prewarmReadyFrameCount = 0;\n let prewarmRenderedFrameCount = 0;\n let prewarmAfterRenderObserver: unknown = null;\n let resourcesActive = false;\n let sceneDepthLeaseActive = false;\n let selectedDepthMapActive = false;\n let selectionUvBounds: BabylonEditorSelectionUvBounds = [0, 0, 1, 1];\n\n registerSelectionSilhouetteShader(babylon);\n\n const requiresSelectionIdentityPass = (): boolean => (\n selectionGroups.length > 1\n && !!babylon.ShaderMaterial\n && !!babylon.Effect?.ShadersStore\n );\n\n const detachPostProcessPass = (pass: typeof occupancyMaskPass): void => {\n if (!camera || !pass.resource || !pass.attached) return;\n const topologyBeforeDetach = Array.isArray(camera._postProcesses)\n ? camera._postProcesses.slice()\n : null;\n try {\n const attachedIndex = findCameraPostProcessIndex(camera, pass.resource);\n if (attachedIndex >= 0) pass.insertIndex = attachedIndex;\n camera.detachPostProcess?.(pass.resource);\n pass.attached = false;\n reserveOwnedCameraPostProcessSlot(\n camera,\n pass.slotOwner,\n pass.insertIndex,\n topologyBeforeDetach,\n );\n } catch (cause) {\n if (forceDetachCameraPostProcess(camera, pass.resource)) {\n pass.attached = false;\n reserveOwnedCameraPostProcessSlot(\n camera,\n pass.slotOwner,\n pass.insertIndex,\n topologyBeforeDetach,\n );\n }\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A selection silhouette post-process could not be detached cleanly.',\n cause,\n });\n }\n };\n\n const deactivateResources = (): void => {\n resourcesActive = false;\n selectionIdentityPass?.setEnabled(false);\n if (sceneDepthLease && sceneDepthLeaseActive) {\n try {\n sceneDepthLease.deactivate();\n sceneDepthLeaseActive = false;\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The shared scene depth lease could not be deactivated cleanly.',\n cause,\n });\n }\n }\n if (selectedDepthMap && selectedDepthMapActive) {\n try {\n removeCustomRenderTarget(scene, selectedDepthMap);\n selectedDepthMapActive = false;\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The selected depth target could not be detached cleanly.',\n cause,\n });\n }\n }\n detachPostProcessPass(compositePass);\n detachPostProcessPass(occupancyMaskPass);\n };\n\n const clearPrewarmAfterRenderObserver = (): void => {\n if (prewarmAfterRenderObserver == null) return;\n scene?.onAfterRenderObservable?.remove?.(prewarmAfterRenderObserver);\n prewarmAfterRenderObserver = null;\n };\n\n const finishPrewarm = (): void => {\n if (!prewarming) return;\n prewarming = false;\n clearPrewarmAfterRenderObserver();\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n selectedMeshes = [];\n selectionGroups = [];\n if (selectedDepthMap) selectedDepthMap.renderList = selectedMeshes;\n enabled = false;\n deactivateResources();\n };\n\n const activateResources = (): void => {\n if (\n !enabled\n || !sceneDepthLease\n || !selectedDepthMap\n || !occupancyMaskPass.resource\n || !compositePass.resource\n || requiresSelectionIdentityPass() !== !!selectionIdentityPass\n || !camera\n ) return;\n if (resourcesActive) return;\n if (!occupancyMaskPass.attached) {\n occupancyMaskPass.insertIndex = attachOwnedCameraPostProcess(\n camera,\n occupancyMaskPass.slotOwner,\n occupancyMaskPass.resource,\n );\n occupancyMaskPass.attached = true;\n }\n if (!compositePass.attached) {\n compositePass.insertIndex = attachOwnedCameraPostProcess(\n camera,\n compositePass.slotOwner,\n compositePass.resource,\n );\n compositePass.attached = true;\n }\n if (!sceneDepthLeaseActive) {\n sceneDepthLease.activate();\n sceneDepthLeaseActive = true;\n }\n if (!selectedDepthMapActive) {\n selectedDepthMapActive = true;\n addCustomRenderTarget(scene, selectedDepthMap);\n }\n selectionIdentityPass?.setEnabled(true);\n resourcesActive = true;\n };\n\n const disposePostProcessPass = (pass: typeof occupancyMaskPass, ownedCamera: RuntimeCamera | null): void => {\n const resource = pass.resource;\n if (resource) {\n try {\n resource.dispose?.(ownedCamera ?? undefined);\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A selection silhouette post-process resource could not be disposed cleanly.',\n cause,\n });\n }\n releaseOwnedCameraPostProcessSlot(\n ownedCamera,\n pass.slotOwner,\n pass.insertIndex,\n resource,\n );\n }\n pass.resource = null;\n pass.attached = false;\n pass.insertIndex = null;\n };\n\n const disposeCameraResources = (preservePrewarm = false): void => {\n if (!preservePrewarm) {\n clearPrewarmAfterRenderObserver();\n prewarming = false;\n }\n deactivateResources();\n const ownedCamera = camera;\n disposePostProcessPass(compositePass, ownedCamera);\n disposePostProcessPass(occupancyMaskPass, ownedCamera);\n const ownedSelectedDepthMap = selectedDepthMap;\n if (selectedDepthRenderer) {\n try {\n selectedDepthRenderer.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A selection silhouette depth resource could not be disposed cleanly.',\n cause,\n });\n }\n }\n if (ownedSelectedDepthMap) {\n try {\n ownedSelectedDepthMap.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The owned selected depth target could not be disposed cleanly.',\n cause,\n });\n }\n }\n if (selectionIdentityPass) {\n try {\n selectionIdentityPass.dispose();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The selection identity pass could not be disposed cleanly.',\n cause,\n });\n }\n }\n selectedDepthRenderer = null;\n selectedDepthMap = null;\n selectedDepthMapActive = false;\n selectionIdentityPass = null;\n if (sceneDepthLease) {\n try {\n sceneDepthLease.dispose();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The leased scene depth source could not be disposed cleanly.',\n cause,\n });\n }\n }\n sceneDepthLease = null;\n sceneDepthLeaseActive = false;\n camera = null;\n width = 0;\n height = 0;\n selectionSourceRatio = MAX_SELECTION_SOURCE_DENSITY;\n shaderNotReadyFrames = 0;\n resourcesActive = false;\n };\n\n const createCameraResources = (nextCamera: RuntimeCamera): void => {\n const DepthRenderer = babylon.DepthRenderer;\n const RenderTargetTexture = babylon.RenderTargetTexture;\n const PostProcess = babylon.PostProcess;\n if (!DepthRenderer || !RenderTargetTexture || !PostProcess) {\n throw new Error('Babylon runtime is missing DepthRenderer, RenderTargetTexture, or PostProcess.');\n }\n const engine = scene.getEngine?.();\n if (!engine) throw new Error('Selection silhouette requires an active Babylon engine.');\n const nextWidth = Math.max(1, Number(engine.getRenderWidth?.() ?? 1));\n const nextHeight = Math.max(1, Number(engine.getRenderHeight?.() ?? 1));\n const nextSelectionSourceRatio = resolveSelectionSourceRatio(engine);\n const sceneDepthType = resolveDepthTextureType(engine);\n let nextLease: BabylonEditorSelectionSceneDepthSourceLease | null = null;\n let nextSelectedRenderer: any = null;\n let nextSelectedMap: any = null;\n let nextSelectionIdentityPass: BabylonSelectionIdentityPass | null = null;\n let nextOccupancyMaskPass: any = null;\n let nextCompositePass: any = null;\n let adopted = false;\n try {\n nextSelectedMap = new RenderTargetTexture(\n 'editorSelectionSelectedDepth',\n {\n width: Math.max(1, Math.ceil(nextWidth * nextSelectionSourceRatio)),\n height: Math.max(1, Math.ceil(nextHeight * nextSelectionSourceRatio)),\n },\n scene,\n {\n generateMipMaps: false,\n doNotChangeAspectRatio: true,\n type: sceneDepthType,\n samplingMode: TEXTURE_NEAREST_SAMPLING_MODE,\n generateDepthBuffer: true,\n generateStencilBuffer: false,\n },\n );\n nextSelectedRenderer = new DepthRenderer(\n scene,\n sceneDepthType,\n nextCamera,\n true,\n TEXTURE_NEAREST_SAMPLING_MODE,\n false,\n 'editorSelectionSelectedDepthRenderer',\n nextSelectedMap,\n );\n nextSelectedRenderer.forceDepthWriteTransparentMeshes = true;\n nextSelectedMap.renderList = selectedMeshes;\n if (requiresSelectionIdentityPass()) {\n nextSelectionIdentityPass = new BabylonSelectionIdentityPass({\n babylon,\n scene,\n camera: nextCamera,\n width: Math.max(1, Math.ceil(nextWidth * nextSelectionSourceRatio)),\n height: Math.max(1, Math.ceil(nextHeight * nextSelectionSourceRatio)),\n });\n nextSelectionIdentityPass.setSelection(selectionGroups);\n }\n nextOccupancyMaskPass = new PostProcess(\n 'editorSelectionOccupancyMask',\n SELECTION_OCCUPANCY_MASK_SHADER_NAME,\n [\n 'editorSelectedDepthTexelSize',\n 'editorOutputTexelSize',\n 'editorPresentationTexelSize',\n 'editorSelectionUvBounds',\n 'editorSelectedPackedDepth',\n 'editorSelectionIdentityEnabled',\n ],\n [\n 'editorSelectedDepthSampler',\n 'editorSelectionIdentitySampler',\n ],\n 1,\n null,\n TEXTURE_BILINEAR_SAMPLING_MODE,\n engine,\n false,\n );\n nextOccupancyMaskPass.onApply = (effect: any) => {\n const outputWidth = Math.max(1, Number(engine.getRenderWidth?.() ?? width ?? nextWidth));\n const outputHeight = Math.max(1, Number(engine.getRenderHeight?.() ?? height ?? nextHeight));\n const presentationSize = resolveSelectionPresentationSize(\n engine,\n outputWidth,\n outputHeight,\n );\n selectionUvBounds = prewarming\n ? [1, 1, 0, 0]\n : computeSelectionPresentationUvBounds(\n babylon,\n scene,\n nextCamera,\n selectedMeshes,\n outputWidth,\n outputHeight,\n SELECTION_PRESENTATION_PADDING_PX,\n );\n effect.setTexture?.('editorSelectedDepthSampler', nextSelectedMap);\n const selectedSize = nextSelectedMap.getSize?.() ?? {\n width: nextWidth * nextSelectionSourceRatio,\n height: nextHeight * nextSelectionSourceRatio,\n };\n effect.setFloat2?.(\n 'editorSelectedDepthTexelSize',\n 1 / Math.max(1, Number(selectedSize.width)),\n 1 / Math.max(1, Number(selectedSize.height)),\n );\n effect.setFloat4?.('editorSelectionUvBounds', ...selectionUvBounds);\n effect.setFloat?.('editorSelectedPackedDepth', nextSelectedRenderer?.isPacked ? 1 : 0);\n effect.setTexture?.(\n 'editorSelectionIdentitySampler',\n nextSelectionIdentityPass?.texture ?? nextSelectedMap,\n );\n effect.setFloat2?.('editorOutputTexelSize', 1 / outputWidth, 1 / outputHeight);\n effect.setFloat2?.(\n 'editorPresentationTexelSize',\n 1 / presentationSize.width,\n 1 / presentationSize.height,\n );\n effect.setFloat?.(\n 'editorSelectionIdentityEnabled',\n nextSelectionIdentityPass ? 1 : 0,\n );\n };\n nextCompositePass = new PostProcess(\n 'editorSelectionSilhouetteComposite',\n SELECTION_SILHOUETTE_SHADER_NAME,\n [\n 'editorOutputTexelSize',\n 'editorPresentationTexelSize',\n 'editorSelectionUvBounds',\n 'editorSelectionColor',\n 'editorScenePackedDepth',\n 'editorSelectedPackedDepth',\n 'editorSelectionIdentityEnabled',\n 'editorSceneBackgroundDepth',\n 'editorDepthEpsilon',\n ],\n [\n 'editorSceneColorSampler',\n 'editorSceneDepthSampler',\n 'editorSelectedDepthSampler',\n ],\n 1,\n null,\n TEXTURE_BILINEAR_SAMPLING_MODE,\n engine,\n false,\n );\n nextLease = (options.sceneDepthSourceProvider ?? defaultSelectionSceneDepthSourceProvider).acquire({\n babylon,\n scene,\n camera: nextCamera,\n consumerPostProcess: nextCompositePass,\n textureType: sceneDepthType,\n width: nextWidth,\n height: nextHeight,\n reportDiagnostic,\n });\n nextCompositePass.onApply = (effect: any) => {\n const outputWidth = Math.max(1, Number(engine.getRenderWidth?.() ?? width ?? nextWidth));\n const outputHeight = Math.max(1, Number(engine.getRenderHeight?.() ?? height ?? nextHeight));\n const presentationSize = resolveSelectionPresentationSize(\n engine,\n outputWidth,\n outputHeight,\n );\n effect.setTextureFromPostProcess?.(\n 'editorSceneColorSampler',\n nextOccupancyMaskPass,\n );\n effect.setTexture?.('editorSceneDepthSampler', nextLease?.getTexture());\n effect.setTexture?.('editorSelectedDepthSampler', nextSelectedMap);\n effect.setFloat2?.('editorOutputTexelSize', 1 / outputWidth, 1 / outputHeight);\n effect.setFloat2?.(\n 'editorPresentationTexelSize',\n 1 / presentationSize.width,\n 1 / presentationSize.height,\n );\n effect.setFloat4?.('editorSelectionUvBounds', ...selectionUvBounds);\n effect.setFloat3?.('editorSelectionColor', ...SELECTION_PRESENTATION_COLOR);\n effect.setFloat?.('editorScenePackedDepth', nextLease?.packed ? 1 : 0);\n effect.setFloat?.('editorSceneBackgroundDepth', nextLease?.backgroundDepth ?? 1);\n effect.setFloat?.('editorSelectedPackedDepth', nextSelectedRenderer?.isPacked ? 1 : 0);\n effect.setFloat?.(\n 'editorSelectionIdentityEnabled',\n nextSelectionIdentityPass ? 1 : 0,\n );\n effect.setFloat?.('editorDepthEpsilon', 0.0015);\n };\n camera = nextCamera;\n sceneDepthLease = nextLease;\n selectedDepthRenderer = nextSelectedRenderer;\n selectedDepthMap = nextSelectedMap;\n selectionIdentityPass = nextSelectionIdentityPass;\n occupancyMaskPass.resource = nextOccupancyMaskPass;\n compositePass.resource = nextCompositePass;\n width = nextWidth;\n height = nextHeight;\n selectionSourceRatio = nextSelectionSourceRatio;\n adopted = true;\n activateResources();\n } catch (cause) {\n if (adopted) {\n disposeCameraResources();\n } else {\n try { nextCompositePass?.dispose?.(nextCamera); } catch {}\n try { nextOccupancyMaskPass?.dispose?.(nextCamera); } catch {}\n try { nextSelectedRenderer?.dispose?.(); } catch {}\n try { nextSelectedMap?.dispose?.(); } catch {}\n try { nextSelectionIdentityPass?.dispose(); } catch {}\n try { nextLease?.dispose(); } catch {}\n }\n throw cause;\n }\n };\n\n const prepareFrame = (): void => {\n if (disposed || !enabled) return;\n const nextCamera = scene.activeCamera ?? null;\n if (!nextCamera) return;\n if (\n camera !== nextCamera\n || !sceneDepthLease\n || !selectedDepthMap\n || !occupancyMaskPass.resource\n || !compositePass.resource\n || requiresSelectionIdentityPass() !== !!selectionIdentityPass\n ) {\n disposeCameraResources(true);\n createCameraResources(nextCamera);\n return;\n }\n const engine = scene.getEngine?.();\n const nextWidth = Math.max(1, Number(engine?.getRenderWidth?.() ?? width));\n const nextHeight = Math.max(1, Number(engine?.getRenderHeight?.() ?? height));\n const nextSelectionSourceRatio = resolveSelectionSourceRatio(engine);\n if (\n nextWidth !== width\n || nextHeight !== height\n || nextSelectionSourceRatio !== selectionSourceRatio\n ) {\n width = nextWidth;\n height = nextHeight;\n selectionSourceRatio = nextSelectionSourceRatio;\n sceneDepthLease.resize(nextWidth, nextHeight);\n selectedDepthMap.resize?.({\n width: Math.max(1, Math.ceil(nextWidth * selectionSourceRatio)),\n height: Math.max(1, Math.ceil(nextHeight * selectionSourceRatio)),\n });\n selectionIdentityPass?.resize(\n Math.max(1, Math.ceil(nextWidth * selectionSourceRatio)),\n Math.max(1, Math.ceil(nextHeight * selectionSourceRatio)),\n );\n }\n selectedDepthMap.renderList = selectedMeshes;\n activateResources();\n if (occupancyMaskPass.resource.isSupported === false || compositePass.resource.isSupported === false) {\n throw new Error('Selection silhouette post-process is not supported by the active engine.');\n }\n if (occupancyMaskPass.resource.isReady?.() && compositePass.resource.isReady?.()) {\n shaderNotReadyFrames = 0;\n } else {\n shaderNotReadyFrames += 1;\n if (shaderNotReadyFrames > 120) {\n reportDiagnostic({\n code: 'shader-not-ready',\n message: 'Selection silhouette shader did not become ready; visual selection feedback is disabled.',\n });\n throw new Error('Selection silhouette shader readiness timed out.');\n }\n }\n };\n\n if (beforeRenderObservable?.add) {\n beforeRenderObserver = beforeRenderObservable.add(prepareFrame);\n }\n\n return {\n setSelectedMeshes(meshes, groups) {\n if (prewarming) {\n // Projected nodes can publish empty membership while the scene is\n // still being assembled. Treat that as prewarm noise; a non-empty\n // selection is the only state transition that may take ownership of\n // the warmed resources before cleanup.\n if (meshes.length === 0) return;\n prewarming = false;\n clearPrewarmAfterRenderObserver();\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n }\n const requiredBefore = requiresSelectionIdentityPass();\n selectedMeshes = [...meshes];\n selectionGroups = groups?.map(group => ({\n selectionId: group.selectionId,\n meshes: [...group.meshes],\n })) ?? [];\n if (selectedDepthMap) selectedDepthMap.renderList = selectedMeshes;\n const requiredAfter = requiresSelectionIdentityPass();\n if (camera && requiredBefore !== requiredAfter) {\n disposeCameraResources();\n if (enabled) prepareFrame();\n return;\n }\n selectionIdentityPass?.setSelection(selectionGroups);\n },\n setEnabled(nextEnabled) {\n if (prewarming && !nextEnabled) return;\n if (disposed || enabled === nextEnabled) return;\n enabled = nextEnabled;\n if (enabled) prepareFrame();\n else {\n prewarming = false;\n clearPrewarmAfterRenderObserver();\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n deactivateResources();\n }\n },\n prewarm(meshes) {\n if (disposed || meshes.length === 0 || (enabled && !prewarming)) return;\n if (prewarming) {\n const mergedMeshes = [...selectedMeshes];\n const seenMeshes = new Set(mergedMeshes);\n for (const mesh of meshes) appendPresentationMesh(mergedMeshes, seenMeshes, mesh);\n selectedMeshes = mergedMeshes;\n if (selectedDepthMap) selectedDepthMap.renderList = selectedMeshes;\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n return;\n }\n selectedMeshes = [...meshes];\n selectionGroups = [];\n prewarming = true;\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n enabled = true;\n prepareFrame();\n const afterRenderObservable = scene?.onAfterRenderObservable;\n if (afterRenderObservable?.add) {\n prewarmAfterRenderObserver = afterRenderObservable.add(() => {\n prewarmRenderedFrameCount += 1;\n const selectedDepthReady = selectedDepthMap?.isReadyForRendering?.() ?? true;\n const postProcessesReady = (occupancyMaskPass.resource?.isReady?.() ?? true)\n && (compositePass.resource?.isReady?.() ?? true);\n prewarmReadyFrameCount = selectedDepthReady && postProcessesReady\n ? prewarmReadyFrameCount + 1\n : 0;\n // One readiness probe can itself trigger deferred shader work.\n // Require a second rendered frame with all resources ready before\n // detaching them from the scene.\n if (prewarmReadyFrameCount < 2 && prewarmRenderedFrameCount < 4) return;\n clearPrewarmAfterRenderObserver();\n if (prewarmCleanupQueued) return;\n prewarmCleanupQueued = true;\n void Promise.resolve().then(() => {\n prewarmCleanupQueued = false;\n finishPrewarm();\n });\n });\n } else {\n finishPrewarm();\n }\n },\n prepareFrame,\n getResourceCount() {\n if (\n !sceneDepthLease\n && !selectedDepthRenderer\n && !selectionIdentityPass\n && !occupancyMaskPass.resource\n && !compositePass.resource\n ) return 0;\n return Number(!!sceneDepthLease)\n + Number(!!selectedDepthRenderer)\n + Number(!!selectionIdentityPass)\n + Number(!!occupancyMaskPass.resource)\n + Number(!!compositePass.resource);\n },\n getSceneDepthSourceKind() {\n return sceneDepthLease?.kind ?? null;\n },\n getCameraId() {\n const id = camera?.id;\n return typeof id === 'string' ? id : null;\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n clearPrewarmAfterRenderObserver();\n prewarming = false;\n prewarmCleanupQueued = false;\n prewarmReadyFrameCount = 0;\n prewarmRenderedFrameCount = 0;\n if (beforeRenderObserver != null) beforeRenderObservable?.remove?.(beforeRenderObserver);\n beforeRenderObserver = null;\n disposeCameraResources();\n selectedMeshes = [];\n selectionGroups = [];\n },\n };\n}\n\nfunction registerSelectionSilhouetteShader(babylon: BabylonRuntimeGlobal & Record<string, any>): void {\n const shadersStore = babylon.Effect?.ShadersStore;\n if (!shadersStore) throw new Error('Babylon runtime is missing Effect.ShadersStore.');\n const maskShaderKey = `${SELECTION_OCCUPANCY_MASK_SHADER_NAME}PixelShader`;\n const compositeShaderKey = `${SELECTION_SILHOUETTE_SHADER_NAME}PixelShader`;\n if (!shadersStore[maskShaderKey]) shadersStore[maskShaderKey] = SELECTION_OCCUPANCY_MASK_FRAGMENT_SHADER;\n if (!shadersStore[compositeShaderKey]) {\n shadersStore[compositeShaderKey] = SELECTION_SILHOUETTE_FRAGMENT_SHADER;\n }\n}\n\nexport function computeSelectionPresentationUvBounds(\n babylon: BabylonRuntimeGlobal & Record<string, any>,\n scene: RuntimeScene,\n camera: RuntimeCamera,\n meshes: readonly any[],\n width: number,\n height: number,\n paddingPx = SELECTION_PRESENTATION_PADDING_PX,\n): BabylonEditorSelectionUvBounds {\n const Vector3 = babylon.Vector3 as any;\n const Matrix = babylon.Matrix;\n const transform = scene.getTransformMatrix?.();\n if (!Vector3?.Project || !Matrix?.Identity || !transform || width <= 0 || height <= 0) {\n return [0, 0, 1, 1];\n }\n const viewport = camera.viewport?.toGlobal?.(width, height)\n ?? { x: 0, y: 0, width, height };\n let minU = 1;\n let minV = 1;\n let maxU = 0;\n let maxV = 0;\n let projectedPointCount = 0;\n try {\n for (const mesh of meshes) {\n if (!mesh || mesh.isDisposed?.()) continue;\n if (hasRuntimeDeformedBounds(mesh)) return [0, 0, 1, 1];\n mesh.computeWorldMatrix?.(true);\n const vectors = mesh.getBoundingInfo?.()?.boundingBox?.vectorsWorld;\n if (!Array.isArray(vectors) || vectors.length === 0) return [0, 0, 1, 1];\n for (const point of vectors) {\n const projected = Vector3.Project(point, Matrix.Identity(), transform, viewport);\n if (\n !Number.isFinite(projected?.x)\n || !Number.isFinite(projected?.y)\n || !Number.isFinite(projected?.z)\n || projected.z < 0\n || projected.z > 1\n ) return [0, 0, 1, 1];\n const u = projected.x / width;\n const v = 1 - (projected.y / height);\n minU = Math.min(minU, u);\n minV = Math.min(minV, v);\n maxU = Math.max(maxU, u);\n maxV = Math.max(maxV, v);\n projectedPointCount += 1;\n }\n }\n } catch {\n return [0, 0, 1, 1];\n }\n if (projectedPointCount === 0) return [0, 0, 1, 1];\n const padU = Math.max(0, paddingPx) / width;\n const padV = Math.max(0, paddingPx) / height;\n return [\n clampUnit(minU - padU),\n clampUnit(minV - padV),\n clampUnit(maxU + padU),\n clampUnit(maxV + padV),\n ];\n}\n\nfunction hasRuntimeDeformedBounds(mesh: any): boolean {\n const sourceMesh = mesh?.sourceMesh;\n return !!(\n mesh?.skeleton\n || mesh?.morphTargetManager\n || mesh?.bakedVertexAnimationManager\n || sourceMesh?.skeleton\n || sourceMesh?.morphTargetManager\n || sourceMesh?.bakedVertexAnimationManager\n );\n}\n\nfunction clampUnit(value: number): number {\n return Math.min(1, Math.max(0, value));\n}\n\nfunction resolveSelectionSourceRatio(engine: any): number {\n const hardwareScalingLevel = Number(engine?.getHardwareScalingLevel?.() ?? 1);\n if (!Number.isFinite(hardwareScalingLevel) || hardwareScalingLevel <= 0) {\n return MAX_SELECTION_SOURCE_DENSITY;\n }\n return Math.min(\n MAX_SELECTION_SOURCE_DENSITY,\n Math.max(1, MAX_SELECTION_SOURCE_DENSITY * hardwareScalingLevel),\n );\n}\n\nfunction resolveSelectionPresentationSize(\n engine: any,\n outputWidth: number,\n outputHeight: number,\n): { width: number; height: number } {\n const canvas = engine?.getRenderingCanvas?.();\n const hardwareScalingLevel = Number(engine?.getHardwareScalingLevel?.() ?? 1);\n const fallbackScale = Number.isFinite(hardwareScalingLevel) && hardwareScalingLevel > 0\n ? hardwareScalingLevel\n : 1;\n return {\n width: Math.max(1, Number(canvas?.clientWidth) || outputWidth * fallbackScale),\n height: Math.max(1, Number(canvas?.clientHeight) || outputHeight * fallbackScale),\n };\n}\n\nexport const defaultSelectionSceneDepthSourceProvider: BabylonEditorSelectionSceneDepthSourceProvider = {\n acquire(request) {\n return createAdaptiveSelectionSceneDepthSourceLease(request);\n },\n};\n\nfunction createAdaptiveSelectionSceneDepthSourceLease(\n request: BabylonEditorSelectionSceneDepthSourceRequest,\n): BabylonEditorSelectionSceneDepthSourceLease {\n let width = request.width;\n let height = request.height;\n let delegate = canUsePrePassSceneDepth(request)\n ? createPrePassSelectionSceneDepthSourceLease(request)\n : createDedicatedSelectionSceneDepthSourceLease(request);\n let disposed = false;\n let activated = false;\n\n const replaceWithDedicatedSource = (): void => {\n const previous = delegate;\n const errors: unknown[] = [];\n try {\n previous.dispose();\n } catch (error) {\n errors.push(error);\n }\n try {\n delegate = createDedicatedSelectionSceneDepthSourceLease({ ...request, width, height });\n } catch (error) {\n errors.push(error);\n }\n throwSelectionDepthCleanupErrors(\n 'Babylon pre-pass fallback cleanup failed.',\n errors,\n );\n };\n\n return {\n get kind() { return delegate.kind; },\n get packed() { return delegate.packed; },\n get backgroundDepth() { return delegate.backgroundDepth; },\n getTexture() { return delegate.getTexture(); },\n activate() {\n if (disposed || activated) return;\n try {\n delegate.activate();\n } catch (cause) {\n if (delegate.kind !== 'prepass') throw cause;\n try {\n replaceWithDedicatedSource();\n } catch (cleanupError) {\n throw createSelectionDepthCleanupError(\n 'Babylon pre-pass fallback activation and cleanup both failed.',\n [cause, cleanupError],\n );\n }\n delegate.activate();\n }\n activated = true;\n },\n deactivate() {\n if (!activated) return;\n delegate.deactivate();\n activated = false;\n },\n resize(nextWidth, nextHeight) {\n width = nextWidth;\n height = nextHeight;\n delegate.resize(nextWidth, nextHeight);\n },\n dispose() {\n if (disposed) return;\n delegate.dispose();\n disposed = true;\n activated = false;\n },\n };\n}\n\nfunction canUsePrePassSceneDepth(request: BabylonEditorSelectionSceneDepthSourceRequest): boolean {\n return !!(\n request.scene?.enablePrePassRenderer\n && request.consumerPostProcess\n && typeof request.consumerPostProcess.setPrePassRenderer === 'function'\n && Number.isInteger(request.babylon.Constants?.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE)\n );\n}\n\nfunction installPrePassResizeGuard(scene: any, prePassRenderer: any): () => void {\n const target = prePassRenderer.defaultRT;\n const originalCheckSize = target?._checkSize;\n if (!target || typeof originalCheckSize !== 'function') return () => {};\n const guardedCheckSize = function (this: any, ...args: any[]): unknown {\n const engine = scene.getEngine?.();\n const requiredWidth = engine?.getRenderWidth?.(true);\n const requiredHeight = engine?.getRenderHeight?.(true);\n const needsResize = Number.isFinite(requiredWidth)\n && Number.isFinite(requiredHeight)\n && (\n this.getRenderWidth?.() !== requiredWidth\n || this.getRenderHeight?.() !== requiredHeight\n );\n if (needsResize && engine?._currentRenderTarget === this.renderTarget) {\n engine.restoreDefaultFramebuffer?.();\n }\n return originalCheckSize.apply(this, args);\n };\n target._checkSize = guardedCheckSize;\n return () => {\n if (target._checkSize === guardedCheckSize) target._checkSize = originalCheckSize;\n };\n}\n\nfunction releasePrePassResizeGuard(state: PrePassSceneDepthState): void {\n if (state.activeLeaseCount > 0 || !state.releaseSizeGuard) return;\n const release = state.releaseSizeGuard;\n release();\n state.releaseSizeGuard = null;\n}\n\nfunction throwSelectionDepthCleanupErrors(message: string, errors: readonly unknown[]): void {\n if (errors.length === 0) return;\n if (errors.length === 1) throw errors[0];\n throw createSelectionDepthCleanupError(message, errors);\n}\n\nfunction createSelectionDepthCleanupError(message: string, errors: readonly unknown[]): Error {\n const error = new Error(message) as Error & { errors: readonly unknown[] };\n error.errors = Object.freeze([...errors]);\n return error;\n}\n\nfunction createPrePassSelectionSceneDepthSourceLease(\n request: BabylonEditorSelectionSceneDepthSourceRequest,\n): BabylonEditorSelectionSceneDepthSourceLease {\n const depthTextureType = request.babylon.Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE;\n const consumer = request.consumerPostProcess;\n const originalSetPrePassRenderer = consumer.setPrePassRenderer;\n let state: PrePassSceneDepthState | null = null;\n let active = false;\n let disposed = false;\n\n const restoreConsumer = (): void => {\n if (consumer.setPrePassRenderer === setPrePassRenderer) {\n consumer.setPrePassRenderer = originalSetPrePassRenderer;\n }\n };\n\n const setPrePassRenderer = function (prePassRenderer: any): boolean {\n const originalNeeded = originalSetPrePassRenderer.call(consumer, prePassRenderer);\n if (!state || state.prePassRenderer !== prePassRenderer) return originalNeeded;\n state.configuration = prePassRenderer.addEffectConfiguration(state.configuration);\n state.configuration.enabled = state.activeLeaseCount > 0;\n return originalNeeded || state.configuration.enabled;\n };\n\n const updatePrePassRenderer = (prePassRenderer: any): void => {\n request.scene.getEngine?.().restoreDefaultFramebuffer?.();\n prePassRenderer.update?.();\n };\n\n const deactivate = (): void => {\n const errors: unknown[] = [];\n if (!active) {\n if (state) {\n try {\n releasePrePassResizeGuard(state);\n } catch (error) {\n errors.push(error);\n }\n }\n throwSelectionDepthCleanupErrors('Babylon pre-pass selection depth cleanup failed.', errors);\n return;\n }\n active = false;\n try {\n restoreConsumer();\n } catch (error) {\n errors.push(error);\n }\n if (state) {\n state.activeLeaseCount = Math.max(0, state.activeLeaseCount - 1);\n state.configuration.enabled = state.activeLeaseCount > 0;\n try {\n state.prePassRenderer.markAsDirty?.();\n } catch (error) {\n errors.push(error);\n }\n try {\n updatePrePassRenderer(state.prePassRenderer);\n } catch (error) {\n errors.push(error);\n }\n try {\n releasePrePassResizeGuard(state);\n } catch (error) {\n errors.push(error);\n }\n }\n throwSelectionDepthCleanupErrors('Babylon pre-pass selection depth cleanup failed.', errors);\n };\n\n const getTexture = (): any => {\n const index = state?.prePassRenderer?.getIndex?.(depthTextureType);\n const texture = Number.isInteger(index) && index >= 0\n ? state?.prePassRenderer?.defaultRT?.textures?.[index]\n : null;\n if (!texture) throw new Error('Babylon pre-pass did not expose a compatible screen-space depth texture.');\n return texture;\n };\n\n return {\n kind: 'prepass',\n packed: false,\n backgroundDepth: 0,\n getTexture,\n activate() {\n if (disposed || active) return;\n const prePassRenderer = request.scene.enablePrePassRenderer?.();\n if (!prePassRenderer?.isSupported) {\n throw new Error('Babylon pre-pass is unavailable on the active engine.');\n }\n state = prePassSceneDepthStates.get(request.scene as object) ?? {\n prePassRenderer,\n configuration: {\n name: PREPASS_SELECTION_DEPTH_CONFIGURATION_NAME,\n enabled: false,\n texturesRequired: [depthTextureType],\n needsImageProcessing: false,\n },\n activeLeaseCount: 0,\n releaseSizeGuard: null,\n };\n if (state.prePassRenderer !== prePassRenderer) {\n throw new Error('The scene pre-pass renderer changed while acquiring selection depth.');\n }\n prePassSceneDepthStates.set(request.scene as object, state);\n state.activeLeaseCount += 1;\n state.releaseSizeGuard ??= installPrePassResizeGuard(request.scene, prePassRenderer);\n state.configuration.enabled = true;\n consumer.setPrePassRenderer = setPrePassRenderer;\n active = true;\n try {\n prePassRenderer.markAsDirty?.();\n updatePrePassRenderer(prePassRenderer);\n if (!prePassRenderer.enabled) throw new Error('Babylon pre-pass did not activate.');\n getTexture();\n } catch (cause) {\n try {\n deactivate();\n } catch (cleanupError) {\n throw createSelectionDepthCleanupError(\n 'Babylon pre-pass activation and cleanup both failed.',\n [cause, cleanupError],\n );\n }\n throw cause;\n }\n },\n deactivate,\n resize() {\n // Babylon owns this target and resizes it with the main render surface.\n },\n dispose() {\n if (disposed) return;\n const errors: unknown[] = [];\n try {\n deactivate();\n } catch (error) {\n errors.push(error);\n }\n try {\n restoreConsumer();\n } catch (error) {\n errors.push(error);\n }\n throwSelectionDepthCleanupErrors('Babylon pre-pass selection depth disposal failed.', errors);\n disposed = true;\n },\n };\n}\n\nfunction createDedicatedSelectionSceneDepthSourceLease(\n request: BabylonEditorSelectionSceneDepthSourceRequest,\n): BabylonEditorSelectionSceneDepthSourceLease {\n const lease = acquireSceneDepthLease(\n request.babylon,\n request.scene,\n request.camera,\n request.textureType,\n request.width,\n request.height,\n );\n let active = false;\n let disposed = false;\n return {\n kind: 'dedicated',\n packed: lease.packed,\n backgroundDepth: 1,\n getTexture: () => lease.depthMap,\n activate() {\n if (disposed || active) return;\n activateSceneDepthLease(request.scene, lease);\n active = true;\n },\n deactivate() {\n if (!active) return;\n deactivateSceneDepthLease(request.scene, lease);\n active = false;\n },\n resize(width, height) {\n resizeSceneDepthLease(lease, width, height);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n if (active) deactivateSceneDepthLease(request.scene, lease);\n active = false;\n releaseSceneDepthLease(request.scene, lease, request.reportDiagnostic);\n },\n };\n}\n\nfunction resolveDepthTextureType(engine: any): number {\n const caps = engine.getCaps?.() ?? {};\n if (caps.textureHalfFloatRender) return TEXTURE_TYPE_HALF_FLOAT;\n if (caps.textureFloatRender) return TEXTURE_TYPE_FLOAT;\n return TEXTURE_TYPE_UNSIGNED_BYTE;\n}\n\nfunction acquireSceneDepthLease(\n babylon: BabylonRuntimeGlobal & Record<string, any>,\n scene: RuntimeScene,\n camera: RuntimeCamera,\n type: number,\n width: number,\n height: number,\n): SceneDepthLease {\n let cameraLeases = sceneDepthLeases.get(scene);\n if (!cameraLeases) {\n cameraLeases = new Map();\n sceneDepthLeases.set(scene, cameraLeases);\n }\n const existing = cameraLeases.get(camera);\n if (existing && existing.type === type) {\n resizeSceneDepthLease(existing, width, height);\n existing.refs += 1;\n return existing;\n }\n const DepthRenderer = babylon.DepthRenderer;\n if (!DepthRenderer) throw new Error('Babylon runtime is missing DepthRenderer.');\n let renderer: any = null;\n let depthMap: any = null;\n try {\n renderer = new DepthRenderer(\n scene,\n type,\n camera,\n true,\n TEXTURE_NEAREST_SAMPLING_MODE,\n false,\n 'editorSelectionSceneDepthRenderer',\n );\n renderer.forceDepthWriteTransparentMeshes = true;\n depthMap = renderer.getDepthMap();\n depthMap.renderListPredicate = (mesh: any) => !mesh?.metadata?.editorProjectionSelectionProxy;\n depthMap.resize?.({ width, height });\n const lease: SceneDepthLease = {\n camera,\n renderer,\n depthMap,\n type,\n packed: !!renderer.isPacked,\n refs: 1,\n activeRefs: 0,\n width,\n height,\n };\n cameraLeases.set(camera, lease);\n return lease;\n } catch (cause) {\n try { renderer?.dispose?.(); } catch {}\n try { depthMap?.dispose?.(); } catch {}\n if (cameraLeases.size === 0) sceneDepthLeases.delete(scene);\n throw cause;\n }\n}\n\nfunction activateSceneDepthLease(scene: RuntimeScene, lease: SceneDepthLease): void {\n if (lease.activeRefs === 0) addCustomRenderTarget(scene, lease.depthMap);\n lease.activeRefs += 1;\n}\n\nfunction deactivateSceneDepthLease(scene: RuntimeScene, lease: SceneDepthLease): void {\n if (lease.activeRefs <= 0) return;\n if (lease.activeRefs === 1) removeCustomRenderTarget(scene, lease.depthMap);\n lease.activeRefs -= 1;\n}\n\nfunction resizeSceneDepthLease(lease: SceneDepthLease, width: number, height: number): void {\n if (lease.width === width && lease.height === height) return;\n lease.depthMap.resize?.({ width, height });\n lease.width = width;\n lease.height = height;\n}\n\nfunction releaseSceneDepthLease(\n scene: RuntimeScene,\n lease: SceneDepthLease,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n): void {\n lease.refs = Math.max(0, lease.refs - 1);\n if (lease.refs > 0) return;\n lease.activeRefs = 0;\n try {\n removeCustomRenderTarget(scene, lease.depthMap);\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The owned scene depth target could not be detached cleanly.',\n cause,\n });\n }\n const cameraLeases = sceneDepthLeases.get(scene);\n cameraLeases?.delete(lease.camera);\n if (cameraLeases?.size === 0) sceneDepthLeases.delete(scene);\n try {\n lease.renderer.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'A leased scene depth resource could not be disposed cleanly.',\n cause,\n });\n }\n try {\n lease.depthMap.dispose?.();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'The owned scene depth target could not be disposed cleanly.',\n cause,\n });\n }\n}\n\nfunction addCustomRenderTarget(scene: RuntimeScene, target: any): void {\n if (!target) return;\n scene.customRenderTargets = Array.isArray(scene.customRenderTargets) ? scene.customRenderTargets : [];\n if (!scene.customRenderTargets.includes(target)) scene.customRenderTargets.push(target);\n}\n\nfunction removeCustomRenderTarget(scene: RuntimeScene, target: any): void {\n if (!target || !Array.isArray(scene.customRenderTargets)) return;\n const index = scene.customRenderTargets.indexOf(target);\n if (index >= 0) scene.customRenderTargets.splice(index, 1);\n}\n\nfunction findCameraPostProcessIndex(camera: RuntimeCamera, postProcess: any): number {\n return Array.isArray(camera?._postProcesses)\n ? camera._postProcesses.indexOf(postProcess)\n : -1;\n}\n\nfunction getCameraSelectionPostProcessSlotRegistry(\n camera: RuntimeCamera,\n): CameraSelectionPostProcessSlotRegistry {\n let registry = cameraSelectionPostProcessSlots.get(camera);\n if (!registry) {\n registry = { owners: new Map(), releasedSlots: new Map() };\n cameraSelectionPostProcessSlots.set(camera, registry);\n }\n return registry;\n}\n\nfunction cameraPostProcessTopologyMatches(\n slots: readonly any[],\n topology: readonly any[] | null,\n): boolean {\n return topology != null\n && slots.length === topology.length\n && slots.every((slot, index) => slot === topology[index]);\n}\n\nfunction reserveOwnedCameraPostProcessSlot(\n camera: RuntimeCamera,\n owner: object,\n insertIndex: number | null,\n topologyBeforeDetach: readonly any[] | null,\n): void {\n const slots = camera?._postProcesses;\n const registry = cameraSelectionPostProcessSlots.get(camera);\n const ownedSlot = registry?.owners.get(owner);\n if (!Array.isArray(slots) || !registry || !ownedSlot) return;\n const reservedIndex = insertIndex ?? ownedSlot.index;\n if (reservedIndex != null && reservedIndex < slots.length && slots[reservedIndex] === null) {\n ownedSlot.index = reservedIndex;\n ownedSlot.vacantTopology = slots.slice();\n } else {\n ownedSlot.index = null;\n ownedSlot.vacantTopology = null;\n }\n refreshProvenVacantCameraPostProcessTopologies(\n registry,\n slots,\n topologyBeforeDetach,\n owner,\n );\n}\n\nfunction refreshProvenVacantCameraPostProcessTopologies(\n registry: CameraSelectionPostProcessSlotRegistry,\n slots: readonly any[],\n topologyBeforeMutation: readonly any[] | null,\n excludedOwner: object | null = null,\n): void {\n if (!topologyBeforeMutation) return;\n const nextTopology = slots.slice();\n for (const [owner, slot] of registry.owners) {\n if (\n owner !== excludedOwner\n && slot.index != null\n && slot.index < slots.length\n && slots[slot.index] === null\n && cameraPostProcessTopologyMatches(topologyBeforeMutation, slot.vacantTopology)\n ) {\n slot.vacantTopology = nextTopology;\n }\n }\n for (const [releasedIndex, topology] of registry.releasedSlots) {\n if (\n releasedIndex < slots.length\n && slots[releasedIndex] === null\n && cameraPostProcessTopologyMatches(topologyBeforeMutation, topology)\n ) {\n registry.releasedSlots.set(releasedIndex, nextTopology);\n }\n }\n}\n\nfunction attachOwnedCameraPostProcess(\n camera: RuntimeCamera,\n owner: object,\n postProcess: any,\n): number {\n const registry = getCameraSelectionPostProcessSlotRegistry(camera);\n const slots = camera?._postProcesses;\n const topologyBeforeAttach = Array.isArray(slots) ? slots.slice() : null;\n const ownedSlot = registry.owners.get(owner);\n let reusableIndex: number | null = null;\n if (\n Array.isArray(slots)\n && ownedSlot != null\n && ownedSlot.postProcess === postProcess\n && ownedSlot.index != null\n && ownedSlot.index < slots.length\n && slots[ownedSlot.index] === null\n && cameraPostProcessTopologyMatches(slots, ownedSlot.vacantTopology)\n ) {\n reusableIndex = ownedSlot.index;\n } else if (Array.isArray(slots)) {\n if (ownedSlot) {\n ownedSlot.index = null;\n ownedSlot.vacantTopology = null;\n }\n for (const [releasedIndex, topology] of [...registry.releasedSlots.entries()]\n .sort(([left], [right]) => left - right)) {\n if (\n releasedIndex >= slots.length\n || slots[releasedIndex] !== null\n || !cameraPostProcessTopologyMatches(slots, topology)\n ) {\n registry.releasedSlots.delete(releasedIndex);\n continue;\n }\n reusableIndex = releasedIndex;\n break;\n }\n }\n\n try {\n const attachedIndex = camera.attachPostProcess?.(postProcess, reusableIndex);\n const actualIndex = Number.isInteger(attachedIndex) && attachedIndex >= 0\n ? attachedIndex\n : findCameraPostProcessIndex(camera, postProcess);\n if (actualIndex < 0) {\n throw new Error('The selection silhouette post-process was not attached to the active camera.');\n }\n registry.owners.set(owner, { index: actualIndex, postProcess, vacantTopology: null });\n registry.releasedSlots.delete(actualIndex);\n if (Array.isArray(slots)) {\n refreshProvenVacantCameraPostProcessTopologies(\n registry,\n slots,\n topologyBeforeAttach,\n owner,\n );\n }\n return actualIndex;\n } catch (cause) {\n forceDetachCameraPostProcess(camera, postProcess);\n throw cause;\n }\n}\n\nfunction forceDetachCameraPostProcess(camera: RuntimeCamera, postProcess: any): boolean {\n const slots = camera?._postProcesses;\n if (!Array.isArray(slots)) return false;\n const liveIndex = slots.indexOf(postProcess);\n if (liveIndex >= 0) slots[liveIndex] = null;\n return slots.indexOf(postProcess) < 0;\n}\n\nfunction releaseOwnedCameraPostProcessSlot(\n camera: RuntimeCamera | null,\n owner: object,\n insertIndex: number | null,\n postProcess: any,\n): void {\n const slots = camera?._postProcesses;\n if (!camera || !Array.isArray(slots)) return;\n const registry = cameraSelectionPostProcessSlots.get(camera);\n const ownedSlot = registry?.owners.get(owner);\n const liveIndex = slots.indexOf(postProcess);\n let releasedIndex: number | null = null;\n if (liveIndex >= 0) {\n slots[liveIndex] = null;\n releasedIndex = liveIndex;\n } else if (insertIndex != null && slots[insertIndex] === postProcess) {\n slots[insertIndex] = null;\n releasedIndex = insertIndex;\n } else if (\n ownedSlot?.index != null\n && ownedSlot.index < slots.length\n && slots[ownedSlot.index] === null\n && cameraPostProcessTopologyMatches(slots, ownedSlot.vacantTopology)\n ) {\n releasedIndex = ownedSlot.index;\n }\n registry?.owners.delete(owner);\n const topologyBeforeTrim = slots.slice();\n\n // Babylon uses null placeholders for detached passes. A released selection-owned hole may\n // be reclaimed by a successor controller; only trailing placeholders are removed here so\n // live passes never shift. Reserved inactive owners trimmed from the tail append on reattach.\n while (slots.length > 0 && slots[slots.length - 1] == null) slots.pop();\n if (!registry) return;\n refreshProvenVacantCameraPostProcessTopologies(registry, slots, topologyBeforeTrim);\n for (const slot of registry.owners.values()) {\n if (slot.index != null && slot.index >= slots.length) {\n slot.index = null;\n slot.vacantTopology = null;\n }\n }\n for (const released of [...registry.releasedSlots.keys()]) {\n if (released >= slots.length) {\n registry.releasedSlots.delete(released);\n }\n }\n if (releasedIndex != null && releasedIndex < slots.length && slots[releasedIndex] === null) {\n registry.releasedSlots.set(releasedIndex, slots.slice());\n }\n if (registry.owners.size === 0 && registry.releasedSlots.size === 0) {\n cameraSelectionPostProcessSlots.delete(camera);\n }\n}\n\nfunction safelyDisposeBackend(\n backend: BabylonEditorSelectionPresentationBackend,\n reportDiagnostic: (diagnostic: BabylonEditorSelectionPresentationDiagnostic) => void,\n): void {\n try {\n backend.dispose();\n } catch (cause) {\n reportDiagnostic({\n code: 'resource-dispose-failed',\n message: 'Selection silhouette resources could not be disposed cleanly.',\n cause,\n });\n }\n}\n"]}
|