@fps-games/editor 0.1.4-beta.5 → 0.1.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +16 -16
- package/dist/local-editor-harness.d.ts +24 -5
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +456 -90
- package/dist/local-editor-harness.js.map +1 -1
- package/dist/local-editor-performance-stats.d.ts +12 -0
- package/dist/local-editor-performance-stats.d.ts.map +1 -0
- package/dist/local-editor-performance-stats.js +46 -0
- package/dist/local-editor-performance-stats.js.map +1 -0
- package/dist/playable-babylon-facade.d.ts +2 -2
- package/dist/playable-babylon-facade.d.ts.map +1 -1
- package/dist/playable-babylon-facade.js +1 -1
- package/dist/playable-babylon-facade.js.map +1 -1
- package/dist/playable-babylon-rendering.d.ts +57 -12
- package/dist/playable-babylon-rendering.d.ts.map +1 -1
- package/dist/playable-babylon-rendering.js +529 -20
- package/dist/playable-babylon-rendering.js.map +1 -1
- package/dist/playable-local-editor-host.d.ts +10 -9
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js.map +1 -1
- package/dist/playable-sdk.d.ts +5 -3
- package/dist/playable-sdk.d.ts.map +1 -1
- package/dist/playable-sdk.js +3 -2
- package/dist/playable-sdk.js.map +1 -1
- package/dist/static-shadow-cpu-worker.d.ts +7 -0
- package/dist/static-shadow-cpu-worker.d.ts.map +1 -0
- package/dist/static-shadow-cpu-worker.js +221 -0
- package/dist/static-shadow-cpu-worker.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/index.d.ts +3 -1
- package/node_modules/@fps-games/babylon-renderer/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/index.js +3 -1
- package/node_modules/@fps-games/babylon-renderer/dist/index.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.d.ts +4 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.d.ts.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.js +584 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-atlas.d.ts +61 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-atlas.d.ts.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-atlas.js +382 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-atlas.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-bake.d.ts +47 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-bake.d.ts.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-bake.js +285 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-bake.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.d.ts +88 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.d.ts.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.js +813 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-rendering.d.ts +27 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-rendering.d.ts.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-rendering.js +220 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-rendering.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-system.d.ts +35 -3
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-system.js +65 -609
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.d.ts +169 -14
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.js +9 -3
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/index.d.ts +2 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/index.js +2 -0
- package/node_modules/@fps-games/editor-babylon/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/performance-monitor.d.ts +34 -0
- package/node_modules/@fps-games/editor-babylon/dist/performance-monitor.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/performance-monitor.js +272 -0
- package/node_modules/@fps-games/editor-babylon/dist/performance-monitor.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +6 -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 +65 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/rendering.d.ts +19 -0
- package/node_modules/@fps-games/editor-babylon/dist/rendering.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/rendering.js +66 -0
- package/node_modules/@fps-games/editor-babylon/dist/rendering.js.map +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.d.ts +5 -2
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.js +65 -32
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-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 +19 -2
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +5 -5
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +1 -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.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-rendering-actions.d.ts +8 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-rendering-actions.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-rendering-actions.js +14 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-rendering-actions.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.js +10 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js +17 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js.map +1 -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 +466 -42
- 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 +70 -5
- 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.d.ts +1 -1
- 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 +595 -5
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +3 -3
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts +14 -1
- 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 +34 -10
- package/node_modules/@fps-games/editor-core/dist/editor-session.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/inspector.d.ts +2 -1
- package/node_modules/@fps-games/editor-core/dist/inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/inspector.js +11 -1
- package/node_modules/@fps-games/editor-core/dist/inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/serialized-object.d.ts +7 -0
- package/node_modules/@fps-games/editor-core/dist/serialized-object.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/serialized-object.js +1 -0
- package/node_modules/@fps-games/editor-core/dist/serialized-object.js.map +1 -1
- package/node_modules/@fps-games/editor-core/package.json +2 -2
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.js +10 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.js +3 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts +4 -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 +29 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/types.d.ts +10 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.d.ts +33 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.js +232 -16
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.d.ts +12 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js +153 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/index.d.ts +4 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/index.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.js +4 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/rendering-alpha-index.d.ts +19 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/rendering-alpha-index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/rendering-alpha-index.js +57 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/rendering-alpha-index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/types.d.ts +7 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js +620 -36
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/profile.d.ts +8 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/profile.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/profile.js +258 -10
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/profile.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/types.d.ts +110 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js +25 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/types.d.ts +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/types.d.ts.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 +4 -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/companion-configs.d.ts +9 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/companion-configs.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/companion-configs.js +12 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/companion-configs.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts +2 -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/serialized-property/descriptors.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js +75 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/index.js +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.d.ts +17 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.js +262 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/object.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/object.js +7 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/object.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/identity.d.ts +6 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/identity.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/identity.js +31 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/identity.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/index.d.ts +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/patches.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/patches.js +21 -9
- package/node_modules/@fps-games/editor-playable-sdk/dist/session/patches.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.d.ts +151 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.js +445 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/index.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/index.js +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/package.json +3 -3
- package/node_modules/@fps-games/editor-protocol/package.json +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { applyEditorSceneRenderingProfilePatch, createEditorSceneBlobShadowPreviewSettings, createEditorScenePlanarShadowPreviewSettings, createEditorSceneRenderingPanelState, createEditorSceneStaticProjectedShadowPreviewSettings, normalizeEditorSceneRenderingProfile, } from '@fps-games/editor-playable-sdk';
|
|
2
|
-
import { createBabylonDefaultPostProcessPipelineController, createBabylonEnvironmentTextureController, createBlobShadowSystem, createPlanarShadowSystem,
|
|
1
|
+
import { applyEditorSceneRenderingProfileAction, applyEditorSceneRenderingProfilePatch, createEditorSceneBlobShadowPreviewSettings, createEditorScenePlanarShadowPreviewSettings, createEditorSceneRenderingPanelState, createEditorSceneStaticShadowArtifactDiagnostic, createEditorSceneStaticProjectedShadowPreviewSettings, normalizeEditorSceneRenderingProfile, } from '@fps-games/editor-playable-sdk';
|
|
2
|
+
import { createBabylonDefaultPostProcessPipelineController, createBabylonEnvironmentTextureController, createBlobShadowSystem, createPlanarShadowSystem, createStaticProjectedShadowBaker, createStaticProjectedShadowArtifactSystem, createStaticProjectedShadowBakeHashes, createStaticProjectedShadowProfileHash, resolveBabylonDefaultPostProcessVolumeStack, } from '@fps-games/babylon-renderer';
|
|
3
|
+
import { createStaticProjectedShadowCpuWorkerProcessor } from './static-shadow-cpu-worker.js';
|
|
3
4
|
const PLAYABLE_BABYLON_RENDERING_ALLOWED_SECTIONS = new Set([
|
|
5
|
+
'rendering-groups',
|
|
4
6
|
'environment',
|
|
5
7
|
'post-process',
|
|
6
8
|
'shadows',
|
|
@@ -11,8 +13,8 @@ export function createPlayableBabylonRenderingCapability(options) {
|
|
|
11
13
|
getWorldRendering(document) {
|
|
12
14
|
return createPlayableBabylonWorldRendering(document, options);
|
|
13
15
|
},
|
|
14
|
-
getRenderingPanelState(document) {
|
|
15
|
-
return createPlayableBabylonRenderingPanelState(document, options);
|
|
16
|
+
getRenderingPanelState(document, sceneContext) {
|
|
17
|
+
return createPlayableBabylonRenderingPanelState(document, options, sceneContext);
|
|
16
18
|
},
|
|
17
19
|
async onRenderingAction(input) {
|
|
18
20
|
return handlePlayableBabylonRenderingAction(input, options);
|
|
@@ -22,20 +24,20 @@ export function createPlayableBabylonRenderingCapability(options) {
|
|
|
22
24
|
},
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
|
-
export function createPlayableBabylonWorldRendering(document, options) {
|
|
27
|
+
export function createPlayableBabylonWorldRendering(document, options, sceneContext = {}) {
|
|
26
28
|
const context = createPlayableBabylonRenderingContext(document, options);
|
|
27
29
|
const postProcess = resolvePlayableBabylonRenderingPostProcess(context, options);
|
|
28
30
|
return {
|
|
29
31
|
environment: createPlayableBabylonEnvironmentTextureProfile(context.profile, options.getTextureAssets?.({ document }) ?? []),
|
|
30
32
|
postProcess: postProcess.profile,
|
|
31
|
-
shadowPreview: createPlayableBabylonShadowPreviewOptions(context, options),
|
|
33
|
+
shadowPreview: createPlayableBabylonShadowPreviewOptions(context, options, sceneContext),
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
|
-
export function createPlayableBabylonRenderingDiagnostics(document, options) {
|
|
36
|
+
export function createPlayableBabylonRenderingDiagnostics(document, options, sceneContext = {}) {
|
|
35
37
|
const context = createPlayableBabylonRenderingContext(document, options);
|
|
36
38
|
const textureAssets = options.getTextureAssets?.({ document }) ?? [];
|
|
37
39
|
const postProcess = resolvePlayableBabylonRenderingPostProcess(context, options);
|
|
38
|
-
const shadowPreview = createPlayableBabylonShadowPreviewOptions(context, options);
|
|
40
|
+
const shadowPreview = createPlayableBabylonShadowPreviewOptions(context, options, sceneContext);
|
|
39
41
|
return {
|
|
40
42
|
config: context.config,
|
|
41
43
|
profile: context.profile,
|
|
@@ -45,6 +47,7 @@ export function createPlayableBabylonRenderingDiagnostics(document, options) {
|
|
|
45
47
|
shadowPreview,
|
|
46
48
|
},
|
|
47
49
|
environmentTexture: resolvePlayableBabylonRenderingEnvironmentTextureDiagnostic(context.profile.environment.texture, textureAssets),
|
|
50
|
+
staticShadowArtifact: createPlayableBabylonStaticShadowArtifactDiagnostic(context, options, sceneContext),
|
|
48
51
|
postProcess,
|
|
49
52
|
shadowPreview,
|
|
50
53
|
};
|
|
@@ -137,31 +140,179 @@ export function createPlayableBabylonBlobShadowOptions(profile, input = {}) {
|
|
|
137
140
|
export function createPlayableBabylonStaticProjectedShadowOptions(profile, input = {}) {
|
|
138
141
|
const includeProfileShadowMeshes = input.includeProfileShadowMeshes !== false;
|
|
139
142
|
const shadowMeshes = profile.shadowMeshes;
|
|
140
|
-
return
|
|
141
|
-
...
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
return {
|
|
144
|
+
...createEditorSceneStaticProjectedShadowPreviewSettings(profile, {
|
|
145
|
+
...input,
|
|
146
|
+
additionalCasterIncludePatterns: mergePlayableBabylonPlanarShadowPatterns(...(includeProfileShadowMeshes ? shadowMeshes.shadowCasters : []), ...(input.additionalCasterIncludePatterns ?? [])),
|
|
147
|
+
additionalExcludePatterns: mergePlayableBabylonPlanarShadowPatterns(...(includeProfileShadowMeshes ? shadowMeshes.excludeFromShadow : []), ...(input.additionalExcludePatterns ?? [])),
|
|
148
|
+
additionalRootBoundaryPatterns: mergePlayableBabylonPlanarShadowPatterns(...(input.additionalRootBoundaryPatterns ?? [])),
|
|
149
|
+
}),
|
|
150
|
+
...(input.artifact === undefined ? {} : { artifact: input.artifact }),
|
|
151
|
+
...(input.expectedHashes === undefined ? {} : { expectedHashes: input.expectedHashes }),
|
|
152
|
+
};
|
|
146
153
|
}
|
|
147
|
-
export function
|
|
148
|
-
|
|
154
|
+
export function createPlayableBabylonStaticProjectedShadowArtifactSystem(scene, directionalLight, profile, input = {}) {
|
|
155
|
+
const staticProjected = createPlayableBabylonStaticProjectedShadowOptions(profile, input);
|
|
156
|
+
const expectedHashes = staticProjected.expectedHashes ?? createStaticProjectedShadowBakeHashes({
|
|
157
|
+
scene: scene,
|
|
158
|
+
directionalLight: directionalLight,
|
|
159
|
+
options: staticProjected,
|
|
160
|
+
});
|
|
161
|
+
return createStaticProjectedShadowArtifactSystem(scene, staticProjected.artifact ?? null, {
|
|
162
|
+
enabled: staticProjected.enabled,
|
|
163
|
+
appearance: staticProjected.appearance,
|
|
164
|
+
bake: {
|
|
165
|
+
blur: staticProjected.bake?.blur,
|
|
166
|
+
},
|
|
167
|
+
expectedHashes,
|
|
168
|
+
debug: staticProjected.debug,
|
|
169
|
+
});
|
|
149
170
|
}
|
|
150
171
|
export function createPlayableBabylonBlobShadowSystem(scene, profile, input = {}) {
|
|
151
172
|
return createBlobShadowSystem(scene, createPlayableBabylonBlobShadowOptions(profile, input));
|
|
152
173
|
}
|
|
153
|
-
export function createPlayableBabylonRenderingPanelState(document, options) {
|
|
174
|
+
export function createPlayableBabylonRenderingPanelState(document, options, sceneContext = {}) {
|
|
154
175
|
const context = createPlayableBabylonRenderingContext(document, options);
|
|
155
176
|
const baseState = options.getPanelState?.({ document }) ?? {};
|
|
156
177
|
const dirty = baseState.dirty ?? options.isDirty?.({ document });
|
|
178
|
+
const language = options.getLanguage?.({ document }) ?? 'en';
|
|
179
|
+
const renderingAction = readPlayableBabylonRenderingActionProgress(sceneContext.renderingAction);
|
|
180
|
+
const staticShadowBake = renderingAction?.actionId === 'bake-static-shadows'
|
|
181
|
+
? createPlayableBabylonBakingStaticShadowLifecycleState(renderingAction, language)
|
|
182
|
+
: baseState.staticShadowBake
|
|
183
|
+
?? createPlayableBabylonStaticShadowBakeLifecycleState(context, options, dirty === true, sceneContext);
|
|
157
184
|
return createEditorSceneRenderingPanelState(context.profile, {
|
|
158
185
|
...baseState,
|
|
159
186
|
...(dirty === undefined ? {} : { dirty }),
|
|
187
|
+
staticShadowBake,
|
|
160
188
|
}, {
|
|
161
|
-
language
|
|
189
|
+
language,
|
|
162
190
|
textureAssets: options.getTextureAssets?.({ document }) ?? [],
|
|
163
191
|
});
|
|
164
192
|
}
|
|
193
|
+
function createPlayableBabylonBakingStaticShadowLifecycleState(progress, language) {
|
|
194
|
+
const stats = readStaticShadowBakeStats(progress.details);
|
|
195
|
+
const label = progress.label
|
|
196
|
+
?? (language === 'zh' ? '正在烘焙静态阴影' : 'Baking static shadows');
|
|
197
|
+
return {
|
|
198
|
+
status: 'baking',
|
|
199
|
+
chunkCount: stats?.chunkCount ?? 0,
|
|
200
|
+
reason: progress.status ?? label,
|
|
201
|
+
stats,
|
|
202
|
+
progress: {
|
|
203
|
+
label,
|
|
204
|
+
...(typeof progress.value === 'number' && Number.isFinite(progress.value)
|
|
205
|
+
? { value: Math.max(0, Math.min(1, progress.value)) }
|
|
206
|
+
: {}),
|
|
207
|
+
indeterminate: progress.indeterminate !== false && typeof progress.value !== 'number',
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function createPlayableBabylonStaticShadowBakeLifecycleState(context, options, dirty, sceneContext) {
|
|
212
|
+
const staticOptions = createPlayableBabylonStaticProjectedShadowOptions(context.profile, (resolvePlayableBabylonRenderingValue(options.shadowPreview === false ? undefined : options.shadowPreview?.staticProjected, context) ?? {}));
|
|
213
|
+
if (!staticOptions.enabled) {
|
|
214
|
+
return {
|
|
215
|
+
status: 'disabled',
|
|
216
|
+
chunkCount: 0,
|
|
217
|
+
reason: 'Static Baked Shadow is disabled.',
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const artifact = options.getStaticShadowArtifact?.({ document: context.document }) ?? null;
|
|
221
|
+
if (!artifact) {
|
|
222
|
+
return {
|
|
223
|
+
status: 'missing',
|
|
224
|
+
chunkCount: 0,
|
|
225
|
+
reason: 'No static shadow bake artifact is available.',
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
const diagnostic = createEditorSceneStaticShadowArtifactDiagnostic(artifact, createPlayableBabylonStaticShadowExpectedHashes(context, options, staticOptions, sceneContext));
|
|
229
|
+
if (diagnostic.status === 'invalid') {
|
|
230
|
+
return {
|
|
231
|
+
status: 'invalid',
|
|
232
|
+
chunkCount: 0,
|
|
233
|
+
reason: diagnostic.reason,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (diagnostic.status === 'out-of-date') {
|
|
237
|
+
return {
|
|
238
|
+
status: 'out-of-date',
|
|
239
|
+
chunkCount: diagnostic.chunkCount,
|
|
240
|
+
reason: diagnostic.reason,
|
|
241
|
+
generatedAt: artifact.generatedAt ?? null,
|
|
242
|
+
stats: createEditorSceneStaticShadowBakeStatsFromArtifact(artifact),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
if (dirty) {
|
|
246
|
+
return {
|
|
247
|
+
status: 'preview-unsaved',
|
|
248
|
+
chunkCount: diagnostic.chunkCount,
|
|
249
|
+
reason: 'Static shadow preview has not been saved yet.',
|
|
250
|
+
generatedAt: artifact.generatedAt ?? null,
|
|
251
|
+
stats: createEditorSceneStaticShadowBakeStatsFromArtifact(artifact),
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
status: 'up-to-date',
|
|
256
|
+
chunkCount: diagnostic.chunkCount,
|
|
257
|
+
reason: null,
|
|
258
|
+
generatedAt: artifact.generatedAt ?? null,
|
|
259
|
+
stats: createEditorSceneStaticShadowBakeStatsFromArtifact(artifact),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function createEditorSceneStaticShadowBakeStatsFromArtifact(artifact) {
|
|
263
|
+
const isV2 = artifact.version === 2;
|
|
264
|
+
const pageCount = isV2 ? artifact.pages.length : undefined;
|
|
265
|
+
return {
|
|
266
|
+
sourceRootCount: artifact.stats?.sourceRootCount ?? uniqueStaticShadowSourceNodeIds(artifact).length,
|
|
267
|
+
sourceMeshCount: artifact.stats?.sourceMeshCount,
|
|
268
|
+
attemptedChunkCount: artifact.stats?.attemptedChunkCount ?? artifact.chunks.length,
|
|
269
|
+
chunkCount: artifact.stats?.chunkCount ?? artifact.chunks.length,
|
|
270
|
+
textureCount: artifact.stats?.textureCount ?? pageCount ?? artifact.chunks.length,
|
|
271
|
+
skippedChunkCount: artifact.stats?.skippedChunkCount,
|
|
272
|
+
pageCount: artifact.stats?.pageCount ?? pageCount,
|
|
273
|
+
resolution: artifact.stats?.resolution,
|
|
274
|
+
chunkSize: artifact.stats?.chunkSize,
|
|
275
|
+
atlasSize: artifact.stats?.atlasSize,
|
|
276
|
+
atlasUsedPixels: artifact.stats?.atlasUsedPixels,
|
|
277
|
+
atlasAllocatedPixels: artifact.stats?.atlasAllocatedPixels,
|
|
278
|
+
atlasOccupancy: artifact.stats?.atlasOccupancy,
|
|
279
|
+
texelsPerMeter: artifact.stats?.texelsPerMeter,
|
|
280
|
+
effectiveTexelsPerMeter: artifact.stats?.effectiveTexelsPerMeter,
|
|
281
|
+
maxAtlasPages: artifact.stats?.maxAtlasPages,
|
|
282
|
+
sdfRadiusPx: artifact.stats?.sdfRadiusPx,
|
|
283
|
+
spatialChunkSize: artifact.stats?.spatialChunkSize,
|
|
284
|
+
effectiveSpatialChunkSize: artifact.stats?.effectiveSpatialChunkSize,
|
|
285
|
+
targetChunkCount: artifact.stats?.targetChunkCount,
|
|
286
|
+
bakedChunkCount: artifact.stats?.bakedChunkCount,
|
|
287
|
+
reusedChunkCount: artifact.stats?.reusedChunkCount,
|
|
288
|
+
durationMs: artifact.stats?.durationMs,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function uniqueStaticShadowSourceNodeIds(artifact) {
|
|
292
|
+
return [...new Set(artifact.chunks.flatMap(chunk => chunk.sourceNodeIds))];
|
|
293
|
+
}
|
|
294
|
+
function createPlayableBabylonStaticShadowArtifactDiagnostic(context, options, sceneContext) {
|
|
295
|
+
const artifact = options.getStaticShadowArtifact?.({ document: context.document }) ?? null;
|
|
296
|
+
const staticOptions = createPlayableBabylonStaticProjectedShadowOptions(context.profile, (resolvePlayableBabylonRenderingValue(options.shadowPreview === false ? undefined : options.shadowPreview?.staticProjected, context) ?? {}));
|
|
297
|
+
return createEditorSceneStaticShadowArtifactDiagnostic(artifact, createPlayableBabylonStaticShadowExpectedHashes(context, options, staticOptions, sceneContext));
|
|
298
|
+
}
|
|
299
|
+
function createPlayableBabylonStaticShadowExpectedHashes(context, options, staticOptions, sceneContext) {
|
|
300
|
+
if (staticOptions.expectedHashes)
|
|
301
|
+
return staticOptions.expectedHashes;
|
|
302
|
+
const scene = readBabylonScene(sceneContext.scene);
|
|
303
|
+
const shadowPreview = options.shadowPreview === false ? {} : options.shadowPreview ?? {};
|
|
304
|
+
const directionalLightNodeId = resolvePlayableBabylonRenderingValue(shadowPreview.directionalLightNodeId, context);
|
|
305
|
+
if (scene) {
|
|
306
|
+
return createStaticProjectedShadowBakeHashes({
|
|
307
|
+
scene,
|
|
308
|
+
directionalLight: resolveBabylonDirectionalLight(sceneContext.projection, directionalLightNodeId ?? null),
|
|
309
|
+
options: staticOptions,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
profileHash: createStaticProjectedShadowProfileHash(staticOptions),
|
|
314
|
+
};
|
|
315
|
+
}
|
|
165
316
|
export function createPlayableBabylonEnvironmentTextureProfile(profile, textureAssets = []) {
|
|
166
317
|
return {
|
|
167
318
|
textureUrl: resolvePlayableBabylonRenderingEnvironmentTextureUrl(profile.environment.texture, textureAssets),
|
|
@@ -282,13 +433,16 @@ function createPlayableBabylonRenderingContext(document, options) {
|
|
|
282
433
|
function resolvePlayableBabylonRenderingPostProcess(context, options) {
|
|
283
434
|
return resolveBabylonDefaultPostProcessVolumeStack(context.config, options.getPostProcessResolveInput?.(context));
|
|
284
435
|
}
|
|
285
|
-
function createPlayableBabylonShadowPreviewOptions(context, options) {
|
|
436
|
+
function createPlayableBabylonShadowPreviewOptions(context, options, sceneContext = {}) {
|
|
286
437
|
if (options.shadowPreview === false)
|
|
287
438
|
return null;
|
|
288
439
|
const shadowPreview = options.shadowPreview ?? {};
|
|
289
440
|
const blobInput = resolvePlayableBabylonRenderingValue(shadowPreview.blob, context) ?? {};
|
|
290
441
|
const staticInput = resolvePlayableBabylonRenderingValue(shadowPreview.staticProjected, context) ?? {};
|
|
291
442
|
const planarInput = resolvePlayableBabylonRenderingValue(shadowPreview.planar, context) ?? {};
|
|
443
|
+
const staticArtifact = staticInput.artifact === undefined
|
|
444
|
+
? options.getStaticShadowArtifact?.({ document: context.document }) ?? null
|
|
445
|
+
: staticInput.artifact;
|
|
292
446
|
const enabled = resolvePlayableBabylonRenderingValue(shadowPreview.enabled, context);
|
|
293
447
|
const directionalLightNodeId = resolvePlayableBabylonRenderingValue(shadowPreview.directionalLightNodeId, context);
|
|
294
448
|
const planarPreview = createPlayableBabylonPlanarShadowPreviewOptions(context.profile, {
|
|
@@ -302,18 +456,29 @@ function createPlayableBabylonShadowPreviewOptions(context, options) {
|
|
|
302
456
|
});
|
|
303
457
|
const staticPreview = createPlayableBabylonStaticProjectedShadowOptions(context.profile, {
|
|
304
458
|
...staticInput,
|
|
459
|
+
artifact: staticArtifact,
|
|
305
460
|
...(enabled === undefined ? {} : { enabled }),
|
|
306
461
|
});
|
|
462
|
+
const expectedHashes = createPlayableBabylonStaticShadowExpectedHashes(context, options, staticPreview, sceneContext);
|
|
463
|
+
const filteredStaticArtifact = resolvePlayableBabylonStaticShadowArtifactForExpectedHashes(staticPreview.artifact ?? null, expectedHashes);
|
|
307
464
|
return {
|
|
308
465
|
defaultMode: context.profile.shadows.defaultMode,
|
|
309
466
|
blob: blobPreview,
|
|
310
467
|
staticProjected: {
|
|
311
468
|
...staticPreview,
|
|
469
|
+
artifact: filteredStaticArtifact,
|
|
470
|
+
...(readBabylonScene(sceneContext.scene) ? { expectedHashes } : {}),
|
|
312
471
|
...(directionalLightNodeId === undefined ? {} : { directionalLightNodeId }),
|
|
313
472
|
},
|
|
314
473
|
planar: planarPreview.planar ?? null,
|
|
315
474
|
};
|
|
316
475
|
}
|
|
476
|
+
function resolvePlayableBabylonStaticShadowArtifactForExpectedHashes(artifact, expectedHashes) {
|
|
477
|
+
if (!artifact)
|
|
478
|
+
return null;
|
|
479
|
+
const diagnostic = createEditorSceneStaticShadowArtifactDiagnostic(artifact, expectedHashes);
|
|
480
|
+
return diagnostic.status === 'up-to-date' ? artifact : null;
|
|
481
|
+
}
|
|
317
482
|
async function handlePlayableBabylonRenderingPropertyChange(input, options) {
|
|
318
483
|
const sectionId = typeof input.sectionId === 'string' ? input.sectionId : '';
|
|
319
484
|
if (!PLAYABLE_BABYLON_RENDERING_ALLOWED_SECTIONS.has(sectionId)) {
|
|
@@ -333,21 +498,54 @@ async function handlePlayableBabylonRenderingPropertyChange(input, options) {
|
|
|
333
498
|
statusTone: 'warning',
|
|
334
499
|
});
|
|
335
500
|
}
|
|
336
|
-
await options.setConfig({
|
|
501
|
+
const setConfigResult = await options.setConfig({
|
|
337
502
|
document: input.document,
|
|
338
503
|
config: patch.config,
|
|
339
504
|
changedPaths: patch.changedPaths,
|
|
340
505
|
profile: patch.normalized,
|
|
506
|
+
change: {
|
|
507
|
+
path,
|
|
508
|
+
value: input.value,
|
|
509
|
+
},
|
|
341
510
|
});
|
|
342
511
|
const dirty = options.isDirty?.({ document: input.document });
|
|
343
512
|
return createPlayableBabylonRenderingResult(true, {
|
|
344
513
|
dirty,
|
|
345
514
|
status: `Rendering draft updated: ${patch.changedPaths.join(', ')}`,
|
|
346
515
|
statusTone: dirty === false ? 'success' : 'warning',
|
|
516
|
+
documentPatch: readPlayableBabylonRenderingDocumentPatch(setConfigResult),
|
|
347
517
|
});
|
|
348
518
|
}
|
|
349
519
|
async function handlePlayableBabylonRenderingAction(input, options) {
|
|
350
520
|
const actionId = typeof input.actionId === 'string' ? input.actionId : '';
|
|
521
|
+
if (actionId === 'bake-static-shadows') {
|
|
522
|
+
return bakePlayableBabylonStaticShadows(input, options);
|
|
523
|
+
}
|
|
524
|
+
if (actionId === 'rendering-alpha-preset.add' || actionId === 'rendering-alpha-preset.delete') {
|
|
525
|
+
const actionInput = createPlayableBabylonRenderingProfileActionInput(actionId, input);
|
|
526
|
+
const currentConfig = options.getConfig({ document: input.document });
|
|
527
|
+
const patch = applyEditorSceneRenderingProfileAction(currentConfig, actionInput);
|
|
528
|
+
if (patch.changedPaths.length === 0) {
|
|
529
|
+
return createPlayableBabylonRenderingResult(false, {
|
|
530
|
+
status: `Unsupported rendering action: ${actionId}`,
|
|
531
|
+
statusTone: 'warning',
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
const setConfigResult = await options.setConfig({
|
|
535
|
+
document: input.document,
|
|
536
|
+
config: patch.config,
|
|
537
|
+
changedPaths: patch.changedPaths,
|
|
538
|
+
profile: patch.normalized,
|
|
539
|
+
action: actionInput,
|
|
540
|
+
});
|
|
541
|
+
const dirty = options.isDirty?.({ document: input.document });
|
|
542
|
+
return createPlayableBabylonRenderingResult(true, {
|
|
543
|
+
dirty,
|
|
544
|
+
status: `Rendering draft updated: ${patch.changedPaths.join(', ')}`,
|
|
545
|
+
statusTone: dirty === false ? 'success' : 'warning',
|
|
546
|
+
documentPatch: readPlayableBabylonRenderingDocumentPatch(setConfigResult),
|
|
547
|
+
});
|
|
548
|
+
}
|
|
351
549
|
if (actionId !== 'revert-rendering') {
|
|
352
550
|
return createPlayableBabylonRenderingResult(false, {
|
|
353
551
|
status: `Unsupported rendering action: ${actionId || '(unknown)'}`,
|
|
@@ -373,6 +571,207 @@ async function handlePlayableBabylonRenderingAction(input, options) {
|
|
|
373
571
|
statusTone: 'success',
|
|
374
572
|
});
|
|
375
573
|
}
|
|
574
|
+
async function bakePlayableBabylonStaticShadows(input, options) {
|
|
575
|
+
if (!options.setStaticShadowArtifact) {
|
|
576
|
+
return createPlayableBabylonRenderingResult(false, {
|
|
577
|
+
status: 'Static shadow artifact storage is not available for this project.',
|
|
578
|
+
statusTone: 'warning',
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
const scene = readBabylonScene(input.scene);
|
|
582
|
+
if (!scene) {
|
|
583
|
+
return createPlayableBabylonRenderingResult(false, {
|
|
584
|
+
status: 'Static shadow bake requires the active Babylon scene.',
|
|
585
|
+
statusTone: 'warning',
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
const context = createPlayableBabylonRenderingContext(input.document, options);
|
|
589
|
+
const shadowPreview = options.shadowPreview === false ? {} : options.shadowPreview ?? {};
|
|
590
|
+
const staticInput = resolvePlayableBabylonRenderingValue(shadowPreview.staticProjected, context) ?? {};
|
|
591
|
+
const directionalLightNodeId = resolvePlayableBabylonRenderingValue(shadowPreview.directionalLightNodeId, context);
|
|
592
|
+
const staticOptions = createPlayableBabylonStaticProjectedShadowOptions(context.profile, {
|
|
593
|
+
...staticInput,
|
|
594
|
+
...(staticInput.enabled === undefined ? {} : { enabled: staticInput.enabled }),
|
|
595
|
+
});
|
|
596
|
+
if (!staticOptions.enabled) {
|
|
597
|
+
return createPlayableBabylonRenderingResult(false, {
|
|
598
|
+
status: 'Static Baked Shadow is disabled.',
|
|
599
|
+
statusTone: 'warning',
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
const reportProgress = readPlayableBabylonRenderingProgressReporter(input.reportProgress);
|
|
603
|
+
const previousArtifact = options.getStaticShadowArtifact?.({ document: input.document }) ?? null;
|
|
604
|
+
const workerProcessor = options.processStaticShadowSdfTile ? null : createStaticProjectedShadowCpuWorkerProcessor();
|
|
605
|
+
let artifact;
|
|
606
|
+
try {
|
|
607
|
+
artifact = await createStaticProjectedShadowBaker({
|
|
608
|
+
scene,
|
|
609
|
+
directionalLight: resolveBabylonDirectionalLight(input.projection, directionalLightNodeId ?? null),
|
|
610
|
+
options: staticOptions,
|
|
611
|
+
previousArtifact,
|
|
612
|
+
readMaskTexturePixels: options.readStaticShadowMaskTexturePixels,
|
|
613
|
+
processSdfTile: options.processStaticShadowSdfTile ?? workerProcessor?.processSdfTile,
|
|
614
|
+
encodeAtlasTexture: options.encodeStaticShadowAtlasTexture,
|
|
615
|
+
yieldToMainThread: async (progress) => {
|
|
616
|
+
await reportProgress?.(createPlayableBabylonStaticShadowBakeProgress(progress, staticOptions));
|
|
617
|
+
},
|
|
618
|
+
onProgress: async (progress) => {
|
|
619
|
+
await reportProgress?.(createPlayableBabylonStaticShadowBakeProgress(progress, staticOptions));
|
|
620
|
+
},
|
|
621
|
+
}).bake();
|
|
622
|
+
}
|
|
623
|
+
finally {
|
|
624
|
+
workerProcessor?.dispose();
|
|
625
|
+
}
|
|
626
|
+
await reportProgress?.({
|
|
627
|
+
actionId: 'bake-static-shadows',
|
|
628
|
+
label: 'Writing static shadow artifact',
|
|
629
|
+
status: 'Writing static shadow artifact...',
|
|
630
|
+
value: 0.98,
|
|
631
|
+
indeterminate: false,
|
|
632
|
+
details: createStaticShadowArtifactStatsDetails(artifact),
|
|
633
|
+
});
|
|
634
|
+
await options.setStaticShadowArtifact({
|
|
635
|
+
document: input.document,
|
|
636
|
+
artifact,
|
|
637
|
+
profile: context.profile,
|
|
638
|
+
});
|
|
639
|
+
const statusDetails = formatStaticShadowBakeResultDetails(artifact);
|
|
640
|
+
return createPlayableBabylonRenderingResult(true, {
|
|
641
|
+
dirty: options.isDirty?.({ document: input.document }),
|
|
642
|
+
status: `Baked ${artifact.chunks.length} static shadow chunk${artifact.chunks.length === 1 ? '' : 's'} from ${artifact.stats?.sourceRootCount ?? 0} static caster${artifact.stats?.sourceRootCount === 1 ? '' : 's'}.`,
|
|
643
|
+
statusTone: 'success',
|
|
644
|
+
statusDetails,
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
function readPlayableBabylonRenderingProgressReporter(value) {
|
|
648
|
+
return typeof value === 'function'
|
|
649
|
+
? value
|
|
650
|
+
: null;
|
|
651
|
+
}
|
|
652
|
+
function createPlayableBabylonStaticShadowBakeProgress(progress, options) {
|
|
653
|
+
const total = Math.max(0, progress.totalChunkCount);
|
|
654
|
+
const completed = Math.max(0, progress.completedChunkCount);
|
|
655
|
+
const chunkProgress = total > 0 ? completed / total : 1;
|
|
656
|
+
const atlasPageCount = Math.max(0, progress.atlasPageCount ?? 0);
|
|
657
|
+
const encodedPageCount = Math.max(0, progress.encodedTextureCount);
|
|
658
|
+
const value = progress.phase === 'collect'
|
|
659
|
+
? 0.08
|
|
660
|
+
: progress.phase === 'pack'
|
|
661
|
+
? 0.92
|
|
662
|
+
: progress.phase === 'encode'
|
|
663
|
+
? 0.92 + (atlasPageCount > 0 ? Math.min(encodedPageCount / atlasPageCount, 1) * 0.05 : 0.03)
|
|
664
|
+
: progress.phase === 'complete'
|
|
665
|
+
? 0.96
|
|
666
|
+
: 0.12 + chunkProgress * 0.78;
|
|
667
|
+
const status = progress.phase === 'collect'
|
|
668
|
+
? `Collecting ${progress.sourceRootCount} static shadow casters...`
|
|
669
|
+
: progress.phase === 'reuse'
|
|
670
|
+
? `Reusing ${progress.reusedChunkCount ?? 0} unchanged static shadow chunks...`
|
|
671
|
+
: progress.phase === 'sdf'
|
|
672
|
+
? `Generating static shadow SDF ${Math.min(completed + 1, total)} of ${total}...`
|
|
673
|
+
: progress.phase === 'pack'
|
|
674
|
+
? `Packing ${progress.encodedTextureCount} static shadow chunks into ${atlasPageCount} atlas page${atlasPageCount === 1 ? '' : 's'}...`
|
|
675
|
+
: progress.phase === 'encode'
|
|
676
|
+
? `Encoding static shadow atlas page ${Math.min(encodedPageCount + 1, atlasPageCount || encodedPageCount + 1)} of ${atlasPageCount || encodedPageCount + 1}...`
|
|
677
|
+
: progress.phase === 'complete'
|
|
678
|
+
? `Finishing ${encodedPageCount} static shadow atlas page${encodedPageCount === 1 ? '' : 's'}...`
|
|
679
|
+
: `Baking static shadow chunk ${Math.min(completed + 1, total)} of ${total}...`;
|
|
680
|
+
return {
|
|
681
|
+
actionId: 'bake-static-shadows',
|
|
682
|
+
label: total > 0
|
|
683
|
+
? `Static shadow bake ${Math.min(completed, total)} / ${total}`
|
|
684
|
+
: 'Static shadow bake',
|
|
685
|
+
status,
|
|
686
|
+
value,
|
|
687
|
+
indeterminate: total === 0 && progress.phase !== 'complete',
|
|
688
|
+
details: {
|
|
689
|
+
phase: progress.phase,
|
|
690
|
+
sourceRootCount: progress.sourceRootCount,
|
|
691
|
+
sourceMeshCount: progress.sourceMeshCount,
|
|
692
|
+
attemptedChunkCount: progress.totalChunkCount,
|
|
693
|
+
chunkCount: progress.completedChunkCount,
|
|
694
|
+
textureCount: progress.encodedTextureCount,
|
|
695
|
+
pageCount: progress.atlasPageCount,
|
|
696
|
+
resolution: options.bake?.resolution,
|
|
697
|
+
chunkSize: options.bake?.maxSize,
|
|
698
|
+
atlasSize: options.bake?.atlasSize,
|
|
699
|
+
texelsPerMeter: options.bake?.texelsPerMeter,
|
|
700
|
+
effectiveTexelsPerMeter: progress.effectiveTexelsPerMeter,
|
|
701
|
+
maxAtlasPages: options.bake?.maxAtlasPages,
|
|
702
|
+
sdfRadiusPx: options.bake?.sdfRadiusPx,
|
|
703
|
+
spatialChunkSize: options.bake?.spatialChunkSize,
|
|
704
|
+
effectiveSpatialChunkSize: progress.effectiveSpatialChunkSize,
|
|
705
|
+
targetChunkCount: options.bake?.targetChunkCount,
|
|
706
|
+
bakedChunkCount: progress.bakedChunkCount,
|
|
707
|
+
reusedChunkCount: progress.reusedChunkCount,
|
|
708
|
+
...(progress.currentChunkId ? { currentChunkId: progress.currentChunkId } : {}),
|
|
709
|
+
},
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function createStaticShadowArtifactStatsDetails(artifact) {
|
|
713
|
+
const isV2 = artifact.version === 2;
|
|
714
|
+
const pageCount = isV2 ? artifact.pages.length : undefined;
|
|
715
|
+
return {
|
|
716
|
+
phase: 'complete',
|
|
717
|
+
sourceRootCount: artifact.stats?.sourceRootCount ?? 0,
|
|
718
|
+
sourceMeshCount: artifact.stats?.sourceMeshCount ?? 0,
|
|
719
|
+
attemptedChunkCount: artifact.stats?.attemptedChunkCount ?? artifact.chunks.length,
|
|
720
|
+
chunkCount: artifact.stats?.chunkCount ?? artifact.chunks.length,
|
|
721
|
+
textureCount: artifact.stats?.textureCount ?? pageCount ?? artifact.chunks.length,
|
|
722
|
+
skippedChunkCount: artifact.stats?.skippedChunkCount ?? 0,
|
|
723
|
+
pageCount: artifact.stats?.pageCount ?? pageCount,
|
|
724
|
+
resolution: artifact.stats?.resolution,
|
|
725
|
+
chunkSize: artifact.stats?.chunkSize,
|
|
726
|
+
atlasSize: artifact.stats?.atlasSize,
|
|
727
|
+
atlasUsedPixels: artifact.stats?.atlasUsedPixels,
|
|
728
|
+
atlasAllocatedPixels: artifact.stats?.atlasAllocatedPixels,
|
|
729
|
+
atlasOccupancy: artifact.stats?.atlasOccupancy,
|
|
730
|
+
texelsPerMeter: artifact.stats?.texelsPerMeter,
|
|
731
|
+
effectiveTexelsPerMeter: artifact.stats?.effectiveTexelsPerMeter,
|
|
732
|
+
maxAtlasPages: artifact.stats?.maxAtlasPages,
|
|
733
|
+
sdfRadiusPx: artifact.stats?.sdfRadiusPx,
|
|
734
|
+
spatialChunkSize: artifact.stats?.spatialChunkSize,
|
|
735
|
+
effectiveSpatialChunkSize: artifact.stats?.effectiveSpatialChunkSize,
|
|
736
|
+
targetChunkCount: artifact.stats?.targetChunkCount,
|
|
737
|
+
bakedChunkCount: artifact.stats?.bakedChunkCount,
|
|
738
|
+
reusedChunkCount: artifact.stats?.reusedChunkCount,
|
|
739
|
+
durationMs: artifact.stats?.durationMs,
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
function formatStaticShadowBakeResultDetails(artifact) {
|
|
743
|
+
const stats = artifact.stats;
|
|
744
|
+
const sourceRootCount = stats?.sourceRootCount ?? 0;
|
|
745
|
+
const sourceMeshCount = stats?.sourceMeshCount ?? 0;
|
|
746
|
+
const chunkCount = stats?.chunkCount ?? artifact.chunks.length;
|
|
747
|
+
const atlasPageCount = stats?.pageCount ?? (artifact.version === 2 ? artifact.pages.length : stats?.textureCount ?? artifact.chunks.length);
|
|
748
|
+
const effectiveTexelsPerMeter = stats?.effectiveTexelsPerMeter;
|
|
749
|
+
const atlasSize = stats?.atlasSize;
|
|
750
|
+
const atlasOccupancy = stats?.atlasOccupancy;
|
|
751
|
+
const sdfRadiusPx = stats?.sdfRadiusPx;
|
|
752
|
+
const duration = typeof stats?.durationMs === 'number' ? `, ${Math.round(stats.durationMs)}ms` : '';
|
|
753
|
+
const parts = [
|
|
754
|
+
`Static casters: ${sourceRootCount}`,
|
|
755
|
+
`Bake meshes: ${sourceMeshCount}`,
|
|
756
|
+
`Chunks: ${chunkCount}`,
|
|
757
|
+
`Atlas pages: ${atlasPageCount}${duration}`,
|
|
758
|
+
];
|
|
759
|
+
if (typeof effectiveTexelsPerMeter === 'number')
|
|
760
|
+
parts.push(`Effective texels/m: ${formatNumberForStatus(effectiveTexelsPerMeter)}`);
|
|
761
|
+
if (typeof atlasSize === 'number')
|
|
762
|
+
parts.push(`Atlas: ${atlasSize}px`);
|
|
763
|
+
if (typeof atlasOccupancy === 'number')
|
|
764
|
+
parts.push(`Atlas occupancy: ${formatNumberForStatus(Math.max(0, Math.min(1, atlasOccupancy)) * 100)}%`);
|
|
765
|
+
if (typeof sdfRadiusPx === 'number')
|
|
766
|
+
parts.push(`SDF radius: ${formatNumberForStatus(sdfRadiusPx)}px`);
|
|
767
|
+
if (typeof stats?.bakedChunkCount === 'number' || typeof stats?.reusedChunkCount === 'number') {
|
|
768
|
+
parts.push(`Baked/reused: ${stats?.bakedChunkCount ?? 0}/${stats?.reusedChunkCount ?? 0}`);
|
|
769
|
+
}
|
|
770
|
+
return parts.join(' · ');
|
|
771
|
+
}
|
|
772
|
+
function formatNumberForStatus(value) {
|
|
773
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(2).replace(/\.?0+$/, '');
|
|
774
|
+
}
|
|
376
775
|
function createPlayableBabylonRenderingResult(changed, input) {
|
|
377
776
|
return {
|
|
378
777
|
changed,
|
|
@@ -380,13 +779,123 @@ function createPlayableBabylonRenderingResult(changed, input) {
|
|
|
380
779
|
...(input.dirty === undefined ? {} : { dirty: input.dirty }),
|
|
381
780
|
status: input.status,
|
|
382
781
|
statusTone: input.statusTone,
|
|
782
|
+
...(input.statusDetails ? { statusDetails: input.statusDetails } : {}),
|
|
783
|
+
...(input.documentPatch === undefined ? {} : { documentPatch: input.documentPatch }),
|
|
383
784
|
};
|
|
384
785
|
}
|
|
786
|
+
function createPlayableBabylonRenderingProfileActionInput(actionId, input) {
|
|
787
|
+
const params = readRecord(input.params);
|
|
788
|
+
return {
|
|
789
|
+
actionId,
|
|
790
|
+
renderingGroupId: params.renderingGroupId ?? input.renderingGroupId,
|
|
791
|
+
presetIndex: params.presetIndex ?? input.presetIndex,
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function readPlayableBabylonRenderingDocumentPatch(value) {
|
|
795
|
+
return value && typeof value === 'object' ? value.documentPatch : undefined;
|
|
796
|
+
}
|
|
797
|
+
function readRecord(value) {
|
|
798
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
799
|
+
? value
|
|
800
|
+
: {};
|
|
801
|
+
}
|
|
385
802
|
function resolvePlayableBabylonRenderingValue(value, context) {
|
|
386
803
|
return typeof value === 'function'
|
|
387
804
|
? value(context)
|
|
388
805
|
: value;
|
|
389
806
|
}
|
|
807
|
+
function readPlayableBabylonRenderingActionProgress(value) {
|
|
808
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
809
|
+
return null;
|
|
810
|
+
const record = value;
|
|
811
|
+
return {
|
|
812
|
+
...(typeof record.actionId === 'string' ? { actionId: record.actionId } : {}),
|
|
813
|
+
...(typeof record.label === 'string' ? { label: record.label } : {}),
|
|
814
|
+
...(typeof record.status === 'string' ? { status: record.status } : {}),
|
|
815
|
+
...(isEditorSceneRenderingStatusTone(record.statusTone) ? { statusTone: record.statusTone } : {}),
|
|
816
|
+
...(typeof record.statusDetails === 'string' ? { statusDetails: record.statusDetails } : {}),
|
|
817
|
+
...(typeof record.value === 'number' && Number.isFinite(record.value) ? { value: record.value } : {}),
|
|
818
|
+
...(typeof record.indeterminate === 'boolean' ? { indeterminate: record.indeterminate } : {}),
|
|
819
|
+
...(record.details && typeof record.details === 'object' && !Array.isArray(record.details)
|
|
820
|
+
? { details: record.details }
|
|
821
|
+
: {}),
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
function isEditorSceneRenderingStatusTone(value) {
|
|
825
|
+
return value === 'default' || value === 'success' || value === 'warning' || value === 'error';
|
|
826
|
+
}
|
|
827
|
+
function readStaticShadowBakeStats(value) {
|
|
828
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
829
|
+
return null;
|
|
830
|
+
const record = value;
|
|
831
|
+
const stats = {};
|
|
832
|
+
if (typeof record.phase === 'string' && record.phase.trim()) {
|
|
833
|
+
stats.phase = record.phase.trim();
|
|
834
|
+
}
|
|
835
|
+
setOptionalNonNegativeNumber(stats, 'sourceRootCount', record.sourceRootCount);
|
|
836
|
+
setOptionalNonNegativeNumber(stats, 'sourceMeshCount', record.sourceMeshCount);
|
|
837
|
+
setOptionalNonNegativeNumber(stats, 'attemptedChunkCount', record.attemptedChunkCount);
|
|
838
|
+
setOptionalNonNegativeNumber(stats, 'chunkCount', record.chunkCount);
|
|
839
|
+
setOptionalNonNegativeNumber(stats, 'textureCount', record.textureCount);
|
|
840
|
+
setOptionalNonNegativeNumber(stats, 'skippedChunkCount', record.skippedChunkCount);
|
|
841
|
+
setOptionalNonNegativeNumber(stats, 'pageCount', record.pageCount);
|
|
842
|
+
setOptionalPositiveNumber(stats, 'resolution', record.resolution);
|
|
843
|
+
setOptionalPositiveNumber(stats, 'chunkSize', record.chunkSize);
|
|
844
|
+
setOptionalPositiveNumber(stats, 'atlasSize', record.atlasSize);
|
|
845
|
+
setOptionalNonNegativeNumber(stats, 'atlasUsedPixels', record.atlasUsedPixels);
|
|
846
|
+
setOptionalNonNegativeNumber(stats, 'atlasAllocatedPixels', record.atlasAllocatedPixels);
|
|
847
|
+
setOptionalRatio(stats, 'atlasOccupancy', record.atlasOccupancy);
|
|
848
|
+
setOptionalPositiveNumber(stats, 'texelsPerMeter', record.texelsPerMeter);
|
|
849
|
+
setOptionalPositiveNumber(stats, 'effectiveTexelsPerMeter', record.effectiveTexelsPerMeter);
|
|
850
|
+
setOptionalPositiveNumber(stats, 'maxAtlasPages', record.maxAtlasPages);
|
|
851
|
+
setOptionalNonNegativeNumber(stats, 'sdfRadiusPx', record.sdfRadiusPx);
|
|
852
|
+
setOptionalPositiveNumber(stats, 'spatialChunkSize', record.spatialChunkSize);
|
|
853
|
+
setOptionalPositiveNumber(stats, 'effectiveSpatialChunkSize', record.effectiveSpatialChunkSize);
|
|
854
|
+
setOptionalPositiveNumber(stats, 'targetChunkCount', record.targetChunkCount);
|
|
855
|
+
setOptionalNonNegativeNumber(stats, 'bakedChunkCount', record.bakedChunkCount);
|
|
856
|
+
setOptionalNonNegativeNumber(stats, 'reusedChunkCount', record.reusedChunkCount);
|
|
857
|
+
setOptionalNonNegativeNumber(stats, 'durationMs', record.durationMs);
|
|
858
|
+
if (typeof record.currentChunkId === 'string' && record.currentChunkId.trim()) {
|
|
859
|
+
stats.currentChunkId = record.currentChunkId.trim();
|
|
860
|
+
}
|
|
861
|
+
return Object.keys(stats).length > 0 ? stats : null;
|
|
862
|
+
}
|
|
863
|
+
function setOptionalNonNegativeNumber(target, key, value) {
|
|
864
|
+
if (typeof value === 'number' && Number.isFinite(value) && value >= 0) {
|
|
865
|
+
target[key] = value;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function setOptionalPositiveNumber(target, key, value) {
|
|
869
|
+
if (typeof value === 'number' && Number.isFinite(value) && value > 0) {
|
|
870
|
+
target[key] = value;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
function setOptionalRatio(target, key, value) {
|
|
874
|
+
if (typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= 1) {
|
|
875
|
+
target[key] = value;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
function readBabylonScene(value) {
|
|
879
|
+
return value && typeof value === 'object' && Array.isArray(value.meshes)
|
|
880
|
+
? value
|
|
881
|
+
: null;
|
|
882
|
+
}
|
|
883
|
+
function resolveBabylonDirectionalLight(projectionValue, directionalLightNodeId) {
|
|
884
|
+
if (!directionalLightNodeId)
|
|
885
|
+
return null;
|
|
886
|
+
const projection = projectionValue;
|
|
887
|
+
const projected = projection?.getProjectedNode?.(directionalLightNodeId);
|
|
888
|
+
const candidates = [
|
|
889
|
+
projected?.root,
|
|
890
|
+
...(Array.isArray(projected?.runtimeObjects) ? projected.runtimeObjects : []),
|
|
891
|
+
];
|
|
892
|
+
for (const candidate of candidates) {
|
|
893
|
+
if (candidate && typeof candidate === 'object' && candidate.getClassName?.() === 'DirectionalLight') {
|
|
894
|
+
return candidate;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
return null;
|
|
898
|
+
}
|
|
390
899
|
function mergePlayableBabylonPlanarShadowPolicyInput(base, input) {
|
|
391
900
|
const merged = {
|
|
392
901
|
additionalCasterIncludePatterns: mergePlayableBabylonPlanarShadowPatterns(...(base.additionalCasterIncludePatterns ?? []), ...(input?.additionalCasterIncludePatterns ?? [])),
|