@babylonjs/core 9.13.0 → 9.15.0
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/Animations/animationGroup.d.ts +0 -1
- package/Animations/animationGroup.js +0 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animationGroup.pure.js +2 -0
- package/Animations/animationGroup.pure.js.map +1 -1
- package/Animations/runtimeAnimation.js +11 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
- package/AudioV2/abstractAudio/abstractSound.js +3 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
- package/AudioV2/abstractAudio/staticSound.js +9 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
- package/AudioV2/abstractAudio/streamingSound.js +9 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +6 -3
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +7 -4
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +3 -2
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +37 -10
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js +19 -9
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +21 -18
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +31 -12
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
- package/Cameras/VR/vrExperienceHelper.js +0 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
- package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +9 -3
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/targetCamera.pure.js +18 -18
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.js +23 -13
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +3 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +24 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +8 -1
- package/Engines/abstractEngine.pure.js +4 -3
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +113 -0
- package/Engines/thinNativeEngine.pure.d.ts +2 -0
- package/Engines/thinNativeEngine.pure.js +115 -9
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/FlowGraph/flowGraph.js +9 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
- package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +11 -0
- package/FlowGraph/serialization.js +11 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +66 -35
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/Helpers/environmentHelper.js +2 -2
- package/Helpers/environmentHelper.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +15 -2
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/areaLight.pure.js +5 -0
- package/Lights/areaLight.pure.js.map +1 -1
- package/Lights/light.d.ts +4 -2
- package/Lights/light.js +10 -4
- package/Lights/light.js.map +1 -1
- package/Lights/rectAreaLight.pure.d.ts +17 -0
- package/Lights/rectAreaLight.pure.js +67 -0
- package/Lights/rectAreaLight.pure.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js +4 -4
- package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
- package/Materials/Background/backgroundMaterial.pure.js +3 -1
- package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +2 -2
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +2 -2
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.js +3 -0
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/PBR/openpbrMaterial.pure.js +3 -1
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrMaterial.pure.js +3 -0
- package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +3 -0
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +3 -0
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
- package/Materials/Textures/HTML/htmlTexture.js +455 -0
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
- package/Materials/Textures/HTML/index.d.ts +4 -0
- package/Materials/Textures/HTML/index.js +5 -0
- package/Materials/Textures/HTML/index.js.map +1 -0
- package/Materials/Textures/HTML/pure.d.ts +5 -0
- package/Materials/Textures/HTML/pure.js +6 -0
- package/Materials/Textures/HTML/pure.js.map +1 -0
- package/Materials/Textures/cubeTexture.d.ts +0 -1
- package/Materials/Textures/cubeTexture.js +0 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.pure.js +2 -0
- package/Materials/Textures/cubeTexture.pure.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +0 -1
- package/Materials/Textures/dynamicTexture.js +0 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.pure.js +2 -0
- package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +0 -2
- package/Materials/Textures/htmlElementTexture.js +0 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.pure.js +4 -0
- package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +0 -1
- package/Materials/Textures/multiRenderTarget.js +0 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.pure.js +2 -0
- package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
- package/Materials/Textures/pure.d.ts +1 -0
- package/Materials/Textures/pure.js +1 -0
- package/Materials/Textures/pure.js.map +1 -1
- package/Materials/Textures/videoTexture.pure.d.ts +3 -0
- package/Materials/Textures/videoTexture.pure.js +30 -0
- package/Materials/Textures/videoTexture.pure.js.map +1 -1
- package/Materials/standardMaterial.pure.js +3 -1
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +9 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +12 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +20 -6
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Misc/decorators.functions.d.ts +7 -0
- package/Misc/decorators.functions.js +86 -35
- package/Misc/decorators.functions.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +4 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/symbolMetadataPolyfill.d.ts +11 -0
- package/Misc/symbolMetadataPolyfill.js +22 -0
- package/Misc/symbolMetadataPolyfill.js.map +1 -0
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +0 -1
- package/Particles/gpuParticleSystem.js +0 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +0 -1
- package/Particles/thinParticleSystem.js +0 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.pure.js +2 -0
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/Particles/webgl2ParticleSystem.pure.js +2 -0
- package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +7 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/postProcess.pure.js +5 -0
- package/PostProcesses/postProcess.pure.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +0 -2
- package/Rendering/prePassRenderer.js +0 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.pure.js +2 -0
- package/Rendering/prePassRenderer.pure.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
- package/Rendering/thinDepthPeelingRenderer.js +0 -1
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -11
package/FlowGraph/flowGraph.js
CHANGED
|
@@ -168,6 +168,15 @@ export class FlowGraph {
|
|
|
168
168
|
// Rebuild with the new scene
|
|
169
169
|
this._scene = scene;
|
|
170
170
|
this._scene.constantlyUpdateMeshUnderPointer = true; // ensure pointer info is always up to date for event blocks that need it
|
|
171
|
+
// Re-resolve node references (e.g. meshes targeted by Get/Set property blocks) against the
|
|
172
|
+
// new scene. This is required when the graph was parsed before its scene was populated (for
|
|
173
|
+
// example an editor that loads a graph from a snippet first and the referenced scene second):
|
|
174
|
+
// the references would otherwise stay bound to nodes from the old/disposed scene.
|
|
175
|
+
for (const block of this._allBlocks) {
|
|
176
|
+
for (const input of block.dataInputs) {
|
|
177
|
+
input._reresolveDefaultValueForScene(scene);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
171
180
|
this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);
|
|
172
181
|
// Pre-attach the event observer so that events from the new
|
|
173
182
|
// coordinator are routed to the graph immediately. The handler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,U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AAS,CAAC,eAAe,CAAC,CAAC;YACjC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,mBAAmB,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC3C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5C,MAAM,iBAAiB,GAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;YAC7D,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\nimport { type IFlowGraphEventTrigger, FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { type FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _IsDescendantOf } from \"./utils\";\r\nimport { type IFlowGraphValidationResult, ValidateFlowGraphWithBlockList } from \"./flowGraphValidator\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\n\r\nexport const enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n /**\r\n * The graph is paused (contexts kept, pending tasks cancelled)\r\n */\r\n Paused,\r\n}\r\n\r\n/**\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface IFlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * Optional human-readable name for the graph.\r\n * Defaults to \"Graph\" if not provided.\r\n */\r\n name?: string;\r\n /**\r\n * Optional unique identifier for the graph.\r\n * If not provided, a random UUID is generated.\r\n */\r\n uniqueId?: string;\r\n}\r\n\r\n/**\r\n * Options for parsing a flow graph.\r\n */\r\nexport interface IFlowGraphParseOptions {\r\n /**\r\n * A function that parses complex values in a scene.\r\n * @param key the key of the value\r\n * @param serializationObject the object to read the value from\r\n * @param assetsContainer the assets container to read assets from\r\n * @param scene the scene to read the value from\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The flow graph coordinator.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * A function that converts a path to an object accessor.\r\n */\r\n pathConverter?: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n *\r\n * @experimental FlowGraph is still in development and is subject to change.\r\n */\r\nexport class FlowGraph {\r\n /**\r\n * A human-readable name for this graph.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * A unique identifier for this graph. Auto-generated if not provided.\r\n */\r\n public uniqueId: string;\r\n\r\n /**\r\n * An observable that is triggered when the state of the graph changes.\r\n */\r\n public onStateChangedObservable: Observable<FlowGraphState> = new Observable();\r\n /** @internal */\r\n public _eventBlocks: { [keyof in FlowGraphEventType]: FlowGraphEventBlock[] } = {\r\n [FlowGraphEventType.SceneReady]: [],\r\n [FlowGraphEventType.SceneDispose]: [],\r\n [FlowGraphEventType.SceneBeforeRender]: [],\r\n [FlowGraphEventType.MeshPick]: [],\r\n [FlowGraphEventType.PointerDown]: [],\r\n [FlowGraphEventType.PointerUp]: [],\r\n [FlowGraphEventType.PointerMove]: [],\r\n [FlowGraphEventType.PointerOver]: [],\r\n [FlowGraphEventType.PointerOut]: [],\r\n [FlowGraphEventType.KeyDown]: [],\r\n [FlowGraphEventType.KeyUp]: [],\r\n [FlowGraphEventType.SceneAfterRender]: [],\r\n [FlowGraphEventType.NoTrigger]: [],\r\n };\r\n\r\n /**\r\n * All blocks that belong to this graph, including unreachable ones.\r\n * @internal\r\n */\r\n public _allBlocks: FlowGraphBlock[] = [];\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n\r\n /**\r\n * The scene associated with this flow graph.\r\n */\r\n public get scene(): Scene {\r\n return this._scene;\r\n }\r\n private _coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The coordinator that owns this flow graph.\r\n */\r\n public get coordinator(): FlowGraphCoordinator {\r\n return this._coordinator;\r\n }\r\n private _executionContexts: FlowGraphContext[] = [];\r\n private _sceneEventCoordinator: FlowGraphSceneEventCoordinator;\r\n\r\n /**\r\n * The scene event coordinator for this graph.\r\n * Provides access to runtime event state such as currently pressed keys.\r\n */\r\n public get sceneEventCoordinator(): FlowGraphSceneEventCoordinator {\r\n return this._sceneEventCoordinator;\r\n }\r\n\r\n private _eventObserver: Nullable<Observer<IFlowGraphEventTrigger>>;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n private _state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public get state() {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public set state(value: FlowGraphState) {\r\n this._state = value;\r\n this.onStateChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: IFlowGraphParams) {\r\n this._scene = params.scene;\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n this._coordinator = params.coordinator;\r\n this.name = params.name ?? \"Graph\";\r\n this.uniqueId = params.uniqueId ?? RandomGUID();\r\n }\r\n\r\n private _attachEventObserver() {\r\n if (this._eventObserver) {\r\n return;\r\n }\r\n this._eventObserver = this._sceneEventCoordinator.onEventTriggeredObservable.add((event) => {\r\n if (event.type === FlowGraphEventType.SceneDispose) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n\r\n for (const context of this._executionContexts) {\r\n const order = this._getContextualOrder(event.type, context);\r\n for (const block of order) {\r\n // iterate contexts\r\n if (!block._executeEvent(context, event.payload)) {\r\n break;\r\n }\r\n }\r\n }\r\n // custom behavior(s) of specific events\r\n switch (event.type) {\r\n case FlowGraphEventType.SceneReady:\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n break;\r\n case FlowGraphEventType.SceneBeforeRender:\r\n for (const context of this._executionContexts) {\r\n context._notifyOnTick(event.payload);\r\n }\r\n break;\r\n }\r\n });\r\n }\r\n\r\n private _detachEventObserver() {\r\n this._eventObserver?.remove();\r\n this._eventObserver = null;\r\n }\r\n\r\n /**\r\n * Sets a new scene for this flow graph, re-wiring all event listeners.\r\n * This is useful when the scene the flow graph should listen to changes\r\n * (e.g. when a new scene is loaded in an editor preview).\r\n * If the graph is currently running, it will be stopped first and must be\r\n * restarted manually after calling this method.\r\n * @param scene the new scene to attach to\r\n */\r\n public setScene(scene: Scene): void {\r\n if (scene === this._scene) {\r\n return;\r\n }\r\n if (this.state === FlowGraphState.Started) {\r\n this.stop();\r\n }\r\n // Tear down old event coordinator\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n // Clear execution contexts so start() creates fresh ones with the new scene.\r\n // NOTE: This intentionally discards user variables and connection values.\r\n // Callers that need to preserve them (e.g. the Flow Graph Editor) should\r\n // snapshot context state BEFORE calling setScene() and restore it in a\r\n // wrapped createContext() callback after start() re-creates contexts.\r\n this._executionContexts.length = 0;\r\n // Rebuild with the new scene\r\n (this as { _scene: Scene })._scene = scene;\r\n this._scene.constantlyUpdateMeshUnderPointer = true; // ensure pointer info is always up to date for event blocks that need it\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n // Pre-attach the event observer so that events from the new\r\n // coordinator are routed to the graph immediately. The handler\r\n // guards against processing events while the graph is stopped,\r\n // but having the observer in place ensures no events are lost\r\n // when start() is called shortly after.\r\n this._attachEventObserver();\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator, sceneEventCoordinator: this._sceneEventCoordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n /**\r\n * Returns the execution context at a given index\r\n * @param index the index of the context\r\n * @returns the execution context at that index\r\n */\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Returns the number of execution contexts currently attached to this graph.\r\n */\r\n public get contextCount(): number {\r\n return this._executionContexts.length;\r\n }\r\n\r\n /**\r\n * Remove an execution context by index. Any pending async blocks on\r\n * the context are cleared before removal.\r\n * @param index the index of the context to remove\r\n * @returns the removed context, or undefined if the index was out of range\r\n */\r\n public removeContext(index: number): FlowGraphContext | undefined {\r\n if (index < 0 || index >= this._executionContexts.length) {\r\n return undefined;\r\n }\r\n const [removed] = this._executionContexts.splice(index, 1);\r\n removed._clearPendingBlocks();\r\n return removed;\r\n }\r\n\r\n /**\r\n * Returns all blocks registered in this graph, including disconnected ones.\r\n * @returns a read-only array of all blocks\r\n */\r\n public getAllBlocks(): readonly FlowGraphBlock[] {\r\n return this._allBlocks;\r\n }\r\n\r\n /**\r\n * Register a block with the graph. This does not wire any connections;\r\n * it simply ensures the block is tracked so that serialization, editor\r\n * display, and validation see it even when it is not reachable from an\r\n * event block.\r\n * @param block the block to register\r\n */\r\n public addBlock(block: FlowGraphBlock): void {\r\n if (this._allBlocks.indexOf(block) === -1) {\r\n this._allBlocks.push(block);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a block from the graph. Disconnects all of its ports and, if it\r\n * is an event block, unregisters it from the event-block lists.\r\n * @param block the block to remove\r\n */\r\n public removeBlock(block: FlowGraphBlock): void {\r\n const idx = this._allBlocks.indexOf(block);\r\n if (idx !== -1) {\r\n this._allBlocks.splice(idx, 1);\r\n }\r\n // If it is an event block, remove from the event-block registry\r\n if (block instanceof FlowGraphExecutionBlock && \"type\" in block) {\r\n const eventBlock = block as unknown as FlowGraphEventBlock;\r\n const list = this._eventBlocks[eventBlock.type];\r\n if (list) {\r\n const eIdx = list.indexOf(eventBlock);\r\n if (eIdx !== -1) {\r\n list.splice(eIdx, 1);\r\n }\r\n }\r\n }\r\n // If the block has pending async tasks (e.g. event subscriptions),\r\n // cancel them in all active execution contexts so deletion takes\r\n // effect immediately even while the graph is running.\r\n if (block instanceof FlowGraphAsyncExecutionBlock) {\r\n for (const context of this._executionContexts) {\r\n block._cancelPendingTasks(context);\r\n block._resetAfterCanceled(context);\r\n }\r\n }\r\n // Disconnect all ports\r\n for (const input of block.dataInputs) {\r\n input.disconnectFromAll();\r\n }\r\n for (const output of block.dataOutputs) {\r\n output.disconnectFromAll();\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n signalIn.disconnectFromAll();\r\n }\r\n for (const signalOut of block.signalOutputs) {\r\n signalOut.disconnectFromAll();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block the event block to be added\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this.addBlock(block);\r\n if (block.type === FlowGraphEventType.PointerOver || block.type === FlowGraphEventType.PointerOut) {\r\n this._scene.constantlyUpdateMeshUnderPointer = true;\r\n }\r\n\r\n this._eventBlocks[block.type].push(block);\r\n\r\n // if already started, sort and add to the pending\r\n if (this.state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n } else {\r\n this.onStateChangedObservable.addOnce((state) => {\r\n if (state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stops the flow graph. Cancels all pending tasks and clears execution contexts,\r\n * but keeps event blocks so the graph can be restarted.\r\n */\r\n public stop() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n }\r\n\r\n /**\r\n * Pauses the flow graph. Cancels pending tasks but keeps execution contexts and event blocks.\r\n * Call start() to resume.\r\n */\r\n public pause() {\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Paused;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n * Can also be called to resume from a paused state.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n const resumingFromPause = this.state === FlowGraphState.Paused;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n this._attachEventObserver();\r\n this.state = FlowGraphState.Started;\r\n this._startPendingEvents();\r\n // On a fresh start (not resume), fire the SceneReady event.\r\n // The coordinator's own scene-ready observer may have already\r\n // fired (and been lost) while the graph was stopped, so reset\r\n // the flag and handle the ready state ourselves.\r\n if (!resumingFromPause) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = false;\r\n if (this._scene.isReady(true)) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n } else {\r\n // Scene isn't ready yet (e.g. pending shader compilations after\r\n // a scene swap). Use executeWhenReady(true) which restarts the\r\n // readiness check loop — a plain addOnce on onReadyObservable\r\n // may never fire if the check loop already completed.\r\n this._scene.executeWhenReady(() => {\r\n if (this.state === FlowGraphState.Started && !this._sceneEventCoordinator.sceneReadyTriggered) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n }\r\n }, true);\r\n }\r\n }\r\n }\r\n\r\n private _startPendingEvents() {\r\n for (const context of this._executionContexts) {\r\n for (const type in this._eventBlocks) {\r\n const order = this._getContextualOrder(type as FlowGraphEventType, context);\r\n for (const block of order) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(type: FlowGraphEventType, context: FlowGraphContext): FlowGraphEventBlock[] {\r\n const order = this._eventBlocks[type].sort((a, b) => b.initPriority - a.initPriority);\r\n\r\n if (type === FlowGraphEventType.MeshPick) {\r\n const meshPickOrder = [] as FlowGraphEventBlock[];\r\n for (const block1 of order) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n if (mesh1 && mesh2 && _IsDescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n meshPickOrder.splice(i, 0, block1);\r\n }\r\n return meshPickOrder;\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n for (const type in this._eventBlocks) {\r\n this._eventBlocks[type as FlowGraphEventType].length = 0;\r\n }\r\n this._allBlocks.length = 0;\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const type in this._eventBlocks) {\r\n for (const block of this._eventBlocks[type as FlowGraphEventType]) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Validates the flow graph and returns all issues found.\r\n * Uses the tracked block list for complete validation including unreachable block detection.\r\n * @returns The validation result containing errors and warnings.\r\n */\r\n public validate(): IFlowGraphValidationResult {\r\n return ValidateFlowGraphWithBlockList(this, this._allBlocks);\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.name = this.name;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.allBlocks = [];\r\n // Collect all blocks: traversal-reachable ones plus any registered\r\n // orphans in _allBlocks (e.g. disconnected blocks in the editor).\r\n const seen = new Set<string>();\r\n const serializeBlock = (block: FlowGraphBlock) => {\r\n if (seen.has(block.uniqueId)) {\r\n return;\r\n }\r\n seen.add(block.uniqueId);\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n };\r\n this.visitAllBlocks(serializeBlock);\r\n for (const block of this._allBlocks) {\r\n serializeBlock(block);\r\n }\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAI/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC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,CAAC;YACzB,MAAM,eAAe,GAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YACjC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,mBAAmB,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC3C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5C,MAAM,iBAAiB,GAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;YAC7D,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type FlowGraphEventBlock } from \"./flowGraphEventBlock\";\r\nimport { FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\r\nimport { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport { type FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { type IObjectAccessor } from \"./typeDefinitions\";\r\nimport { type IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\r\nimport { type IFlowGraphEventTrigger, FlowGraphSceneEventCoordinator } from \"./flowGraphSceneEventCoordinator\";\r\nimport { type FlowGraphMeshPickEventBlock } from \"./Blocks/Event/flowGraphMeshPickEventBlock\";\r\nimport { _IsDescendantOf } from \"./utils\";\r\nimport { type IFlowGraphValidationResult, ValidateFlowGraphWithBlockList } from \"./flowGraphValidator\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\n\r\nexport const enum FlowGraphState {\r\n /**\r\n * The graph is stopped\r\n */\r\n Stopped,\r\n /**\r\n * The graph is running\r\n */\r\n Started,\r\n /**\r\n * The graph is paused (contexts kept, pending tasks cancelled)\r\n */\r\n Paused,\r\n}\r\n\r\n/**\r\n * Parameters used to create a flow graph.\r\n */\r\nexport interface IFlowGraphParams {\r\n /**\r\n * The scene that the flow graph belongs to.\r\n */\r\n scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * Optional human-readable name for the graph.\r\n * Defaults to \"Graph\" if not provided.\r\n */\r\n name?: string;\r\n /**\r\n * Optional unique identifier for the graph.\r\n * If not provided, a random UUID is generated.\r\n */\r\n uniqueId?: string;\r\n}\r\n\r\n/**\r\n * Options for parsing a flow graph.\r\n */\r\nexport interface IFlowGraphParseOptions {\r\n /**\r\n * A function that parses complex values in a scene.\r\n * @param key the key of the value\r\n * @param serializationObject the object to read the value from\r\n * @param assetsContainer the assets container to read assets from\r\n * @param scene the scene to read the value from\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The flow graph coordinator.\r\n */\r\n coordinator: FlowGraphCoordinator;\r\n /**\r\n * A function that converts a path to an object accessor.\r\n */\r\n pathConverter?: IPathToObjectConverter<IObjectAccessor>;\r\n}\r\n/**\r\n * Class used to represent a flow graph.\r\n * A flow graph is a graph of blocks that can be used to create complex logic.\r\n * Blocks can be added to the graph and connected to each other.\r\n * The graph can then be started, which will init and start all of its event blocks.\r\n *\r\n * @experimental FlowGraph is still in development and is subject to change.\r\n */\r\nexport class FlowGraph {\r\n /**\r\n * A human-readable name for this graph.\r\n */\r\n public name: string;\r\n\r\n /**\r\n * A unique identifier for this graph. Auto-generated if not provided.\r\n */\r\n public uniqueId: string;\r\n\r\n /**\r\n * An observable that is triggered when the state of the graph changes.\r\n */\r\n public onStateChangedObservable: Observable<FlowGraphState> = new Observable();\r\n /** @internal */\r\n public _eventBlocks: { [keyof in FlowGraphEventType]: FlowGraphEventBlock[] } = {\r\n [FlowGraphEventType.SceneReady]: [],\r\n [FlowGraphEventType.SceneDispose]: [],\r\n [FlowGraphEventType.SceneBeforeRender]: [],\r\n [FlowGraphEventType.MeshPick]: [],\r\n [FlowGraphEventType.PointerDown]: [],\r\n [FlowGraphEventType.PointerUp]: [],\r\n [FlowGraphEventType.PointerMove]: [],\r\n [FlowGraphEventType.PointerOver]: [],\r\n [FlowGraphEventType.PointerOut]: [],\r\n [FlowGraphEventType.KeyDown]: [],\r\n [FlowGraphEventType.KeyUp]: [],\r\n [FlowGraphEventType.SceneAfterRender]: [],\r\n [FlowGraphEventType.NoTrigger]: [],\r\n };\r\n\r\n /**\r\n * All blocks that belong to this graph, including unreachable ones.\r\n * @internal\r\n */\r\n public _allBlocks: FlowGraphBlock[] = [];\r\n /**\r\n * @internal\r\n */\r\n public readonly _scene: Scene;\r\n\r\n /**\r\n * The scene associated with this flow graph.\r\n */\r\n public get scene(): Scene {\r\n return this._scene;\r\n }\r\n private _coordinator: FlowGraphCoordinator;\r\n\r\n /**\r\n * The coordinator that owns this flow graph.\r\n */\r\n public get coordinator(): FlowGraphCoordinator {\r\n return this._coordinator;\r\n }\r\n private _executionContexts: FlowGraphContext[] = [];\r\n private _sceneEventCoordinator: FlowGraphSceneEventCoordinator;\r\n\r\n /**\r\n * The scene event coordinator for this graph.\r\n * Provides access to runtime event state such as currently pressed keys.\r\n */\r\n public get sceneEventCoordinator(): FlowGraphSceneEventCoordinator {\r\n return this._sceneEventCoordinator;\r\n }\r\n\r\n private _eventObserver: Nullable<Observer<IFlowGraphEventTrigger>>;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n private _state: FlowGraphState = FlowGraphState.Stopped;\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public get state() {\r\n return this._state;\r\n }\r\n\r\n /**\r\n * The state of the graph\r\n */\r\n public set state(value: FlowGraphState) {\r\n this._state = value;\r\n this.onStateChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Construct a Flow Graph\r\n * @param params construction parameters. currently only the scene\r\n */\r\n public constructor(params: IFlowGraphParams) {\r\n this._scene = params.scene;\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n this._coordinator = params.coordinator;\r\n this.name = params.name ?? \"Graph\";\r\n this.uniqueId = params.uniqueId ?? RandomGUID();\r\n }\r\n\r\n private _attachEventObserver() {\r\n if (this._eventObserver) {\r\n return;\r\n }\r\n this._eventObserver = this._sceneEventCoordinator.onEventTriggeredObservable.add((event) => {\r\n if (event.type === FlowGraphEventType.SceneDispose) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n\r\n for (const context of this._executionContexts) {\r\n const order = this._getContextualOrder(event.type, context);\r\n for (const block of order) {\r\n // iterate contexts\r\n if (!block._executeEvent(context, event.payload)) {\r\n break;\r\n }\r\n }\r\n }\r\n // custom behavior(s) of specific events\r\n switch (event.type) {\r\n case FlowGraphEventType.SceneReady:\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n break;\r\n case FlowGraphEventType.SceneBeforeRender:\r\n for (const context of this._executionContexts) {\r\n context._notifyOnTick(event.payload);\r\n }\r\n break;\r\n }\r\n });\r\n }\r\n\r\n private _detachEventObserver() {\r\n this._eventObserver?.remove();\r\n this._eventObserver = null;\r\n }\r\n\r\n /**\r\n * Sets a new scene for this flow graph, re-wiring all event listeners.\r\n * This is useful when the scene the flow graph should listen to changes\r\n * (e.g. when a new scene is loaded in an editor preview).\r\n * If the graph is currently running, it will be stopped first and must be\r\n * restarted manually after calling this method.\r\n * @param scene the new scene to attach to\r\n */\r\n public setScene(scene: Scene): void {\r\n if (scene === this._scene) {\r\n return;\r\n }\r\n if (this.state === FlowGraphState.Started) {\r\n this.stop();\r\n }\r\n // Tear down old event coordinator\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n // Clear execution contexts so start() creates fresh ones with the new scene.\r\n // NOTE: This intentionally discards user variables and connection values.\r\n // Callers that need to preserve them (e.g. the Flow Graph Editor) should\r\n // snapshot context state BEFORE calling setScene() and restore it in a\r\n // wrapped createContext() callback after start() re-creates contexts.\r\n this._executionContexts.length = 0;\r\n // Rebuild with the new scene\r\n (this as { _scene: Scene })._scene = scene;\r\n this._scene.constantlyUpdateMeshUnderPointer = true; // ensure pointer info is always up to date for event blocks that need it\r\n // Re-resolve node references (e.g. meshes targeted by Get/Set property blocks) against the\r\n // new scene. This is required when the graph was parsed before its scene was populated (for\r\n // example an editor that loads a graph from a snippet first and the referenced scene second):\r\n // the references would otherwise stay bound to nodes from the old/disposed scene.\r\n for (const block of this._allBlocks) {\r\n for (const input of block.dataInputs) {\r\n input._reresolveDefaultValueForScene(scene);\r\n }\r\n }\r\n this._sceneEventCoordinator = new FlowGraphSceneEventCoordinator(this._scene);\r\n // Pre-attach the event observer so that events from the new\r\n // coordinator are routed to the graph immediately. The handler\r\n // guards against processing events while the graph is stopped,\r\n // but having the observer in place ensures no events are lost\r\n // when start() is called shortly after.\r\n this._attachEventObserver();\r\n }\r\n\r\n /**\r\n * Create a context. A context represents one self contained execution for the graph, with its own variables.\r\n * @returns the context, where you can get and set variables\r\n */\r\n public createContext() {\r\n const context = new FlowGraphContext({ scene: this._scene, coordinator: this._coordinator, sceneEventCoordinator: this._sceneEventCoordinator });\r\n this._executionContexts.push(context);\r\n return context;\r\n }\r\n\r\n /**\r\n * Returns the execution context at a given index\r\n * @param index the index of the context\r\n * @returns the execution context at that index\r\n */\r\n public getContext(index: number) {\r\n return this._executionContexts[index];\r\n }\r\n\r\n /**\r\n * Returns the number of execution contexts currently attached to this graph.\r\n */\r\n public get contextCount(): number {\r\n return this._executionContexts.length;\r\n }\r\n\r\n /**\r\n * Remove an execution context by index. Any pending async blocks on\r\n * the context are cleared before removal.\r\n * @param index the index of the context to remove\r\n * @returns the removed context, or undefined if the index was out of range\r\n */\r\n public removeContext(index: number): FlowGraphContext | undefined {\r\n if (index < 0 || index >= this._executionContexts.length) {\r\n return undefined;\r\n }\r\n const [removed] = this._executionContexts.splice(index, 1);\r\n removed._clearPendingBlocks();\r\n return removed;\r\n }\r\n\r\n /**\r\n * Returns all blocks registered in this graph, including disconnected ones.\r\n * @returns a read-only array of all blocks\r\n */\r\n public getAllBlocks(): readonly FlowGraphBlock[] {\r\n return this._allBlocks;\r\n }\r\n\r\n /**\r\n * Register a block with the graph. This does not wire any connections;\r\n * it simply ensures the block is tracked so that serialization, editor\r\n * display, and validation see it even when it is not reachable from an\r\n * event block.\r\n * @param block the block to register\r\n */\r\n public addBlock(block: FlowGraphBlock): void {\r\n if (this._allBlocks.indexOf(block) === -1) {\r\n this._allBlocks.push(block);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a block from the graph. Disconnects all of its ports and, if it\r\n * is an event block, unregisters it from the event-block lists.\r\n * @param block the block to remove\r\n */\r\n public removeBlock(block: FlowGraphBlock): void {\r\n const idx = this._allBlocks.indexOf(block);\r\n if (idx !== -1) {\r\n this._allBlocks.splice(idx, 1);\r\n }\r\n // If it is an event block, remove from the event-block registry\r\n if (block instanceof FlowGraphExecutionBlock && \"type\" in block) {\r\n const eventBlock = block as unknown as FlowGraphEventBlock;\r\n const list = this._eventBlocks[eventBlock.type];\r\n if (list) {\r\n const eIdx = list.indexOf(eventBlock);\r\n if (eIdx !== -1) {\r\n list.splice(eIdx, 1);\r\n }\r\n }\r\n }\r\n // If the block has pending async tasks (e.g. event subscriptions),\r\n // cancel them in all active execution contexts so deletion takes\r\n // effect immediately even while the graph is running.\r\n if (block instanceof FlowGraphAsyncExecutionBlock) {\r\n for (const context of this._executionContexts) {\r\n block._cancelPendingTasks(context);\r\n block._resetAfterCanceled(context);\r\n }\r\n }\r\n // Disconnect all ports\r\n for (const input of block.dataInputs) {\r\n input.disconnectFromAll();\r\n }\r\n for (const output of block.dataOutputs) {\r\n output.disconnectFromAll();\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalIn of block.signalInputs) {\r\n signalIn.disconnectFromAll();\r\n }\r\n for (const signalOut of block.signalOutputs) {\r\n signalOut.disconnectFromAll();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add an event block. When the graph is started, it will start listening to events\r\n * from the block and execute the graph when they are triggered.\r\n * @param block the event block to be added\r\n */\r\n public addEventBlock(block: FlowGraphEventBlock): void {\r\n this.addBlock(block);\r\n if (block.type === FlowGraphEventType.PointerOver || block.type === FlowGraphEventType.PointerOut) {\r\n this._scene.constantlyUpdateMeshUnderPointer = true;\r\n }\r\n\r\n this._eventBlocks[block.type].push(block);\r\n\r\n // if already started, sort and add to the pending\r\n if (this.state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n } else {\r\n this.onStateChangedObservable.addOnce((state) => {\r\n if (state === FlowGraphState.Started) {\r\n for (const context of this._executionContexts) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stops the flow graph. Cancels all pending tasks and clears execution contexts,\r\n * but keeps event blocks so the graph can be restarted.\r\n */\r\n public stop() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n }\r\n\r\n /**\r\n * Pauses the flow graph. Cancels pending tasks but keeps execution contexts and event blocks.\r\n * Call start() to resume.\r\n */\r\n public pause() {\r\n if (this.state !== FlowGraphState.Started) {\r\n return;\r\n }\r\n this._detachEventObserver();\r\n this.state = FlowGraphState.Paused;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n }\r\n }\r\n\r\n /**\r\n * Starts the flow graph. Initializes the event blocks and starts listening to events.\r\n * Can also be called to resume from a paused state.\r\n */\r\n public start() {\r\n if (this.state === FlowGraphState.Started) {\r\n return;\r\n }\r\n const resumingFromPause = this.state === FlowGraphState.Paused;\r\n if (this._executionContexts.length === 0) {\r\n this.createContext();\r\n }\r\n this._attachEventObserver();\r\n this.state = FlowGraphState.Started;\r\n this._startPendingEvents();\r\n // On a fresh start (not resume), fire the SceneReady event.\r\n // The coordinator's own scene-ready observer may have already\r\n // fired (and been lost) while the graph was stopped, so reset\r\n // the flag and handle the ready state ourselves.\r\n if (!resumingFromPause) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = false;\r\n if (this._scene.isReady(true)) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n } else {\r\n // Scene isn't ready yet (e.g. pending shader compilations after\r\n // a scene swap). Use executeWhenReady(true) which restarts the\r\n // readiness check loop — a plain addOnce on onReadyObservable\r\n // may never fire if the check loop already completed.\r\n this._scene.executeWhenReady(() => {\r\n if (this.state === FlowGraphState.Started && !this._sceneEventCoordinator.sceneReadyTriggered) {\r\n this._sceneEventCoordinator.sceneReadyTriggered = true;\r\n this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\r\n }\r\n }, true);\r\n }\r\n }\r\n }\r\n\r\n private _startPendingEvents() {\r\n for (const context of this._executionContexts) {\r\n for (const type in this._eventBlocks) {\r\n const order = this._getContextualOrder(type as FlowGraphEventType, context);\r\n for (const block of order) {\r\n block._startPendingTasks(context);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _getContextualOrder(type: FlowGraphEventType, context: FlowGraphContext): FlowGraphEventBlock[] {\r\n const order = this._eventBlocks[type].sort((a, b) => b.initPriority - a.initPriority);\r\n\r\n if (type === FlowGraphEventType.MeshPick) {\r\n const meshPickOrder = [] as FlowGraphEventBlock[];\r\n for (const block1 of order) {\r\n // If the block is a mesh pick, guarantee that picks of children meshes come before picks of parent meshes\r\n const mesh1 = (block1 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n let i = 0;\r\n for (; i < order.length; i++) {\r\n const block2 = order[i];\r\n const mesh2 = (block2 as FlowGraphMeshPickEventBlock).asset.getValue(context);\r\n if (mesh1 && mesh2 && _IsDescendantOf(mesh1, mesh2)) {\r\n break;\r\n }\r\n }\r\n meshPickOrder.splice(i, 0, block1);\r\n }\r\n return meshPickOrder;\r\n }\r\n return order;\r\n }\r\n\r\n /**\r\n * Disposes of the flow graph. Cancels any pending tasks and removes all event listeners.\r\n */\r\n public dispose() {\r\n if (this.state === FlowGraphState.Stopped) {\r\n return;\r\n }\r\n this.state = FlowGraphState.Stopped;\r\n for (const context of this._executionContexts) {\r\n context._clearPendingBlocks();\r\n context._clearPendingActivation();\r\n }\r\n this._executionContexts.length = 0;\r\n for (const type in this._eventBlocks) {\r\n this._eventBlocks[type as FlowGraphEventType].length = 0;\r\n }\r\n this._allBlocks.length = 0;\r\n this._detachEventObserver();\r\n this._sceneEventCoordinator.dispose();\r\n }\r\n\r\n /**\r\n * Executes a function in all blocks of a flow graph, starting with the event blocks.\r\n * @param visitor the function to execute.\r\n */\r\n public visitAllBlocks(visitor: (block: FlowGraphBlock) => void) {\r\n const visitList: FlowGraphBlock[] = [];\r\n const idsAddedToVisitList = new Set<string>();\r\n for (const type in this._eventBlocks) {\r\n for (const block of this._eventBlocks[type as FlowGraphEventType]) {\r\n visitList.push(block);\r\n idsAddedToVisitList.add(block.uniqueId);\r\n }\r\n }\r\n\r\n while (visitList.length > 0) {\r\n const block = visitList.pop()!;\r\n visitor(block);\r\n\r\n for (const dataIn of block.dataInputs) {\r\n for (const connection of dataIn._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n if (block instanceof FlowGraphExecutionBlock) {\r\n for (const signalOut of block.signalOutputs) {\r\n for (const connection of signalOut._connectedPoint) {\r\n if (!idsAddedToVisitList.has(connection._ownerBlock.uniqueId)) {\r\n visitList.push(connection._ownerBlock);\r\n idsAddedToVisitList.add(connection._ownerBlock.uniqueId);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Validates the flow graph and returns all issues found.\r\n * Uses the tracked block list for complete validation including unreachable block detection.\r\n * @returns The validation result containing errors and warnings.\r\n */\r\n public validate(): IFlowGraphValidationResult {\r\n return ValidateFlowGraphWithBlockList(this, this._allBlocks);\r\n }\r\n\r\n /**\r\n * Serializes a graph\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializeFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject.name = this.name;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.allBlocks = [];\r\n // Collect all blocks: traversal-reachable ones plus any registered\r\n // orphans in _allBlocks (e.g. disconnected blocks in the editor).\r\n const seen = new Set<string>();\r\n const serializeBlock = (block: FlowGraphBlock) => {\r\n if (seen.has(block.uniqueId)) {\r\n return;\r\n }\r\n seen.add(block.uniqueId);\r\n const serializedBlock: any = {};\r\n block.serialize(serializedBlock);\r\n serializationObject.allBlocks.push(serializedBlock);\r\n };\r\n this.visitAllBlocks(serializeBlock);\r\n for (const block of this._allBlocks) {\r\n serializeBlock(block);\r\n }\r\n serializationObject.executionContexts = [];\r\n for (const context of this._executionContexts) {\r\n const serializedContext: any = {};\r\n context.serialize(serializedContext, valueSerializeFunction);\r\n serializationObject.executionContexts.push(serializedContext);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -5,6 +5,7 @@ import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnect
|
|
|
5
5
|
import { type FlowGraphContext } from "./flowGraphContext.js";
|
|
6
6
|
import { type RichType } from "./flowGraphRichTypes.pure.js";
|
|
7
7
|
import { Observable } from "../Misc/observable.pure.js";
|
|
8
|
+
import { type Scene } from "../scene.js";
|
|
8
9
|
/**
|
|
9
10
|
* Represents a connection point for data.
|
|
10
11
|
* An unconnected input point can have a default value.
|
|
@@ -89,6 +90,19 @@ export declare class FlowGraphDataConnection<T> extends FlowGraphConnection<Flow
|
|
|
89
90
|
* @param context the context in which the value is reset
|
|
90
91
|
*/
|
|
91
92
|
resetToDefaultValue(context: FlowGraphContext): void;
|
|
93
|
+
/**
|
|
94
|
+
* Re-resolves this input's default value against a (new) scene when the value is a node reference.
|
|
95
|
+
* This handles two cases that occur when a graph is moved to a different scene (see
|
|
96
|
+
* {@link FlowGraph.setScene}):
|
|
97
|
+
* - the value is still an unresolved serialized reference (`{ id, name, className, uniqueId }`)
|
|
98
|
+
* because the node did not yet exist in the scene at parse time, or
|
|
99
|
+
* - the value is a node that belongs to a different (e.g. disposed) scene.
|
|
100
|
+
* Values that are not node references (numbers, vectors, matrices, etc.) are left untouched, and
|
|
101
|
+
* the default value is only replaced when a matching node is found in the new scene.
|
|
102
|
+
* @param scene the scene to resolve the reference against
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
_reresolveDefaultValueForScene(scene: Scene): void;
|
|
92
106
|
/**
|
|
93
107
|
* Connect this point to another point.
|
|
94
108
|
* @param point the point to connect to.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
2
|
import { FlowGraphConnection } from "./flowGraphConnection.js";
|
|
3
3
|
import { Observable } from "../Misc/observable.pure.js";
|
|
4
|
-
import { defaultValueSerializationFunction } from "./serialization.js";
|
|
4
|
+
import { defaultValueSerializationFunction, GetSceneNodeFromSerializedReference } from "./serialization.js";
|
|
5
5
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
6
6
|
/**
|
|
7
7
|
* Represents a connection point for data.
|
|
@@ -103,6 +103,43 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
103
103
|
resetToDefaultValue(context) {
|
|
104
104
|
context._setConnectionValue(this, this._defaultValue);
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Re-resolves this input's default value against a (new) scene when the value is a node reference.
|
|
108
|
+
* This handles two cases that occur when a graph is moved to a different scene (see
|
|
109
|
+
* {@link FlowGraph.setScene}):
|
|
110
|
+
* - the value is still an unresolved serialized reference (`{ id, name, className, uniqueId }`)
|
|
111
|
+
* because the node did not yet exist in the scene at parse time, or
|
|
112
|
+
* - the value is a node that belongs to a different (e.g. disposed) scene.
|
|
113
|
+
* Values that are not node references (numbers, vectors, matrices, etc.) are left untouched, and
|
|
114
|
+
* the default value is only replaced when a matching node is found in the new scene.
|
|
115
|
+
* @param scene the scene to resolve the reference against
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
_reresolveDefaultValueForScene(scene) {
|
|
119
|
+
const value = this._defaultValue;
|
|
120
|
+
if (!value || typeof value !== "object") {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
let reference;
|
|
124
|
+
if (typeof value.getClassName === "function" && typeof value.getScene === "function") {
|
|
125
|
+
// A scene node — only rebind when it belongs to a different scene.
|
|
126
|
+
if (value.getScene() === scene) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
reference = { id: value.id, name: value.name, className: value.getClassName(), uniqueId: value.uniqueId };
|
|
130
|
+
}
|
|
131
|
+
else if (typeof value.className === "string" && (value.id || value.name) && value.value === undefined) {
|
|
132
|
+
// An unresolved serialized node reference left by the parser.
|
|
133
|
+
reference = value;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const node = GetSceneNodeFromSerializedReference(reference, scene);
|
|
139
|
+
if (node) {
|
|
140
|
+
this._defaultValue = node;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
106
143
|
/**
|
|
107
144
|
* Connect this point to another point.
|
|
108
145
|
* @param point the point to connect to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphDataConnection.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD;;;;;GAKG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAkB3G;;;;;;;;OAQG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;IAC5B;;OAEG;IACK,gBAAmB,QAAQ,CAAC,YAAY;IAChD;;OAEG;IACK,YAAqB,KAAK;QAElC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAVjC,aAAQ,GAAR,QAAQ,CAAa;QAIpB,kBAAa,GAAb,aAAa,CAA2B;QAIxC,cAAS,GAAT,SAAS,CAAiB;QAzC9B,gBAAW,GAAY,KAAK,CAAC;QACrC;;;WAGG;QACK,eAAU,GAAgB,IAAI,CAAC;QAEvC;;;WAGG;QACI,oBAAe,GAA8B,IAAI,CAAC;QAEzD;;WAEG;QACI,6BAAwB,GAAG,IAAI,UAAU,EAAK,CAAC;IA4BtD,CAAC;IAED;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5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AAC;QAC9C,iCAAiC,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAC/F,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC3C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"core/types\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type RichType } from \"./flowGraphRichTypes.pure\";\r\nimport { Observable } from \"core/Misc/observable.pure\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\n/**\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n private _isDisabled: boolean = false;\r\n /**\r\n * This is used for debugging purposes! It is the last value that was set to this connection with ANY context.\r\n * Do not use this value for anything else, as it might be wrong if used in a different context.\r\n */\r\n private _lastValue: Nullable<T> = null;\r\n\r\n /**\r\n * a data transformer function, if needed.\r\n * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.\r\n */\r\n public dataTransformer: Nullable<(value: T) => T> = null;\r\n\r\n /**\r\n * An observable that is triggered when the value of the connection changes.\r\n */\r\n public onValueChangedObservable = new Observable<T>();\r\n /**\r\n * Create a new data connection point.\r\n * @param name the name of the connection\r\n * @param connectionType the type of the connection\r\n * @param ownerBlock the block that owns this connection\r\n * @param richType the type of the data in this block\r\n * @param _defaultValue the default value of the connection\r\n * @param _optional if the connection is optional\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>,\r\n /**\r\n * [any] the default value of the connection\r\n */\r\n private _defaultValue: T = richType.defaultValue,\r\n /**\r\n * [false] if the connection is optional\r\n */\r\n private _optional: boolean = false\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * Whether or not the connection is optional.\r\n * Currently only used for UI control.\r\n */\r\n public get optional(): boolean {\r\n return this._optional;\r\n }\r\n\r\n /**\r\n * is this connection disabled\r\n * If the connection is disabled you will not be able to connect anything to it.\r\n */\r\n public get isDisabled(): boolean {\r\n return this._isDisabled;\r\n }\r\n\r\n public set isDisabled(value: boolean) {\r\n if (this._isDisabled === value) {\r\n return;\r\n }\r\n this._isDisabled = value;\r\n if (this._isDisabled) {\r\n this.disconnectFromAll();\r\n }\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n // check if the value is different\r\n if (context._getConnectionValue(this) === value) {\r\n return;\r\n }\r\n context._setConnectionValue(this, value);\r\n this.onValueChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Reset the value of the connection to the default value.\r\n * @param context the context in which the value is reset\r\n */\r\n public resetToDefaultValue(context: FlowGraphContext): void {\r\n context._setConnectionValue(this, this._defaultValue);\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n if (this._isDisabled) {\r\n return;\r\n }\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n const val = context._getConnectionValue(this) ?? this._defaultValue;\r\n return this.dataTransformer ? this.dataTransformer(val) : val;\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n const value = this._getValueOrDefault(context);\r\n this._lastValue = value;\r\n return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;\r\n }\r\n const value = !this.isConnected() ? this._getValueOrDefault(context) : this._connectedPoint[0].getValue(context);\r\n this._lastValue = value;\r\n return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getLastValue(): Nullable<T> {\r\n return this._lastValue;\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FlowGraphDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n serializationObject.optional = this._optional;\r\n defaultValueSerializationFunction(\"defaultValue\", this._defaultValue, serializationObject);\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphDataConnection.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphDataConnection(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"FlowGraphDataConnection\", FlowGraphDataConnection);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphDataConnection.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAkB3G;;;;;;;;OAQG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;IAC5B;;OAEG;IACK,gBAAmB,QAAQ,CAAC,YAAY;IAChD;;OAEG;IACK,YAAqB,KAAK;QAElC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAVjC,aAAQ,GAAR,QAAQ,CAAa;QAIpB,kBAAa,GAAb,aAAa,CAA2B;QAIxC,cAAS,GAAT,SAAS,CAAiB;QAzC9B,gBAAW,GAAY,KAAK,CAAC;QACrC;;;WAGG;QACK,eAAU,GAAgB,IAAI,CAAC;QAEvC;;;WAGG;QACI,oBAAe,GAA8B,IAAI,CAAC;QAEzD;;WAEG;QACI,6BAAwB,GAAG,IAAI,UAAU,EAAK,CAAC;IA4BtD,CAAC;IAED;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAc;QAChC,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;YAC7B,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,KAAK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\r\n\r\nimport { type Nullable } from \"core/types\";\r\nimport { type FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport { type FlowGraphContext } from \"./flowGraphContext\";\r\nimport { type RichType } from \"./flowGraphRichTypes.pure\";\r\nimport { Observable } from \"core/Misc/observable.pure\";\r\nimport { defaultValueSerializationFunction, GetSceneNodeFromSerializedReference } from \"./serialization\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { type Scene } from \"core/scene\";\r\n/**\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n private _isDisabled: boolean = false;\r\n /**\r\n * This is used for debugging purposes! It is the last value that was set to this connection with ANY context.\r\n * Do not use this value for anything else, as it might be wrong if used in a different context.\r\n */\r\n private _lastValue: Nullable<T> = null;\r\n\r\n /**\r\n * a data transformer function, if needed.\r\n * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.\r\n */\r\n public dataTransformer: Nullable<(value: T) => T> = null;\r\n\r\n /**\r\n * An observable that is triggered when the value of the connection changes.\r\n */\r\n public onValueChangedObservable = new Observable<T>();\r\n /**\r\n * Create a new data connection point.\r\n * @param name the name of the connection\r\n * @param connectionType the type of the connection\r\n * @param ownerBlock the block that owns this connection\r\n * @param richType the type of the data in this block\r\n * @param _defaultValue the default value of the connection\r\n * @param _optional if the connection is optional\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>,\r\n /**\r\n * [any] the default value of the connection\r\n */\r\n private _defaultValue: T = richType.defaultValue,\r\n /**\r\n * [false] if the connection is optional\r\n */\r\n private _optional: boolean = false\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * Whether or not the connection is optional.\r\n * Currently only used for UI control.\r\n */\r\n public get optional(): boolean {\r\n return this._optional;\r\n }\r\n\r\n /**\r\n * is this connection disabled\r\n * If the connection is disabled you will not be able to connect anything to it.\r\n */\r\n public get isDisabled(): boolean {\r\n return this._isDisabled;\r\n }\r\n\r\n public set isDisabled(value: boolean) {\r\n if (this._isDisabled === value) {\r\n return;\r\n }\r\n this._isDisabled = value;\r\n if (this._isDisabled) {\r\n this.disconnectFromAll();\r\n }\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n // check if the value is different\r\n if (context._getConnectionValue(this) === value) {\r\n return;\r\n }\r\n context._setConnectionValue(this, value);\r\n this.onValueChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Reset the value of the connection to the default value.\r\n * @param context the context in which the value is reset\r\n */\r\n public resetToDefaultValue(context: FlowGraphContext): void {\r\n context._setConnectionValue(this, this._defaultValue);\r\n }\r\n\r\n /**\r\n * Re-resolves this input's default value against a (new) scene when the value is a node reference.\r\n * This handles two cases that occur when a graph is moved to a different scene (see\r\n * {@link FlowGraph.setScene}):\r\n * - the value is still an unresolved serialized reference (`{ id, name, className, uniqueId }`)\r\n * because the node did not yet exist in the scene at parse time, or\r\n * - the value is a node that belongs to a different (e.g. disposed) scene.\r\n * Values that are not node references (numbers, vectors, matrices, etc.) are left untouched, and\r\n * the default value is only replaced when a matching node is found in the new scene.\r\n * @param scene the scene to resolve the reference against\r\n * @internal\r\n */\r\n public _reresolveDefaultValueForScene(scene: Scene): void {\r\n const value = this._defaultValue as any;\r\n if (!value || typeof value !== \"object\") {\r\n return;\r\n }\r\n\r\n let reference: { id?: string; name?: string; className?: string; uniqueId?: number } | undefined;\r\n if (typeof value.getClassName === \"function\" && typeof value.getScene === \"function\") {\r\n // A scene node — only rebind when it belongs to a different scene.\r\n if (value.getScene() === scene) {\r\n return;\r\n }\r\n reference = { id: value.id, name: value.name, className: value.getClassName(), uniqueId: value.uniqueId };\r\n } else if (typeof value.className === \"string\" && (value.id || value.name) && value.value === undefined) {\r\n // An unresolved serialized node reference left by the parser.\r\n reference = value;\r\n } else {\r\n return;\r\n }\r\n\r\n const node = GetSceneNodeFromSerializedReference(reference, scene);\r\n if (node) {\r\n this._defaultValue = node as unknown as T;\r\n }\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n if (this._isDisabled) {\r\n return;\r\n }\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n const val = context._getConnectionValue(this) ?? this._defaultValue;\r\n return this.dataTransformer ? this.dataTransformer(val) : val;\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n const value = this._getValueOrDefault(context);\r\n this._lastValue = value;\r\n return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;\r\n }\r\n const value = !this.isConnected() ? this._getValueOrDefault(context) : this._connectedPoint[0].getValue(context);\r\n this._lastValue = value;\r\n return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getLastValue(): Nullable<T> {\r\n return this._lastValue;\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FlowGraphDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n serializationObject.optional = this._optional;\r\n defaultValueSerializationFunction(\"defaultValue\", this._defaultValue, serializationObject);\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for flowGraphDataConnection.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterFlowGraphDataConnection(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"FlowGraphDataConnection\", FlowGraphDataConnection);\r\n}\r\n"]}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { type IAssetContainer } from "../IAssetContainer.js";
|
|
2
2
|
import { type Scene } from "../scene.js";
|
|
3
3
|
import { FlowGraphBlockNames } from "./Blocks/flowGraphBlockNames.js";
|
|
4
|
+
import { type Node } from "../node.js";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a serialized node reference (`{ id, name, className, uniqueId }`) to an actual scene node.
|
|
7
|
+
* Matching prefers `id` (falling back to `name`), then narrows by class name, then by `uniqueId`.
|
|
8
|
+
* Because `uniqueId` is reassigned every time a scene is built, it is only used as a tie-breaker so
|
|
9
|
+
* that references still resolve after a scene is reloaded (e.g. an editor preview).
|
|
10
|
+
* @param serializedReference the serialized reference to resolve
|
|
11
|
+
* @param scene the scene to resolve the reference against
|
|
12
|
+
* @returns the matching node, or undefined when none is found
|
|
13
|
+
*/
|
|
14
|
+
export declare function GetSceneNodeFromSerializedReference(serializedReference: any, scene: Scene): Node | undefined;
|
|
4
15
|
/**
|
|
5
16
|
* The default function that serializes values in a context object to a serialization object
|
|
6
17
|
* @param key the key where the value should be stored in the serialization object
|
|
@@ -18,7 +18,17 @@ function IsMatrixClassName(className) {
|
|
|
18
18
|
function IsAnimationGroupClassName(className) {
|
|
19
19
|
return className === "AnimationGroup";
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Resolves a serialized node reference (`{ id, name, className, uniqueId }`) to an actual scene node.
|
|
23
|
+
* Matching prefers `id` (falling back to `name`), then narrows by class name, then by `uniqueId`.
|
|
24
|
+
* Because `uniqueId` is reassigned every time a scene is built, it is only used as a tie-breaker so
|
|
25
|
+
* that references still resolve after a scene is reloaded (e.g. an editor preview).
|
|
26
|
+
* @param serializedReference the serialized reference to resolve
|
|
27
|
+
* @param scene the scene to resolve the reference against
|
|
28
|
+
* @returns the matching node, or undefined when none is found
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
|
+
export function GetSceneNodeFromSerializedReference(serializedReference, scene) {
|
|
22
32
|
if (!serializedReference || (!serializedReference.id && !serializedReference.name)) {
|
|
23
33
|
return undefined;
|
|
24
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAkB,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAErF,SAAS,iBAAiB,CAAC,SAAiB;IACxC,OAAO,CACH,SAAS,2CAA2B;QACpC,SAAS,2CAA2B;QACpC,SAAS,2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E,CAAC;YACnC,4EAA4E;YAC5E,gEAAgE;YAChE,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,iBAAiB,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,WAAW,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnJ,iCAAiC;gBACjC,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;oBAC/C,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;wBACjB,OAAO,GAAG,CAAC;oBACf,CAAC;oBACD,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG;wBACV,IAAI,EAAE,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAC;qBAC7C,CAAC;oBACF,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;wBACnC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;oBACxF,CAAC;oBACD,OAAO,GAAG,CAAC;gBACf,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,CAAC;iBAAM,CAAC;gBACJ,2CAA2C;gBAC3C,UAAU,GAAG,iBAAiB,CAAC;YACnC,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,UAAU,GAAG,iBAAiB,CAAC;QACnC,CAAC;IACL,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,gEAAgE;AAChE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAChD,0FAA0F;IAC1F,OAAO,SAAS,kFAA0C,CAAC;AAC/D,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Color3, Color4 } from \"../Maths/math.color.pure\";\r\nimport { Matrix, Quaternion, Vector2, Vector3, Vector4 } from \"../Maths/math.vector.pure\";\r\nimport { type Scene } from \"../scene\";\r\nimport { FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger.pure\";\r\nimport { FlowGraphTypes, getRichTypeByFlowGraphType } from \"./flowGraphRichTypes.pure\";\r\nimport { type Node } from \"core/node\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\nfunction IsVectorClassName(className: string) {\r\n return (\r\n className === FlowGraphTypes.Vector2 ||\r\n className === FlowGraphTypes.Vector3 ||\r\n className === FlowGraphTypes.Vector4 ||\r\n className === FlowGraphTypes.Quaternion ||\r\n className === FlowGraphTypes.Color3 ||\r\n className === FlowGraphTypes.Color4\r\n );\r\n}\r\n\r\nfunction IsMatrixClassName(className: string) {\r\n return className === FlowGraphTypes.Matrix || className === FlowGraphTypes.Matrix2D || className === FlowGraphTypes.Matrix3D;\r\n}\r\n\r\nfunction IsAnimationGroupClassName(className: string) {\r\n return className === \"AnimationGroup\";\r\n}\r\n\r\nfunction GetSceneNodeFromSerializedReference(serializedReference: any, scene: Scene): Node | undefined {\r\n if (!serializedReference || (!serializedReference.id && !serializedReference.name)) {\r\n return undefined;\r\n }\r\n\r\n const nodes = scene.getNodes().filter((node) => (serializedReference.id ? node.id === serializedReference.id : node.name === serializedReference.name));\r\n if (nodes.length === 0) {\r\n return undefined;\r\n }\r\n\r\n const className = serializedReference.type ?? serializedReference.className;\r\n const classMatches = className ? nodes.filter((node) => node.getClassName() === className) : [];\r\n const candidates = classMatches.length > 0 ? classMatches : nodes;\r\n return (serializedReference.uniqueId ? candidates.find((node) => node.uniqueId === serializedReference.uniqueId) : undefined) ?? candidates[0];\r\n}\r\n\r\nfunction ParseVector(className: string, value: Array<number>, flipHandedness = false) {\r\n if (className === FlowGraphTypes.Vector2) {\r\n return Vector2.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector3) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n }\r\n return Vector3.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector4) {\r\n return Vector4.FromArray(value);\r\n } else if (className === FlowGraphTypes.Quaternion) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n value[3] *= -1;\r\n }\r\n return Quaternion.FromArray(value);\r\n } else if (className === FlowGraphTypes.Color3) {\r\n return new Color3(value[0], value[1], value[2]);\r\n } else if (className === FlowGraphTypes.Color4) {\r\n return new Color4(value[0], value[1], value[2], value[3]);\r\n } else {\r\n throw new Error(`Unknown vector class name ${className}`);\r\n }\r\n}\r\n\r\n/**\r\n * The default function that serializes values in a context object to a serialization object\r\n * @param key the key where the value should be stored in the serialization object\r\n * @param value the value to store\r\n * @param serializationObject the object where the value will be stored\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n const className = value?.getClassName?.() ?? \"\";\r\n if (IsVectorClassName(className) || IsMatrixClassName(className)) {\r\n serializationObject[key] = {\r\n value: value.asArray(),\r\n className,\r\n };\r\n } else if (className === FlowGraphTypes.Integer) {\r\n serializationObject[key] = {\r\n value: value.value,\r\n className,\r\n };\r\n } else {\r\n if (className && (value.id || value.name)) {\r\n serializationObject[key] = {\r\n id: value.id,\r\n name: value.name,\r\n className,\r\n uniqueId: value.uniqueId,\r\n };\r\n } else {\r\n if (typeof value !== \"object\" || value === null) {\r\n serializationObject[key] = value;\r\n } else {\r\n // Skip known non-serializable keys immediately to avoid\r\n // expensive JSON.stringify attempts on large object trees\r\n // (e.g. pathConverter holds the entire glTF parse tree).\r\n if (key === \"pathConverter\") {\r\n return;\r\n }\r\n // Quick check: if any own property is a function, the object\r\n // is not JSON-safe and stringify would be wasteful.\r\n const hasFunction = Object.values(value).some((v) => typeof v === \"function\");\r\n if (hasFunction) {\r\n return;\r\n }\r\n // Plain object (e.g. parsed event config) — store it if JSON-safe.\r\n try {\r\n serializationObject[key] = JSON.parse(JSON.stringify(value));\r\n } catch {\r\n Logger.Warn(`FlowGraph serialization: value for key \"${key}\" is not JSON-serializable and was skipped.`);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The default function that parses values stored in a serialization object\r\n * @param key the key to the value that will be parsed\r\n * @param serializationObject the object that will be parsed\r\n * @param assetsContainer the assets container that will be used to find the objects\r\n * @param scene\r\n * @returns\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueParseFunction(key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) {\r\n const intermediateValue = serializationObject[key];\r\n let finalValue;\r\n const className = intermediateValue?.type ?? intermediateValue?.className;\r\n const sceneNode = GetSceneNodeFromSerializedReference(intermediateValue, scene);\r\n if (sceneNode) {\r\n finalValue = sceneNode;\r\n } else if (IsVectorClassName(className)) {\r\n finalValue = ParseVector(className, intermediateValue.value);\r\n } else if (IsAnimationGroupClassName(className)) {\r\n // do not use the scene.getAnimationGroupByName because it is possible that two AGs will have the same name\r\n const ags = scene.animationGroups.filter((ag) => ag.name === intermediateValue.name);\r\n // uniqueId changes on each load. this is used for the glTF loader, that uses serialization after the scene was loaded.\r\n finalValue = ags.length === 1 ? ags[0] : ags.find((ag) => ag.uniqueId === intermediateValue.uniqueId);\r\n } else if (className === FlowGraphTypes.Matrix) {\r\n finalValue = Matrix.FromArray(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix2D) {\r\n finalValue = new FlowGraphMatrix2D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix3D) {\r\n finalValue = new FlowGraphMatrix3D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Integer) {\r\n finalValue = FlowGraphInteger.FromValue(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Number || className === FlowGraphTypes.String || className === FlowGraphTypes.Boolean) {\r\n finalValue = intermediateValue.value[0];\r\n } else if (intermediateValue && intermediateValue.value !== undefined) {\r\n finalValue = intermediateValue.value;\r\n } else {\r\n if (Array.isArray(intermediateValue)) {\r\n // Check if this is an event configuration array (objects with id/eventData)\r\n // versus a plain array of primitives (e.g. variable name lists)\r\n if (intermediateValue.length > 0 && typeof intermediateValue[0] === \"object\" && intermediateValue[0] !== null && \"eventData\" in intermediateValue[0]) {\r\n // configuration data of an event\r\n finalValue = intermediateValue.reduce((acc, val) => {\r\n if (!val.eventData) {\r\n return acc;\r\n }\r\n acc[val.id] = {\r\n type: getRichTypeByFlowGraphType(val.type),\r\n };\r\n if (typeof val.value !== \"undefined\") {\r\n acc[val.id].value = defaultValueParseFunction(\"value\", val, assetsContainer, scene);\r\n }\r\n return acc;\r\n }, {});\r\n } else {\r\n // Plain array of primitives — return as-is\r\n finalValue = intermediateValue;\r\n }\r\n } else {\r\n finalValue = intermediateValue;\r\n }\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Given a name of a flow graph block class, return if this\r\n * class needs to be created with a path converter. Used in\r\n * parsing.\r\n * @param className the name of the flow graph block class\r\n * @returns a boolean indicating if the class needs a path converter\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function needsPathConverter(className: string) {\r\n // I am not using the ClassName property here because it was causing a circular dependency\r\n return className === FlowGraphBlockNames.JsonPointerParser;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/serialization.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAG1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAkB,0BAA0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,CAAC;AAED;;;;;;GAMG;AACH,gEAAgE;AAChE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAChD,0FAA0F;IAC1F,OAAO,SAAS,kFAA0C,CAAC;AAC/D,CAAC","sourcesContent":["import { type IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Color3, Color4 } from \"../Maths/math.color.pure\";\r\nimport { Matrix, Quaternion, Vector2, Vector3, Vector4 } from \"../Maths/math.vector.pure\";\r\nimport { type Scene } from \"../scene\";\r\nimport { FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger.pure\";\r\nimport { FlowGraphTypes, getRichTypeByFlowGraphType } from \"./flowGraphRichTypes.pure\";\r\nimport { type Node } from \"core/node\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\nfunction IsVectorClassName(className: string) {\r\n return (\r\n className === FlowGraphTypes.Vector2 ||\r\n className === FlowGraphTypes.Vector3 ||\r\n className === FlowGraphTypes.Vector4 ||\r\n className === FlowGraphTypes.Quaternion ||\r\n className === FlowGraphTypes.Color3 ||\r\n className === FlowGraphTypes.Color4\r\n );\r\n}\r\n\r\nfunction IsMatrixClassName(className: string) {\r\n return className === FlowGraphTypes.Matrix || className === FlowGraphTypes.Matrix2D || className === FlowGraphTypes.Matrix3D;\r\n}\r\n\r\nfunction IsAnimationGroupClassName(className: string) {\r\n return className === \"AnimationGroup\";\r\n}\r\n\r\n/**\r\n * Resolves a serialized node reference (`{ id, name, className, uniqueId }`) to an actual scene node.\r\n * Matching prefers `id` (falling back to `name`), then narrows by class name, then by `uniqueId`.\r\n * Because `uniqueId` is reassigned every time a scene is built, it is only used as a tie-breaker so\r\n * that references still resolve after a scene is reloaded (e.g. an editor preview).\r\n * @param serializedReference the serialized reference to resolve\r\n * @param scene the scene to resolve the reference against\r\n * @returns the matching node, or undefined when none is found\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function GetSceneNodeFromSerializedReference(serializedReference: any, scene: Scene): Node | undefined {\r\n if (!serializedReference || (!serializedReference.id && !serializedReference.name)) {\r\n return undefined;\r\n }\r\n\r\n const nodes = scene.getNodes().filter((node) => (serializedReference.id ? node.id === serializedReference.id : node.name === serializedReference.name));\r\n if (nodes.length === 0) {\r\n return undefined;\r\n }\r\n\r\n const className = serializedReference.type ?? serializedReference.className;\r\n const classMatches = className ? nodes.filter((node) => node.getClassName() === className) : [];\r\n const candidates = classMatches.length > 0 ? classMatches : nodes;\r\n return (serializedReference.uniqueId ? candidates.find((node) => node.uniqueId === serializedReference.uniqueId) : undefined) ?? candidates[0];\r\n}\r\n\r\nfunction ParseVector(className: string, value: Array<number>, flipHandedness = false) {\r\n if (className === FlowGraphTypes.Vector2) {\r\n return Vector2.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector3) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n }\r\n return Vector3.FromArray(value);\r\n } else if (className === FlowGraphTypes.Vector4) {\r\n return Vector4.FromArray(value);\r\n } else if (className === FlowGraphTypes.Quaternion) {\r\n if (flipHandedness) {\r\n value[2] *= -1;\r\n value[3] *= -1;\r\n }\r\n return Quaternion.FromArray(value);\r\n } else if (className === FlowGraphTypes.Color3) {\r\n return new Color3(value[0], value[1], value[2]);\r\n } else if (className === FlowGraphTypes.Color4) {\r\n return new Color4(value[0], value[1], value[2], value[3]);\r\n } else {\r\n throw new Error(`Unknown vector class name ${className}`);\r\n }\r\n}\r\n\r\n/**\r\n * The default function that serializes values in a context object to a serialization object\r\n * @param key the key where the value should be stored in the serialization object\r\n * @param value the value to store\r\n * @param serializationObject the object where the value will be stored\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueSerializationFunction(key: string, value: any, serializationObject: any) {\r\n const className = value?.getClassName?.() ?? \"\";\r\n if (IsVectorClassName(className) || IsMatrixClassName(className)) {\r\n serializationObject[key] = {\r\n value: value.asArray(),\r\n className,\r\n };\r\n } else if (className === FlowGraphTypes.Integer) {\r\n serializationObject[key] = {\r\n value: value.value,\r\n className,\r\n };\r\n } else {\r\n if (className && (value.id || value.name)) {\r\n serializationObject[key] = {\r\n id: value.id,\r\n name: value.name,\r\n className,\r\n uniqueId: value.uniqueId,\r\n };\r\n } else {\r\n if (typeof value !== \"object\" || value === null) {\r\n serializationObject[key] = value;\r\n } else {\r\n // Skip known non-serializable keys immediately to avoid\r\n // expensive JSON.stringify attempts on large object trees\r\n // (e.g. pathConverter holds the entire glTF parse tree).\r\n if (key === \"pathConverter\") {\r\n return;\r\n }\r\n // Quick check: if any own property is a function, the object\r\n // is not JSON-safe and stringify would be wasteful.\r\n const hasFunction = Object.values(value).some((v) => typeof v === \"function\");\r\n if (hasFunction) {\r\n return;\r\n }\r\n // Plain object (e.g. parsed event config) — store it if JSON-safe.\r\n try {\r\n serializationObject[key] = JSON.parse(JSON.stringify(value));\r\n } catch {\r\n Logger.Warn(`FlowGraph serialization: value for key \"${key}\" is not JSON-serializable and was skipped.`);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The default function that parses values stored in a serialization object\r\n * @param key the key to the value that will be parsed\r\n * @param serializationObject the object that will be parsed\r\n * @param assetsContainer the assets container that will be used to find the objects\r\n * @param scene\r\n * @returns\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function defaultValueParseFunction(key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) {\r\n const intermediateValue = serializationObject[key];\r\n let finalValue;\r\n const className = intermediateValue?.type ?? intermediateValue?.className;\r\n const sceneNode = GetSceneNodeFromSerializedReference(intermediateValue, scene);\r\n if (sceneNode) {\r\n finalValue = sceneNode;\r\n } else if (IsVectorClassName(className)) {\r\n finalValue = ParseVector(className, intermediateValue.value);\r\n } else if (IsAnimationGroupClassName(className)) {\r\n // do not use the scene.getAnimationGroupByName because it is possible that two AGs will have the same name\r\n const ags = scene.animationGroups.filter((ag) => ag.name === intermediateValue.name);\r\n // uniqueId changes on each load. this is used for the glTF loader, that uses serialization after the scene was loaded.\r\n finalValue = ags.length === 1 ? ags[0] : ags.find((ag) => ag.uniqueId === intermediateValue.uniqueId);\r\n } else if (className === FlowGraphTypes.Matrix) {\r\n finalValue = Matrix.FromArray(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix2D) {\r\n finalValue = new FlowGraphMatrix2D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Matrix3D) {\r\n finalValue = new FlowGraphMatrix3D(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Integer) {\r\n finalValue = FlowGraphInteger.FromValue(intermediateValue.value);\r\n } else if (className === FlowGraphTypes.Number || className === FlowGraphTypes.String || className === FlowGraphTypes.Boolean) {\r\n finalValue = intermediateValue.value[0];\r\n } else if (intermediateValue && intermediateValue.value !== undefined) {\r\n finalValue = intermediateValue.value;\r\n } else {\r\n if (Array.isArray(intermediateValue)) {\r\n // Check if this is an event configuration array (objects with id/eventData)\r\n // versus a plain array of primitives (e.g. variable name lists)\r\n if (intermediateValue.length > 0 && typeof intermediateValue[0] === \"object\" && intermediateValue[0] !== null && \"eventData\" in intermediateValue[0]) {\r\n // configuration data of an event\r\n finalValue = intermediateValue.reduce((acc, val) => {\r\n if (!val.eventData) {\r\n return acc;\r\n }\r\n acc[val.id] = {\r\n type: getRichTypeByFlowGraphType(val.type),\r\n };\r\n if (typeof val.value !== \"undefined\") {\r\n acc[val.id].value = defaultValueParseFunction(\"value\", val, assetsContainer, scene);\r\n }\r\n return acc;\r\n }, {});\r\n } else {\r\n // Plain array of primitives — return as-is\r\n finalValue = intermediateValue;\r\n }\r\n } else {\r\n finalValue = intermediateValue;\r\n }\r\n }\r\n return finalValue;\r\n}\r\n\r\n/**\r\n * Given a name of a flow graph block class, return if this\r\n * class needs to be created with a path converter. Used in\r\n * parsing.\r\n * @param className the name of the flow graph block class\r\n * @returns a boolean indicating if the class needs a path converter\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function needsPathConverter(className: string) {\r\n // I am not using the ClassName property here because it was causing a circular dependency\r\n return className === FlowGraphBlockNames.JsonPointerParser;\r\n}\r\n"]}
|
|
@@ -19,8 +19,8 @@ export declare class FrameGraphIblShadowsAccumulationTask extends FrameGraphTask
|
|
|
19
19
|
voxelGridSize: number;
|
|
20
20
|
/** Voxelization task providing the runtime voxelGridSize used by the accumulation shader. */
|
|
21
21
|
voxelizationTask?: FrameGraphIblShadowsVoxelizationTask;
|
|
22
|
-
protected
|
|
23
|
-
protected
|
|
22
|
+
protected _previousAccumulationTexture?: FrameGraphTextureHandle;
|
|
23
|
+
protected _previousPositionTexture?: FrameGraphTextureHandle;
|
|
24
24
|
readonly outputTexture: FrameGraphTextureHandle;
|
|
25
25
|
readonly postProcess: ThinCustomPostProcess;
|
|
26
26
|
protected readonly _postProcessDrawWrapper: DrawWrapper;
|
|
@@ -49,61 +49,42 @@ export class FrameGraphIblShadowsAccumulationTask extends FrameGraphTask {
|
|
|
49
49
|
const textureManager = this._frameGraph.textureManager;
|
|
50
50
|
const outputSize = textureManager.getTextureAbsoluteDimensions(this.sourceTexture);
|
|
51
51
|
const positionSize = textureManager.getTextureAbsoluteDimensions(this.positionTexture);
|
|
52
|
+
const sharedTextureOptions = {
|
|
53
|
+
createMipMaps: false,
|
|
54
|
+
samples: 1,
|
|
55
|
+
formats: [5],
|
|
56
|
+
useSRGBBuffers: [false],
|
|
57
|
+
creationFlags: [0],
|
|
58
|
+
};
|
|
52
59
|
const outputCreationOptions = {
|
|
53
60
|
size: outputSize,
|
|
54
61
|
sizeIsPercentage: false,
|
|
55
62
|
isHistoryTexture: false,
|
|
56
|
-
options: {
|
|
57
|
-
createMipMaps: false,
|
|
58
|
-
samples: 1,
|
|
59
|
-
types: [2],
|
|
60
|
-
formats: [5],
|
|
61
|
-
useSRGBBuffers: [false],
|
|
62
|
-
creationFlags: [0],
|
|
63
|
-
labels: [`${this.name} Output`],
|
|
64
|
-
},
|
|
63
|
+
options: { ...sharedTextureOptions, types: [2], labels: [`${this.name} Output`] },
|
|
65
64
|
};
|
|
66
|
-
|
|
67
|
-
const accumulationHistoryCreationOptions = {
|
|
65
|
+
const previousAccumulationCreationOptions = {
|
|
68
66
|
size: outputSize,
|
|
69
67
|
sizeIsPercentage: false,
|
|
70
|
-
isHistoryTexture:
|
|
71
|
-
options: {
|
|
72
|
-
createMipMaps: false,
|
|
73
|
-
samples: 1,
|
|
74
|
-
types: [2],
|
|
75
|
-
formats: [5],
|
|
76
|
-
useSRGBBuffers: [false],
|
|
77
|
-
creationFlags: [0],
|
|
78
|
-
labels: [`${this.name} History`],
|
|
79
|
-
},
|
|
68
|
+
isHistoryTexture: false,
|
|
69
|
+
options: { ...sharedTextureOptions, types: [2], labels: [`${this.name} Previous Accumulation`] },
|
|
80
70
|
};
|
|
81
|
-
const
|
|
71
|
+
const previousPositionCreationOptions = {
|
|
82
72
|
size: positionSize,
|
|
83
73
|
sizeIsPercentage: false,
|
|
84
|
-
isHistoryTexture:
|
|
85
|
-
options: {
|
|
86
|
-
createMipMaps: false,
|
|
87
|
-
samples: 1,
|
|
88
|
-
types: [2],
|
|
89
|
-
formats: [5],
|
|
90
|
-
useSRGBBuffers: [false],
|
|
91
|
-
creationFlags: [0],
|
|
92
|
-
labels: [`${this.name} Position History`],
|
|
93
|
-
},
|
|
74
|
+
isHistoryTexture: false,
|
|
75
|
+
options: { ...sharedTextureOptions, types: [2], labels: [`${this.name} Previous Position`] },
|
|
94
76
|
};
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
77
|
+
textureManager.resolveDanglingHandle(this.outputTexture, undefined, `${this.name} Output`, outputCreationOptions);
|
|
78
|
+
this._previousAccumulationTexture = textureManager.createRenderTargetTexture(`${this.name} Previous Accumulation`, previousAccumulationCreationOptions, this._previousAccumulationTexture);
|
|
79
|
+
this._previousPositionTexture = textureManager.createRenderTargetTexture(`${this.name} Previous Position`, previousPositionCreationOptions, this._previousPositionTexture);
|
|
80
|
+
// Pass 1: Accumulate into outputTexture, sampling last frame's accumulation and position.
|
|
97
81
|
const pass = this._frameGraph.addRenderPass(this.name);
|
|
98
82
|
pass.addDependencies(this.sourceTexture);
|
|
99
83
|
pass.addDependencies(this.velocityTexture);
|
|
100
84
|
pass.addDependencies(this.positionTexture);
|
|
101
|
-
pass.addDependencies(this.
|
|
102
|
-
pass.addDependencies(this.
|
|
103
|
-
|
|
104
|
-
// so oldAccumulationSampler reads previous-frame data automatically.
|
|
105
|
-
// A dedicated copy pass then exposes a stable current-frame outputTexture.
|
|
106
|
-
pass.setRenderTarget(this._accumulationHistoryTexture);
|
|
85
|
+
pass.addDependencies(this._previousAccumulationTexture);
|
|
86
|
+
pass.addDependencies(this._previousPositionTexture);
|
|
87
|
+
pass.setRenderTarget(this.outputTexture);
|
|
107
88
|
pass.setExecuteFunc((context) => {
|
|
108
89
|
context.setTextureSamplingMode(this.sourceTexture, 1);
|
|
109
90
|
context.setTextureSamplingMode(this.velocityTexture, 1);
|
|
@@ -113,8 +94,8 @@ export class FrameGraphIblShadowsAccumulationTask extends FrameGraphTask {
|
|
|
113
94
|
context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {
|
|
114
95
|
const effect = this._postProcessDrawWrapper.effect;
|
|
115
96
|
context.bindTextureHandle(effect, "spatialBlurSampler", this.sourceTexture);
|
|
116
|
-
context.bindTextureHandle(effect, "oldAccumulationSampler", this.
|
|
117
|
-
context.bindTextureHandle(effect, "prevPositionSampler", this.
|
|
97
|
+
context.bindTextureHandle(effect, "oldAccumulationSampler", this._previousAccumulationTexture);
|
|
98
|
+
context.bindTextureHandle(effect, "prevPositionSampler", this._previousPositionTexture);
|
|
118
99
|
context.bindTextureHandle(effect, "motionSampler", this.velocityTexture);
|
|
119
100
|
context.bindTextureHandle(effect, "positionSampler", this.positionTexture);
|
|
120
101
|
effect.setVector4("accumulationParameters", this._accumulationParams);
|
|
@@ -123,18 +104,29 @@ export class FrameGraphIblShadowsAccumulationTask extends FrameGraphTask {
|
|
|
123
104
|
this.reset = false;
|
|
124
105
|
this.isMoving = false;
|
|
125
106
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
107
|
+
// Pass 2: Copy the current frame's world-position into previousPositionTexture so the
|
|
108
|
+
// next frame's accumulation pass can use it as "previous frame positions".
|
|
109
|
+
const copyPositionToPreviousPass = this._frameGraph.addRenderPass(`${this.name} CopyPositionToPrevious`);
|
|
110
|
+
copyPositionToPreviousPass.addDependencies(this.positionTexture);
|
|
111
|
+
copyPositionToPreviousPass.setRenderTarget(this._previousPositionTexture);
|
|
112
|
+
copyPositionToPreviousPass.setExecuteFunc((context) => {
|
|
130
113
|
context.copyTexture(this.positionTexture);
|
|
131
114
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
115
|
+
// Pass 3: Copy the current frame's accumulation result into previousAccumulationTexture
|
|
116
|
+
// so the next frame's accumulation pass can use it as oldAccumulationSampler.
|
|
117
|
+
const copyAccumulationToPreviousPass = this._frameGraph.addRenderPass(`${this.name} CopyAccumulationToPrevious`);
|
|
118
|
+
copyAccumulationToPreviousPass.addDependencies(this.outputTexture);
|
|
119
|
+
copyAccumulationToPreviousPass.setRenderTarget(this._previousAccumulationTexture);
|
|
120
|
+
copyAccumulationToPreviousPass.setExecuteFunc((context) => {
|
|
121
|
+
context.copyTexture(this.outputTexture);
|
|
137
122
|
});
|
|
123
|
+
// Pass 4 (marker): empty execute, render target = outputTexture.
|
|
124
|
+
// Ensures _checkTask sees outputTexture as the task's last enabled-pass output,
|
|
125
|
+
// matching the disabled path. No render pass encoder is opened because the
|
|
126
|
+
// execute function never calls _applyRenderTarget.
|
|
127
|
+
const outputMarkerPass = this._frameGraph.addRenderPass(`${this.name} Output`);
|
|
128
|
+
outputMarkerPass.setRenderTarget(this.outputTexture);
|
|
129
|
+
outputMarkerPass.setExecuteFunc((_context) => { });
|
|
138
130
|
}
|
|
139
131
|
dispose() {
|
|
140
132
|
this.postProcess.dispose();
|