@babylonjs/core 7.51.1 → 7.51.3
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/animation.js +2 -1
- package/Animations/animation.js.map +1 -1
- package/Buffers/bufferUtils.d.ts +7 -5
- package/Buffers/bufferUtils.js +13 -9
- package/Buffers/bufferUtils.js.map +1 -1
- package/Engines/ICanvas.d.ts +96 -1
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +7 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +3 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +7 -1
- package/Engines/abstractEngine.js +10 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +32 -0
- package/Engines/constants.js +33 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/nativeEngine.d.ts +7 -1
- package/Engines/nativeEngine.js +12 -0
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +6 -3
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +111 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +141 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
- package/FlowGraph/Blocks/Data/Math/index.js +3 -0
- package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
- package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
- package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
- package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
- package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
- package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
- package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
- package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
- package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
- package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
- package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
- package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
- package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
- package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
- package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
- package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
- package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
- package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
- package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/index.d.ts +7 -3
- package/FlowGraph/Blocks/Data/index.js +9 -4
- package/FlowGraph/Blocks/Data/index.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
- package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
- package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
- package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
- package/FlowGraph/Blocks/Event/index.d.ts +3 -0
- package/FlowGraph/Blocks/Event/index.js +3 -0
- package/FlowGraph/Blocks/Event/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
- package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
- package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
- package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
- package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
- package/FlowGraph/Blocks/Execution/index.js +0 -3
- package/FlowGraph/Blocks/Execution/index.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
- package/FlowGraph/Blocks/index.d.ts +2 -0
- package/FlowGraph/Blocks/index.js +2 -0
- package/FlowGraph/Blocks/index.js.map +1 -1
- package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
- package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
- package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
- package/FlowGraph/CustomTypes/index.d.ts +2 -0
- package/FlowGraph/CustomTypes/index.js +3 -0
- package/FlowGraph/CustomTypes/index.js.map +1 -0
- package/FlowGraph/flowGraph.d.ts +29 -34
- package/FlowGraph/flowGraph.js +120 -104
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
- package/FlowGraph/flowGraphAssetsContext.js +52 -0
- package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
- package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
- package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
- package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +22 -15
- package/FlowGraph/flowGraphBlock.js +31 -52
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphConnection.d.ts +13 -12
- package/FlowGraph/flowGraphConnection.js +31 -16
- package/FlowGraph/flowGraphConnection.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +89 -13
- package/FlowGraph/flowGraphContext.js +210 -23
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
- package/FlowGraph/flowGraphCoordinator.js +4 -16
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
- package/FlowGraph/flowGraphDataConnection.js +73 -26
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
- package/FlowGraph/flowGraphEventBlock.js +13 -2
- package/FlowGraph/flowGraphEventBlock.js.map +1 -1
- package/FlowGraph/flowGraphEventType.d.ts +16 -0
- package/FlowGraph/flowGraphEventType.js +18 -0
- package/FlowGraph/flowGraphEventType.js.map +1 -0
- package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
- package/FlowGraph/flowGraphExecutionBlock.js +21 -2
- package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
- package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
- package/FlowGraph/flowGraphLogger.d.ts +60 -0
- package/FlowGraph/flowGraphLogger.js +53 -0
- package/FlowGraph/flowGraphLogger.js.map +1 -0
- package/FlowGraph/flowGraphParser.d.ts +85 -0
- package/FlowGraph/flowGraphParser.js +271 -0
- package/FlowGraph/flowGraphParser.js.map +1 -0
- package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
- package/FlowGraph/flowGraphPathConverter.js +3 -2
- package/FlowGraph/flowGraphPathConverter.js.map +1 -1
- package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
- package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
- package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
- package/FlowGraph/flowGraphRichTypes.js +160 -50
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
- package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
- package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
- package/FlowGraph/flowGraphSignalConnection.js +26 -9
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/index.d.ts +6 -1
- package/FlowGraph/index.js +7 -1
- package/FlowGraph/index.js.map +1 -1
- package/FlowGraph/serialization.d.ts +5 -2
- package/FlowGraph/serialization.js +94 -22
- package/FlowGraph/serialization.js.map +1 -1
- package/FlowGraph/typeDefinitions.d.ts +74 -12
- package/FlowGraph/typeDefinitions.js.map +1 -1
- package/FlowGraph/utils.d.ts +47 -0
- package/FlowGraph/utils.js +55 -0
- package/FlowGraph/utils.js.map +1 -1
- package/Layers/effectLayer.d.ts +5 -0
- package/Layers/effectLayer.js +7 -0
- package/Layers/effectLayer.js.map +1 -1
- package/Loading/sceneLoader.d.ts +25 -11
- package/Loading/sceneLoader.js +28 -11
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/material.js +1 -0
- package/Materials/material.js.map +1 -1
- package/Maths/math.path.js +3 -0
- package/Maths/math.path.js.map +1 -1
- package/Meshes/csg2.d.ts +2 -2
- package/Meshes/csg2.js +2 -2
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -1
- package/Meshes/geometry.js +8 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +5 -0
- package/Meshes/instancedMesh.js +6 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -1
- package/Meshes/mesh.js +3 -2
- package/Meshes/mesh.js.map +1 -1
- package/Misc/environmentTextureTools.js +2 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/ObjectModel/objectModelInterfaces.d.ts +2 -2
- package/ObjectModel/objectModelInterfaces.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +26 -18
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +8 -0
- package/scene.js.map +1 -1
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
- package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
- package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
- package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
- package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
- package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
- package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
- package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
- package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
- package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
- package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
- package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
- package/FlowGraph/flowGraphContextLogger.js +0 -14
- package/FlowGraph/flowGraphContextLogger.js.map +0 -1
- package/FlowGraph/flowGraphInteger.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { FlowGraphInteger } from "./CustomTypes/flowGraphInteger.js";
|
|
1
2
|
import { RichTypeFlowGraphInteger } from "./flowGraphRichTypes.js";
|
|
2
|
-
const pathHasTemplatesRegex = new RegExp(
|
|
3
|
+
const pathHasTemplatesRegex = new RegExp(/\/\{(\w+)\}\//g);
|
|
3
4
|
/**
|
|
4
5
|
* @experimental
|
|
5
6
|
* A component that converts a path to an object accessor.
|
|
@@ -13,16 +14,31 @@ export class FlowGraphPathConverterComponent {
|
|
|
13
14
|
*/
|
|
14
15
|
this.templatedInputs = [];
|
|
15
16
|
let match = pathHasTemplatesRegex.exec(path);
|
|
17
|
+
const templateSet = new Set();
|
|
16
18
|
while (match) {
|
|
17
19
|
const [, matchGroup] = match;
|
|
18
|
-
|
|
20
|
+
if (templateSet.has(matchGroup)) {
|
|
21
|
+
throw new Error("Duplicate template variable detected.");
|
|
22
|
+
}
|
|
23
|
+
templateSet.add(matchGroup);
|
|
24
|
+
this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger, new FlowGraphInteger(0)));
|
|
19
25
|
match = pathHasTemplatesRegex.exec(path);
|
|
20
26
|
}
|
|
21
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the accessor for the path.
|
|
30
|
+
* @param pathConverter the path converter to use to convert the path to an object accessor.
|
|
31
|
+
* @param context the context to use.
|
|
32
|
+
* @returns the accessor for the path.
|
|
33
|
+
* @throws if the value for a templated input is invalid.
|
|
34
|
+
*/
|
|
22
35
|
getAccessor(pathConverter, context) {
|
|
23
36
|
let finalPath = this.path;
|
|
24
37
|
for (const templatedInput of this.templatedInputs) {
|
|
25
38
|
const valueToReplace = templatedInput.getValue(context).value;
|
|
39
|
+
if (typeof valueToReplace !== "number" || valueToReplace < 0) {
|
|
40
|
+
throw new Error("Invalid value for templated input.");
|
|
41
|
+
}
|
|
26
42
|
finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());
|
|
27
43
|
}
|
|
28
44
|
return pathConverter.convert(finalPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphPathConverterComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathConverterComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flowGraphPathConverterComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathConverterComponent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,qBAAqB,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAKxC,YACW,IAAY,EACZ,UAA0B;QAD1B,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAgB;QANrC;;WAEG;QACa,oBAAe,GAAgD,EAAE,CAAC;QAK9E,IAAI,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;QACtC,OAAO,KAAK,EAAE,CAAC;YACX,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC;YAC7B,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAC7D,CAAC;YACD,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvH,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CAAC,aAAsD,EAAE,OAAyB;QAChG,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAChD,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;YAC9D,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;gBAC3D,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAC1D,CAAC;YACD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,IAAI,GAAG,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { IObjectInfo, IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { RichTypeFlowGraphInteger } from \"./flowGraphRichTypes\";\r\nimport type { IObjectAccessor } from \"./typeDefinitions\";\r\n\r\nconst pathHasTemplatesRegex = new RegExp(/\\/\\{(\\w+)\\}\\//g);\r\n\r\n/**\r\n * @experimental\r\n * A component that converts a path to an object accessor.\r\n */\r\nexport class FlowGraphPathConverterComponent {\r\n /**\r\n * The templated inputs for the provided path.\r\n */\r\n public readonly templatedInputs: FlowGraphDataConnection<FlowGraphInteger>[] = [];\r\n public constructor(\r\n public path: string,\r\n public ownerBlock: FlowGraphBlock\r\n ) {\r\n let match = pathHasTemplatesRegex.exec(path);\r\n const templateSet = new Set<string>();\r\n while (match) {\r\n const [, matchGroup] = match;\r\n if (templateSet.has(matchGroup)) {\r\n throw new Error(\"Duplicate template variable detected.\");\r\n }\r\n templateSet.add(matchGroup);\r\n this.templatedInputs.push(ownerBlock.registerDataInput(matchGroup, RichTypeFlowGraphInteger, new FlowGraphInteger(0)));\r\n match = pathHasTemplatesRegex.exec(path);\r\n }\r\n }\r\n\r\n /**\r\n * Get the accessor for the path.\r\n * @param pathConverter the path converter to use to convert the path to an object accessor.\r\n * @param context the context to use.\r\n * @returns the accessor for the path.\r\n * @throws if the value for a templated input is invalid.\r\n */\r\n public getAccessor(pathConverter: IPathToObjectConverter<IObjectAccessor>, context: FlowGraphContext): IObjectInfo<IObjectAccessor> {\r\n let finalPath = this.path;\r\n for (const templatedInput of this.templatedInputs) {\r\n const valueToReplace = templatedInput.getValue(context).value;\r\n if (typeof valueToReplace !== \"number\" || valueToReplace < 0) {\r\n throw new Error(\"Invalid value for templated input.\");\r\n }\r\n finalPath = finalPath.replace(`{${templatedInput.name}}`, valueToReplace.toString());\r\n }\r\n return pathConverter.convert(finalPath);\r\n }\r\n}\r\n"]}
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import { Vector2, Vector3, Vector4, Matrix, Quaternion } from "../Maths/math.vector";
|
|
2
2
|
import { Color3, Color4 } from "../Maths/math.color";
|
|
3
|
-
import { FlowGraphInteger } from "./flowGraphInteger";
|
|
3
|
+
import { FlowGraphInteger } from "./CustomTypes/flowGraphInteger";
|
|
4
|
+
import { FlowGraphMatrix2D, FlowGraphMatrix3D } from "./CustomTypes/flowGraphMatrix";
|
|
5
|
+
/**
|
|
6
|
+
* The types supported by the flow graph.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum FlowGraphTypes {
|
|
9
|
+
Any = "any",
|
|
10
|
+
String = "string",
|
|
11
|
+
Number = "number",
|
|
12
|
+
Boolean = "boolean",
|
|
13
|
+
Object = "object",
|
|
14
|
+
Integer = "FlowGraphInteger",
|
|
15
|
+
Vector2 = "Vector2",
|
|
16
|
+
Vector3 = "Vector3",
|
|
17
|
+
Vector4 = "Vector4",
|
|
18
|
+
Quaternion = "Quaternion",
|
|
19
|
+
Matrix = "Matrix",
|
|
20
|
+
Matrix2D = "Matrix2D",
|
|
21
|
+
Matrix3D = "Matrix3D",
|
|
22
|
+
Color3 = "Color3",
|
|
23
|
+
Color4 = "Color4"
|
|
24
|
+
}
|
|
4
25
|
/**
|
|
5
26
|
* A rich type represents extra information about a type,
|
|
6
27
|
* such as its name and a default value constructor.
|
|
7
|
-
* @experimental
|
|
8
28
|
*/
|
|
9
29
|
export declare class RichType<T> {
|
|
10
30
|
/**
|
|
@@ -15,6 +35,10 @@ export declare class RichType<T> {
|
|
|
15
35
|
* The default value of the type.
|
|
16
36
|
*/
|
|
17
37
|
defaultValue: T;
|
|
38
|
+
/**
|
|
39
|
+
* [-1] The ANIMATIONTYPE of the type, if available
|
|
40
|
+
*/
|
|
41
|
+
animationType: number;
|
|
18
42
|
constructor(
|
|
19
43
|
/**
|
|
20
44
|
* The name given to the type.
|
|
@@ -23,18 +47,16 @@ export declare class RichType<T> {
|
|
|
23
47
|
/**
|
|
24
48
|
* The default value of the type.
|
|
25
49
|
*/
|
|
26
|
-
defaultValue: T
|
|
50
|
+
defaultValue: T,
|
|
51
|
+
/**
|
|
52
|
+
* [-1] The ANIMATIONTYPE of the type, if available
|
|
53
|
+
*/
|
|
54
|
+
animationType?: number);
|
|
27
55
|
/**
|
|
28
56
|
* Serializes this rich type into a serialization object.
|
|
29
57
|
* @param serializationObject the object to serialize to
|
|
30
58
|
*/
|
|
31
59
|
serialize(serializationObject: any): void;
|
|
32
|
-
/**
|
|
33
|
-
* Parses a rich type from a serialization object.
|
|
34
|
-
* @param serializationObject a serialization object
|
|
35
|
-
* @returns the parsed rich type
|
|
36
|
-
*/
|
|
37
|
-
static Parse(serializationObject: any): RichType<any>;
|
|
38
60
|
}
|
|
39
61
|
export declare const RichTypeAny: RichType<any>;
|
|
40
62
|
export declare const RichTypeString: RichType<string>;
|
|
@@ -44,6 +66,8 @@ export declare const RichTypeVector2: RichType<Vector2>;
|
|
|
44
66
|
export declare const RichTypeVector3: RichType<Vector3>;
|
|
45
67
|
export declare const RichTypeVector4: RichType<Vector4>;
|
|
46
68
|
export declare const RichTypeMatrix: RichType<Matrix>;
|
|
69
|
+
export declare const RichTypeMatrix2D: RichType<FlowGraphMatrix2D>;
|
|
70
|
+
export declare const RichTypeMatrix3D: RichType<FlowGraphMatrix3D>;
|
|
47
71
|
export declare const RichTypeColor3: RichType<Color3>;
|
|
48
72
|
export declare const RichTypeColor4: RichType<Color4>;
|
|
49
73
|
export declare const RichTypeQuaternion: RichType<Quaternion>;
|
|
@@ -54,3 +78,21 @@ export declare const RichTypeFlowGraphInteger: RichType<FlowGraphInteger>;
|
|
|
54
78
|
* @returns the value's rich type, or RichTypeAny if the type could not be deduced.
|
|
55
79
|
*/
|
|
56
80
|
export declare function getRichTypeFromValue<T>(value: T): RichType<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Given a flow graph type, return the rich type that corresponds to it.
|
|
83
|
+
* @param flowGraphType the flow graph type
|
|
84
|
+
* @returns the rich type that corresponds to the flow graph type
|
|
85
|
+
*/
|
|
86
|
+
export declare function getRichTypeByFlowGraphType(flowGraphType?: string): RichType<any>;
|
|
87
|
+
/**
|
|
88
|
+
* get the animation type for a given flow graph type
|
|
89
|
+
* @param flowGraphType the flow graph type
|
|
90
|
+
* @returns the animation type for this flow graph type
|
|
91
|
+
*/
|
|
92
|
+
export declare function getAnimationTypeByFlowGraphType(flowGraphType: FlowGraphTypes): number;
|
|
93
|
+
/**
|
|
94
|
+
* Given an animation type, return the rich type that corresponds to it.
|
|
95
|
+
* @param animationType the animation type
|
|
96
|
+
* @returns the rich type that corresponds to the animation type
|
|
97
|
+
*/
|
|
98
|
+
export declare function getRichTypeByAnimationType(animationType: number): RichType<any>;
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import { Vector2, Vector3, Vector4, Matrix, Quaternion } from "../Maths/math.vector.js";
|
|
2
2
|
import { Color3, Color4 } from "../Maths/math.color.js";
|
|
3
|
-
import { FlowGraphInteger } from "./flowGraphInteger.js";
|
|
3
|
+
import { FlowGraphInteger } from "./CustomTypes/flowGraphInteger.js";
|
|
4
|
+
|
|
5
|
+
import { FlowGraphMatrix2D, FlowGraphMatrix3D } from "./CustomTypes/flowGraphMatrix.js";
|
|
6
|
+
/**
|
|
7
|
+
* The types supported by the flow graph.
|
|
8
|
+
*/
|
|
9
|
+
export var FlowGraphTypes;
|
|
10
|
+
(function (FlowGraphTypes) {
|
|
11
|
+
FlowGraphTypes["Any"] = "any";
|
|
12
|
+
FlowGraphTypes["String"] = "string";
|
|
13
|
+
FlowGraphTypes["Number"] = "number";
|
|
14
|
+
FlowGraphTypes["Boolean"] = "boolean";
|
|
15
|
+
FlowGraphTypes["Object"] = "object";
|
|
16
|
+
FlowGraphTypes["Integer"] = "FlowGraphInteger";
|
|
17
|
+
FlowGraphTypes["Vector2"] = "Vector2";
|
|
18
|
+
FlowGraphTypes["Vector3"] = "Vector3";
|
|
19
|
+
FlowGraphTypes["Vector4"] = "Vector4";
|
|
20
|
+
FlowGraphTypes["Quaternion"] = "Quaternion";
|
|
21
|
+
FlowGraphTypes["Matrix"] = "Matrix";
|
|
22
|
+
FlowGraphTypes["Matrix2D"] = "Matrix2D";
|
|
23
|
+
FlowGraphTypes["Matrix3D"] = "Matrix3D";
|
|
24
|
+
FlowGraphTypes["Color3"] = "Color3";
|
|
25
|
+
FlowGraphTypes["Color4"] = "Color4";
|
|
26
|
+
})(FlowGraphTypes || (FlowGraphTypes = {}));
|
|
4
27
|
/**
|
|
5
28
|
* A rich type represents extra information about a type,
|
|
6
29
|
* such as its name and a default value constructor.
|
|
7
|
-
* @experimental
|
|
8
30
|
*/
|
|
9
31
|
export class RichType {
|
|
10
32
|
constructor(
|
|
@@ -15,9 +37,14 @@ export class RichType {
|
|
|
15
37
|
/**
|
|
16
38
|
* The default value of the type.
|
|
17
39
|
*/
|
|
18
|
-
defaultValue
|
|
40
|
+
defaultValue,
|
|
41
|
+
/**
|
|
42
|
+
* [-1] The ANIMATIONTYPE of the type, if available
|
|
43
|
+
*/
|
|
44
|
+
animationType = -1) {
|
|
19
45
|
this.typeName = typeName;
|
|
20
46
|
this.defaultValue = defaultValue;
|
|
47
|
+
this.animationType = animationType;
|
|
21
48
|
}
|
|
22
49
|
/**
|
|
23
50
|
* Serializes this rich type into a serialization object.
|
|
@@ -27,65 +54,148 @@ export class RichType {
|
|
|
27
54
|
serializationObject.typeName = this.typeName;
|
|
28
55
|
serializationObject.defaultValue = this.defaultValue;
|
|
29
56
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Parses a rich type from a serialization object.
|
|
32
|
-
* @param serializationObject a serialization object
|
|
33
|
-
* @returns the parsed rich type
|
|
34
|
-
*/
|
|
35
|
-
static Parse(serializationObject) {
|
|
36
|
-
return new RichType(serializationObject.typeName, serializationObject.defaultValue);
|
|
37
|
-
}
|
|
38
57
|
}
|
|
39
|
-
export const RichTypeAny = new RichType("any"
|
|
40
|
-
export const RichTypeString = new RichType("string"
|
|
41
|
-
export const RichTypeNumber = new RichType("number", 0);
|
|
42
|
-
export const RichTypeBoolean = new RichType("boolean"
|
|
43
|
-
export const RichTypeVector2 = new RichType("Vector2"
|
|
44
|
-
export const RichTypeVector3 = new RichType("Vector3"
|
|
45
|
-
export const RichTypeVector4 = new RichType("Vector4"
|
|
46
|
-
export const RichTypeMatrix = new RichType("Matrix"
|
|
47
|
-
export const
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
50
|
-
export const
|
|
58
|
+
export const RichTypeAny = new RichType("any" /* FlowGraphTypes.Any */, undefined);
|
|
59
|
+
export const RichTypeString = new RichType("string" /* FlowGraphTypes.String */, "");
|
|
60
|
+
export const RichTypeNumber = new RichType("number" /* FlowGraphTypes.Number */, 0, 0);
|
|
61
|
+
export const RichTypeBoolean = new RichType("boolean" /* FlowGraphTypes.Boolean */, false);
|
|
62
|
+
export const RichTypeVector2 = new RichType("Vector2" /* FlowGraphTypes.Vector2 */, Vector2.Zero(), 5);
|
|
63
|
+
export const RichTypeVector3 = new RichType("Vector3" /* FlowGraphTypes.Vector3 */, Vector3.Zero(), 1);
|
|
64
|
+
export const RichTypeVector4 = new RichType("Vector4" /* FlowGraphTypes.Vector4 */, Vector4.Zero());
|
|
65
|
+
export const RichTypeMatrix = new RichType("Matrix" /* FlowGraphTypes.Matrix */, Matrix.Identity(), 3);
|
|
66
|
+
export const RichTypeMatrix2D = new RichType("Matrix2D" /* FlowGraphTypes.Matrix2D */, new FlowGraphMatrix2D());
|
|
67
|
+
export const RichTypeMatrix3D = new RichType("Matrix3D" /* FlowGraphTypes.Matrix3D */, new FlowGraphMatrix3D());
|
|
68
|
+
export const RichTypeColor3 = new RichType("Color3" /* FlowGraphTypes.Color3 */, Color3.Black(), 4);
|
|
69
|
+
export const RichTypeColor4 = new RichType("Color4" /* FlowGraphTypes.Color4 */, new Color4(0, 0, 0, 0), 7);
|
|
70
|
+
export const RichTypeQuaternion = new RichType("Quaternion" /* FlowGraphTypes.Quaternion */, Quaternion.Identity(), 2);
|
|
71
|
+
export const RichTypeFlowGraphInteger = new RichType("FlowGraphInteger" /* FlowGraphTypes.Integer */, new FlowGraphInteger(0), 0);
|
|
51
72
|
/**
|
|
52
73
|
* Given a value, try to deduce its rich type.
|
|
53
74
|
* @param value the value to deduce the rich type from
|
|
54
75
|
* @returns the value's rich type, or RichTypeAny if the type could not be deduced.
|
|
55
76
|
*/
|
|
56
77
|
export function getRichTypeFromValue(value) {
|
|
78
|
+
const anyValue = value;
|
|
57
79
|
switch (typeof value) {
|
|
58
|
-
case "string"
|
|
80
|
+
case "string" /* FlowGraphTypes.String */:
|
|
59
81
|
return RichTypeString;
|
|
60
|
-
case "number"
|
|
82
|
+
case "number" /* FlowGraphTypes.Number */:
|
|
61
83
|
return RichTypeNumber;
|
|
62
|
-
case "boolean"
|
|
84
|
+
case "boolean" /* FlowGraphTypes.Boolean */:
|
|
63
85
|
return RichTypeBoolean;
|
|
64
|
-
case "object"
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
case "object" /* FlowGraphTypes.Object */:
|
|
87
|
+
if (anyValue.getClassName) {
|
|
88
|
+
switch (anyValue.getClassName()) {
|
|
89
|
+
case "Vector2" /* FlowGraphTypes.Vector2 */:
|
|
90
|
+
return RichTypeVector2;
|
|
91
|
+
case "Vector3" /* FlowGraphTypes.Vector3 */:
|
|
92
|
+
return RichTypeVector3;
|
|
93
|
+
case "Vector4" /* FlowGraphTypes.Vector4 */:
|
|
94
|
+
return RichTypeVector4;
|
|
95
|
+
case "Matrix" /* FlowGraphTypes.Matrix */:
|
|
96
|
+
return RichTypeMatrix;
|
|
97
|
+
case "Color3" /* FlowGraphTypes.Color3 */:
|
|
98
|
+
return RichTypeColor3;
|
|
99
|
+
case "Color4" /* FlowGraphTypes.Color4 */:
|
|
100
|
+
return RichTypeColor4;
|
|
101
|
+
case "Quaternion" /* FlowGraphTypes.Quaternion */:
|
|
102
|
+
return RichTypeQuaternion;
|
|
103
|
+
case "FlowGraphInteger" /* FlowGraphTypes.Integer */:
|
|
104
|
+
return RichTypeFlowGraphInteger;
|
|
105
|
+
case "Matrix2D" /* FlowGraphTypes.Matrix2D */:
|
|
106
|
+
return RichTypeMatrix2D;
|
|
107
|
+
case "Matrix3D" /* FlowGraphTypes.Matrix3D */:
|
|
108
|
+
return RichTypeMatrix3D;
|
|
109
|
+
}
|
|
88
110
|
}
|
|
111
|
+
return RichTypeAny;
|
|
112
|
+
default:
|
|
113
|
+
return RichTypeAny;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Given a flow graph type, return the rich type that corresponds to it.
|
|
118
|
+
* @param flowGraphType the flow graph type
|
|
119
|
+
* @returns the rich type that corresponds to the flow graph type
|
|
120
|
+
*/
|
|
121
|
+
export function getRichTypeByFlowGraphType(flowGraphType) {
|
|
122
|
+
switch (flowGraphType) {
|
|
123
|
+
case "string" /* FlowGraphTypes.String */:
|
|
124
|
+
return RichTypeString;
|
|
125
|
+
case "number" /* FlowGraphTypes.Number */:
|
|
126
|
+
return RichTypeNumber;
|
|
127
|
+
case "boolean" /* FlowGraphTypes.Boolean */:
|
|
128
|
+
return RichTypeBoolean;
|
|
129
|
+
case "Vector2" /* FlowGraphTypes.Vector2 */:
|
|
130
|
+
return RichTypeVector2;
|
|
131
|
+
case "Vector3" /* FlowGraphTypes.Vector3 */:
|
|
132
|
+
return RichTypeVector3;
|
|
133
|
+
case "Vector4" /* FlowGraphTypes.Vector4 */:
|
|
134
|
+
return RichTypeVector4;
|
|
135
|
+
case "Matrix" /* FlowGraphTypes.Matrix */:
|
|
136
|
+
return RichTypeMatrix;
|
|
137
|
+
case "Color3" /* FlowGraphTypes.Color3 */:
|
|
138
|
+
return RichTypeColor3;
|
|
139
|
+
case "Color4" /* FlowGraphTypes.Color4 */:
|
|
140
|
+
return RichTypeColor4;
|
|
141
|
+
case "Quaternion" /* FlowGraphTypes.Quaternion */:
|
|
142
|
+
return RichTypeQuaternion;
|
|
143
|
+
case "FlowGraphInteger" /* FlowGraphTypes.Integer */:
|
|
144
|
+
return RichTypeFlowGraphInteger;
|
|
145
|
+
case "Matrix2D" /* FlowGraphTypes.Matrix2D */:
|
|
146
|
+
return RichTypeMatrix2D;
|
|
147
|
+
case "Matrix3D" /* FlowGraphTypes.Matrix3D */:
|
|
148
|
+
return RichTypeMatrix3D;
|
|
149
|
+
default:
|
|
150
|
+
return RichTypeAny;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* get the animation type for a given flow graph type
|
|
155
|
+
* @param flowGraphType the flow graph type
|
|
156
|
+
* @returns the animation type for this flow graph type
|
|
157
|
+
*/
|
|
158
|
+
export function getAnimationTypeByFlowGraphType(flowGraphType) {
|
|
159
|
+
switch (flowGraphType) {
|
|
160
|
+
case "number" /* FlowGraphTypes.Number */:
|
|
161
|
+
return 0;
|
|
162
|
+
case "Vector2" /* FlowGraphTypes.Vector2 */:
|
|
163
|
+
return 5;
|
|
164
|
+
case "Vector3" /* FlowGraphTypes.Vector3 */:
|
|
165
|
+
return 1;
|
|
166
|
+
case "Matrix" /* FlowGraphTypes.Matrix */:
|
|
167
|
+
return 3;
|
|
168
|
+
case "Color3" /* FlowGraphTypes.Color3 */:
|
|
169
|
+
return 4;
|
|
170
|
+
case "Color4" /* FlowGraphTypes.Color4 */:
|
|
171
|
+
return 7;
|
|
172
|
+
case "Quaternion" /* FlowGraphTypes.Quaternion */:
|
|
173
|
+
return 2;
|
|
174
|
+
default:
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Given an animation type, return the rich type that corresponds to it.
|
|
180
|
+
* @param animationType the animation type
|
|
181
|
+
* @returns the rich type that corresponds to the animation type
|
|
182
|
+
*/
|
|
183
|
+
export function getRichTypeByAnimationType(animationType) {
|
|
184
|
+
switch (animationType) {
|
|
185
|
+
case 0:
|
|
186
|
+
return RichTypeNumber;
|
|
187
|
+
case 5:
|
|
188
|
+
return RichTypeVector2;
|
|
189
|
+
case 1:
|
|
190
|
+
return RichTypeVector3;
|
|
191
|
+
case 3:
|
|
192
|
+
return RichTypeMatrix;
|
|
193
|
+
case 4:
|
|
194
|
+
return RichTypeColor3;
|
|
195
|
+
case 7:
|
|
196
|
+
return RichTypeColor4;
|
|
197
|
+
case 2:
|
|
198
|
+
return RichTypeQuaternion;
|
|
89
199
|
default:
|
|
90
200
|
return RichTypeAny;
|
|
91
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IACjB;IACI;;OAEG;IACI,QAAgB;IACvB;;OAEG;IACI,YAAe;QAJf,aAAQ,GAAR,QAAQ,CAAQ;QAIhB,iBAAY,GAAZ,YAAY,CAAG;IACvB,CAAC;IAEJ;;;OAGG;IACH,SAAS,CAAC,mBAAwB;QAC9B,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7C,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACzD,CAAC;IAED;;;;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,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,wBAAwB,GAA+B,IAAI,QAAQ,CAAC,kBAAkB,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9H;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAI,KAAQ;IAC5C,QAAQ,OAAO,KAAK,EAAE,CAAC;QACnB,KAAK,QAAQ;YACT,OAAO,cAA6B,CAAC;QACzC,KAAK,QAAQ;YACT,OAAO,cAA6B,CAAC;QACzC,KAAK,SAAS;YACV,OAAO,eAA8B,CAAC;QAC1C,KAAK,QAAQ;YACT,IAAI,KAAK,YAAY,OAAO,EAAE,CAAC;gBAC3B,OAAO,eAA8B,CAAC;YAC1C,CAAC;iBAAM,IAAI,KAAK,YAAY,OAAO,EAAE,CAAC;gBAClC,OAAO,eAA8B,CAAC;YAC1C,CAAC;iBAAM,IAAI,KAAK,YAAY,OAAO,EAAE,CAAC;gBAClC,OAAO,eAA8B,CAAC;YAC1C,CAAC;iBAAM,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;gBACjC,OAAO,cAA6B,CAAC;YACzC,CAAC;iBAAM,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;gBACjC,OAAO,cAA6B,CAAC;YACzC,CAAC;iBAAM,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;gBACrC,OAAO,kBAAiC,CAAC;YAC7C,CAAC;iBAAM,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;gBAC3C,OAAO,wBAAuC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACJ,OAAO,WAA0B,CAAC;YACtC,CAAC;QACL;YACI,OAAO,WAA0B,CAAC;IAC1C,CAAC;AACL,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { FlowGraphInteger } from \"./flowGraphInteger\";\r\n\r\n/**\r\n * A rich type represents extra information about a type,\r\n * such as its name and a default value constructor.\r\n * @experimental\r\n */\r\nexport class RichType<T> {\r\n constructor(\r\n /**\r\n * The name given to the type.\r\n */\r\n public typeName: string,\r\n /**\r\n * The default value of the type.\r\n */\r\n public defaultValue: T\r\n ) {}\r\n\r\n /**\r\n * Serializes this rich type into a serialization object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n serialize(serializationObject: any) {\r\n serializationObject.typeName = this.typeName;\r\n serializationObject.defaultValue = this.defaultValue;\r\n }\r\n\r\n /**\r\n * Parses a rich type from a serialization object.\r\n * @param serializationObject a serialization object\r\n * @returns the parsed rich type\r\n */\r\n static Parse(serializationObject: any): RichType<any> {\r\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\r\n }\r\n}\r\n\r\nexport const RichTypeAny: RichType<any> = new RichType(\"any\", undefined);\r\n\r\nexport const RichTypeString: RichType<string> = new RichType(\"string\", \"\");\r\n\r\nexport const RichTypeNumber: RichType<number> = new RichType(\"number\", 0);\r\n\r\nexport const RichTypeBoolean: RichType<boolean> = new RichType(\"boolean\", false);\r\n\r\nexport const RichTypeVector2: RichType<Vector2> = new RichType(\"Vector2\", Vector2.Zero());\r\n\r\nexport const RichTypeVector3: RichType<Vector3> = new RichType(\"Vector3\", Vector3.Zero());\r\n\r\nexport const RichTypeVector4: RichType<Vector4> = new RichType(\"Vector4\", Vector4.Zero());\r\n\r\nexport const RichTypeMatrix: RichType<Matrix> = new RichType(\"Matrix\", Matrix.Identity());\r\n\r\nexport const RichTypeColor3: RichType<Color3> = new RichType(\"Color3\", Color3.Black());\r\n\r\nexport const RichTypeColor4: RichType<Color4> = new RichType(\"Color4\", new Color4(0, 0, 0, 0));\r\n\r\nexport const RichTypeQuaternion: RichType<Quaternion> = new RichType(\"Quaternion\", Quaternion.Identity());\r\n\r\nexport const RichTypeFlowGraphInteger: RichType<FlowGraphInteger> = new RichType(\"FlowGraphInteger\", new FlowGraphInteger(0));\r\n\r\n/**\r\n * Given a value, try to deduce its rich type.\r\n * @param value the value to deduce the rich type from\r\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\r\n */\r\nexport function getRichTypeFromValue<T>(value: T): RichType<T> {\r\n switch (typeof value) {\r\n case \"string\":\r\n return RichTypeString as RichType<T>;\r\n case \"number\":\r\n return RichTypeNumber as RichType<T>;\r\n case \"boolean\":\r\n return RichTypeBoolean as RichType<T>;\r\n case \"object\":\r\n if (value instanceof Vector2) {\r\n return RichTypeVector2 as RichType<T>;\r\n } else if (value instanceof Vector3) {\r\n return RichTypeVector3 as RichType<T>;\r\n } else if (value instanceof Vector4) {\r\n return RichTypeVector4 as RichType<T>;\r\n } else if (value instanceof Color3) {\r\n return RichTypeColor3 as RichType<T>;\r\n } else if (value instanceof Color4) {\r\n return RichTypeColor4 as RichType<T>;\r\n } else if (value instanceof Quaternion) {\r\n return RichTypeQuaternion as RichType<T>;\r\n } else if (value instanceof FlowGraphInteger) {\r\n return RichTypeFlowGraphInteger as RichType<T>;\r\n } else {\r\n return RichTypeAny as RichType<T>;\r\n }\r\n default:\r\n return RichTypeAny as RichType<T>;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,gCAA+B;AACnD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAErF;;GAEG;AACH,MAAM,CAAN,IAAkB,cAgBjB;AAhBD,WAAkB,cAAc;IAC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;YACI,OAAO,SAAS,CAAC,mBAAmB,CAAC;QACzC;YACI,OAAO,SAAS,CAAC,qBAAqB,CAAC;QAC3C;YACI,OAAO,SAAS,CAAC,qBAAqB,CAAC;QAC3C;YACI,OAAO,SAAS,CAAC,oBAAoB,CAAC;QAC1C;YACI,OAAO,SAAS,CAAC,oBAAoB,CAAC;QAC1C;YACI,OAAO,SAAS,CAAC,oBAAoB,CAAC;QAC1C;YACI,OAAO,SAAS,CAAC,wBAAwB,CAAC;QAC9C;YACI,OAAO,SAAS,CAAC,mBAAmB,CAAC;IAC7C,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,aAAqB;IAC5D,QAAQ,aAAa,EAAE,CAAC;QACpB,KAAK,SAAS,CAAC,mBAAmB;YAC9B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,qBAAqB;YAChC,OAAO,eAAe,CAAC;QAC3B,KAAK,SAAS,CAAC,qBAAqB;YAChC,OAAO,eAAe,CAAC;QAC3B,KAAK,SAAS,CAAC,oBAAoB;YAC/B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,oBAAoB;YAC/B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,oBAAoB;YAC/B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,wBAAwB;YACnC,OAAO,kBAAkB,CAAC;QAC9B;YACI,OAAO,WAAW,CAAC;IAC3B,CAAC;AACL,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\n/**\r\n * The types supported by the flow graph.\r\n */\r\nexport const enum FlowGraphTypes {\r\n Any = \"any\",\r\n String = \"string\",\r\n Number = \"number\",\r\n Boolean = \"boolean\",\r\n Object = \"object\",\r\n Integer = \"FlowGraphInteger\",\r\n Vector2 = \"Vector2\",\r\n Vector3 = \"Vector3\",\r\n Vector4 = \"Vector4\",\r\n Quaternion = \"Quaternion\",\r\n Matrix = \"Matrix\",\r\n Matrix2D = \"Matrix2D\",\r\n Matrix3D = \"Matrix3D\",\r\n Color3 = \"Color3\",\r\n Color4 = \"Color4\",\r\n}\r\n\r\n/**\r\n * A rich type represents extra information about a type,\r\n * such as its name and a default value constructor.\r\n */\r\nexport class RichType<T> {\r\n constructor(\r\n /**\r\n * The name given to the type.\r\n */\r\n public typeName: string,\r\n /**\r\n * The default value of the type.\r\n */\r\n public defaultValue: T,\r\n\r\n /**\r\n * [-1] The ANIMATIONTYPE of the type, if available\r\n */\r\n public animationType: number = -1\r\n ) {}\r\n\r\n /**\r\n * Serializes this rich type into a serialization object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n serialize(serializationObject: any) {\r\n serializationObject.typeName = this.typeName;\r\n serializationObject.defaultValue = this.defaultValue;\r\n }\r\n}\r\n\r\nexport const RichTypeAny: RichType<any> = new RichType(FlowGraphTypes.Any, undefined);\r\n\r\nexport const RichTypeString: RichType<string> = new RichType(FlowGraphTypes.String, \"\");\r\n\r\nexport const RichTypeNumber: RichType<number> = new RichType(FlowGraphTypes.Number, 0, Constants.ANIMATIONTYPE_FLOAT);\r\n\r\nexport const RichTypeBoolean: RichType<boolean> = new RichType(FlowGraphTypes.Boolean, false);\r\n\r\nexport const RichTypeVector2: RichType<Vector2> = new RichType(FlowGraphTypes.Vector2, Vector2.Zero(), Constants.ANIMATIONTYPE_VECTOR2);\r\n\r\nexport const RichTypeVector3: RichType<Vector3> = new RichType(FlowGraphTypes.Vector3, Vector3.Zero(), Constants.ANIMATIONTYPE_VECTOR3);\r\n\r\nexport const RichTypeVector4: RichType<Vector4> = new RichType(FlowGraphTypes.Vector4, Vector4.Zero());\r\n\r\nexport const RichTypeMatrix: RichType<Matrix> = new RichType(FlowGraphTypes.Matrix, Matrix.Identity(), Constants.ANIMATIONTYPE_MATRIX);\r\n\r\nexport const RichTypeMatrix2D: RichType<FlowGraphMatrix2D> = new RichType(FlowGraphTypes.Matrix2D, new FlowGraphMatrix2D());\r\n\r\nexport const RichTypeMatrix3D: RichType<FlowGraphMatrix3D> = new RichType(FlowGraphTypes.Matrix3D, new FlowGraphMatrix3D());\r\n\r\nexport const RichTypeColor3: RichType<Color3> = new RichType(FlowGraphTypes.Color3, Color3.Black(), Constants.ANIMATIONTYPE_COLOR3);\r\n\r\nexport const RichTypeColor4: RichType<Color4> = new RichType(FlowGraphTypes.Color4, new Color4(0, 0, 0, 0), Constants.ANIMATIONTYPE_COLOR4);\r\n\r\nexport const RichTypeQuaternion: RichType<Quaternion> = new RichType(FlowGraphTypes.Quaternion, Quaternion.Identity(), Constants.ANIMATIONTYPE_QUATERNION);\r\n\r\nexport const RichTypeFlowGraphInteger: RichType<FlowGraphInteger> = new RichType(FlowGraphTypes.Integer, new FlowGraphInteger(0), Constants.ANIMATIONTYPE_FLOAT);\r\n\r\n/**\r\n * Given a value, try to deduce its rich type.\r\n * @param value the value to deduce the rich type from\r\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\r\n */\r\nexport function getRichTypeFromValue<T>(value: T): RichType<T> {\r\n const anyValue = value as any;\r\n switch (typeof value) {\r\n case FlowGraphTypes.String:\r\n return RichTypeString as RichType<T>;\r\n case FlowGraphTypes.Number:\r\n return RichTypeNumber as RichType<T>;\r\n case FlowGraphTypes.Boolean:\r\n return RichTypeBoolean as RichType<T>;\r\n case FlowGraphTypes.Object:\r\n if (anyValue.getClassName) {\r\n switch (anyValue.getClassName() as string) {\r\n case FlowGraphTypes.Vector2:\r\n return RichTypeVector2 as RichType<T>;\r\n case FlowGraphTypes.Vector3:\r\n return RichTypeVector3 as RichType<T>;\r\n case FlowGraphTypes.Vector4:\r\n return RichTypeVector4 as RichType<T>;\r\n case FlowGraphTypes.Matrix:\r\n return RichTypeMatrix as RichType<T>;\r\n case FlowGraphTypes.Color3:\r\n return RichTypeColor3 as RichType<T>;\r\n case FlowGraphTypes.Color4:\r\n return RichTypeColor4 as RichType<T>;\r\n case FlowGraphTypes.Quaternion:\r\n return RichTypeQuaternion as RichType<T>;\r\n case FlowGraphTypes.Integer:\r\n return RichTypeFlowGraphInteger as RichType<T>;\r\n case FlowGraphTypes.Matrix2D:\r\n return RichTypeMatrix2D as RichType<T>;\r\n case FlowGraphTypes.Matrix3D:\r\n return RichTypeMatrix3D as RichType<T>;\r\n }\r\n }\r\n return RichTypeAny as RichType<T>;\r\n default:\r\n return RichTypeAny as RichType<T>;\r\n }\r\n}\r\n\r\n/**\r\n * Given a flow graph type, return the rich type that corresponds to it.\r\n * @param flowGraphType the flow graph type\r\n * @returns the rich type that corresponds to the flow graph type\r\n */\r\nexport function getRichTypeByFlowGraphType(flowGraphType?: string): RichType<any> {\r\n switch (flowGraphType) {\r\n case FlowGraphTypes.String:\r\n return RichTypeString;\r\n case FlowGraphTypes.Number:\r\n return RichTypeNumber;\r\n case FlowGraphTypes.Boolean:\r\n return RichTypeBoolean;\r\n case FlowGraphTypes.Vector2:\r\n return RichTypeVector2;\r\n case FlowGraphTypes.Vector3:\r\n return RichTypeVector3;\r\n case FlowGraphTypes.Vector4:\r\n return RichTypeVector4;\r\n case FlowGraphTypes.Matrix:\r\n return RichTypeMatrix;\r\n case FlowGraphTypes.Color3:\r\n return RichTypeColor3;\r\n case FlowGraphTypes.Color4:\r\n return RichTypeColor4;\r\n case FlowGraphTypes.Quaternion:\r\n return RichTypeQuaternion;\r\n case FlowGraphTypes.Integer:\r\n return RichTypeFlowGraphInteger;\r\n case FlowGraphTypes.Matrix2D:\r\n return RichTypeMatrix2D;\r\n case FlowGraphTypes.Matrix3D:\r\n return RichTypeMatrix3D;\r\n default:\r\n return RichTypeAny;\r\n }\r\n}\r\n\r\n/**\r\n * get the animation type for a given flow graph type\r\n * @param flowGraphType the flow graph type\r\n * @returns the animation type for this flow graph type\r\n */\r\nexport function getAnimationTypeByFlowGraphType(flowGraphType: FlowGraphTypes): number {\r\n switch (flowGraphType) {\r\n case FlowGraphTypes.Number:\r\n return Constants.ANIMATIONTYPE_FLOAT;\r\n case FlowGraphTypes.Vector2:\r\n return Constants.ANIMATIONTYPE_VECTOR2;\r\n case FlowGraphTypes.Vector3:\r\n return Constants.ANIMATIONTYPE_VECTOR3;\r\n case FlowGraphTypes.Matrix:\r\n return Constants.ANIMATIONTYPE_MATRIX;\r\n case FlowGraphTypes.Color3:\r\n return Constants.ANIMATIONTYPE_COLOR3;\r\n case FlowGraphTypes.Color4:\r\n return Constants.ANIMATIONTYPE_COLOR4;\r\n case FlowGraphTypes.Quaternion:\r\n return Constants.ANIMATIONTYPE_QUATERNION;\r\n default:\r\n return Constants.ANIMATIONTYPE_FLOAT;\r\n }\r\n}\r\n\r\n/**\r\n * Given an animation type, return the rich type that corresponds to it.\r\n * @param animationType the animation type\r\n * @returns the rich type that corresponds to the animation type\r\n */\r\nexport function getRichTypeByAnimationType(animationType: number): RichType<any> {\r\n switch (animationType) {\r\n case Constants.ANIMATIONTYPE_FLOAT:\r\n return RichTypeNumber;\r\n case Constants.ANIMATIONTYPE_VECTOR2:\r\n return RichTypeVector2;\r\n case Constants.ANIMATIONTYPE_VECTOR3:\r\n return RichTypeVector3;\r\n case Constants.ANIMATIONTYPE_MATRIX:\r\n return RichTypeMatrix;\r\n case Constants.ANIMATIONTYPE_COLOR3:\r\n return RichTypeColor3;\r\n case Constants.ANIMATIONTYPE_COLOR4:\r\n return RichTypeColor4;\r\n case Constants.ANIMATIONTYPE_QUATERNION:\r\n return RichTypeQuaternion;\r\n default:\r\n return RichTypeAny;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Observable } from "../Misc/observable.js";
|
|
2
|
+
import type { Scene } from "../scene.js";
|
|
3
|
+
import { FlowGraphEventType } from "./flowGraphEventType";
|
|
4
|
+
/**
|
|
5
|
+
* the interface of the object the scene event coordinator will trigger.
|
|
6
|
+
*/
|
|
7
|
+
export interface IFlowGraphEventTrigger {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the event
|
|
10
|
+
*/
|
|
11
|
+
type: FlowGraphEventType;
|
|
12
|
+
/**
|
|
13
|
+
* The data of the event
|
|
14
|
+
*/
|
|
15
|
+
payload?: any;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This class is responsible for coordinating the events that are triggered in the scene.
|
|
19
|
+
* It registers all observers needed to track certain events and triggers the blocks that are listening to them.
|
|
20
|
+
* Abstracting the events from the class will allow us to easily change the events that are being listened to, and trigger them in any order.
|
|
21
|
+
*/
|
|
22
|
+
export declare class FlowGraphSceneEventCoordinator {
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
readonly _scene: Scene;
|
|
27
|
+
/**
|
|
28
|
+
* register to this observable to get flow graph event notifications.
|
|
29
|
+
*/
|
|
30
|
+
onEventTriggeredObservable: Observable<IFlowGraphEventTrigger>;
|
|
31
|
+
/**
|
|
32
|
+
* Was scene-ready already triggered?
|
|
33
|
+
*/
|
|
34
|
+
sceneReadyTriggered: boolean;
|
|
35
|
+
private _sceneDisposeObserver;
|
|
36
|
+
private _sceneReadyObserver;
|
|
37
|
+
private _sceneOnBeforeRenderObserver;
|
|
38
|
+
private _meshPickedObserver;
|
|
39
|
+
private _meshUnderPointerObserver;
|
|
40
|
+
private _pointerUnderMeshState;
|
|
41
|
+
private _startingTime;
|
|
42
|
+
constructor(scene: Scene);
|
|
43
|
+
private _initialize;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { PointerEventTypes } from "../Events/pointerEvents.js";
|
|
2
|
+
import { Observable } from "../Misc/observable.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class is responsible for coordinating the events that are triggered in the scene.
|
|
5
|
+
* It registers all observers needed to track certain events and triggers the blocks that are listening to them.
|
|
6
|
+
* Abstracting the events from the class will allow us to easily change the events that are being listened to, and trigger them in any order.
|
|
7
|
+
*/
|
|
8
|
+
export class FlowGraphSceneEventCoordinator {
|
|
9
|
+
constructor(scene) {
|
|
10
|
+
/**
|
|
11
|
+
* register to this observable to get flow graph event notifications.
|
|
12
|
+
*/
|
|
13
|
+
this.onEventTriggeredObservable = new Observable();
|
|
14
|
+
/**
|
|
15
|
+
* Was scene-ready already triggered?
|
|
16
|
+
*/
|
|
17
|
+
this.sceneReadyTriggered = false;
|
|
18
|
+
this._pointerUnderMeshState = {};
|
|
19
|
+
this._startingTime = 0;
|
|
20
|
+
this._scene = scene;
|
|
21
|
+
this._initialize();
|
|
22
|
+
}
|
|
23
|
+
_initialize() {
|
|
24
|
+
this._sceneReadyObserver = this._scene.onReadyObservable.add(() => {
|
|
25
|
+
if (!this.sceneReadyTriggered) {
|
|
26
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "SceneReady" /* FlowGraphEventType.SceneReady */ });
|
|
27
|
+
this.sceneReadyTriggered = true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {
|
|
31
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "SceneDispose" /* FlowGraphEventType.SceneDispose */ });
|
|
32
|
+
});
|
|
33
|
+
this._sceneOnBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {
|
|
34
|
+
const deltaTime = this._scene.getEngine().getDeltaTime() / 1000; // set in seconds
|
|
35
|
+
this.onEventTriggeredObservable.notifyObservers({
|
|
36
|
+
type: "SceneBeforeRender" /* FlowGraphEventType.SceneBeforeRender */,
|
|
37
|
+
payload: {
|
|
38
|
+
timeSinceStart: this._startingTime,
|
|
39
|
+
deltaTime,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
this._startingTime += deltaTime;
|
|
43
|
+
});
|
|
44
|
+
this._meshPickedObserver = this._scene.onPointerObservable.add((pointerInfo) => {
|
|
45
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "MeshPick" /* FlowGraphEventType.MeshPick */, payload: pointerInfo });
|
|
46
|
+
}, PointerEventTypes.POINTERPICK); // should it be pointerdown?
|
|
47
|
+
this._meshUnderPointerObserver = this._scene.onMeshUnderPointerUpdatedObservable.add((data) => {
|
|
48
|
+
// check if the data has changed. Check the state of the last change and see if it is a mesh or null.
|
|
49
|
+
// if it is a mesh and the previous state was null, trigger over event. If it is null and the previous state was a mesh, trigger out event.
|
|
50
|
+
// if it is a mesh and the previous state was a mesh, trigger out from the old mesh and over the new mesh
|
|
51
|
+
// if it is null and the previous state was null, do nothing.
|
|
52
|
+
const pointerId = data.pointerId;
|
|
53
|
+
const mesh = data.mesh;
|
|
54
|
+
const previousState = this._pointerUnderMeshState[pointerId];
|
|
55
|
+
if (!previousState && mesh) {
|
|
56
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "PointerOver" /* FlowGraphEventType.PointerOver */, payload: { pointerId, mesh } });
|
|
57
|
+
}
|
|
58
|
+
else if (previousState && !mesh) {
|
|
59
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "PointerOut" /* FlowGraphEventType.PointerOut */, payload: { pointerId, mesh: previousState } });
|
|
60
|
+
}
|
|
61
|
+
else if (previousState && mesh && previousState !== mesh) {
|
|
62
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "PointerOut" /* FlowGraphEventType.PointerOut */, payload: { pointerId, mesh: previousState, over: mesh } });
|
|
63
|
+
this.onEventTriggeredObservable.notifyObservers({ type: "PointerOver" /* FlowGraphEventType.PointerOver */, payload: { pointerId, mesh, out: previousState } });
|
|
64
|
+
}
|
|
65
|
+
this._pointerUnderMeshState[pointerId] = mesh;
|
|
66
|
+
}, PointerEventTypes.POINTERMOVE);
|
|
67
|
+
}
|
|
68
|
+
dispose() {
|
|
69
|
+
this._sceneDisposeObserver?.remove();
|
|
70
|
+
this._sceneReadyObserver?.remove();
|
|
71
|
+
this._sceneOnBeforeRenderObserver?.remove();
|
|
72
|
+
this._meshPickedObserver?.remove();
|
|
73
|
+
this._meshUnderPointerObserver?.remove();
|
|
74
|
+
this.onEventTriggeredObservable.clear();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=flowGraphSceneEventCoordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphSceneEventCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphSceneEventCoordinator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,mCAAkC;AAG9D,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAmBlD;;;;GAIG;AACH,MAAM,OAAO,8BAA8B;IAyBvC,YAAY,KAAY;QAnBxB;;WAEG;QACI,+BAA0B,GAAuC,IAAI,UAAU,EAAE,CAAC;QAEzF;;WAEG;QACI,wBAAmB,GAAY,KAAK,CAAC;QAOpC,2BAAsB,GAAoD,EAAE,CAAC;QAE7E,kBAAa,GAAW,CAAC,CAAC;QAG9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC9D,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAC5B,IAAI,CAAC,0BAA0B,CAAC,eAAe,CAAC,EAAE,IAAI,kDAA+B,EAAE,CAAC,CAAC;gBACzF,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;YACpC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;YAClE,IAAI,CAAC,0BAA0B,CAAC,eAAe,CA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type { AbstractMesh } from \"core/Meshes/abstractMesh\";\nimport type { Observer } from \"core/Misc/observable\";\nimport { Observable } from \"core/Misc/observable\";\nimport type { Scene } from \"core/scene\";\nimport type { Nullable } from \"core/types\";\nimport { FlowGraphEventType } from \"./flowGraphEventType\";\n\n/**\n * the interface of the object the scene event coordinator will trigger.\n */\nexport interface IFlowGraphEventTrigger {\n /**\n * The type of the event\n */\n type: FlowGraphEventType;\n /**\n * The data of the event\n */\n payload?: any;\n}\n\n/**\n * This class is responsible for coordinating the events that are triggered in the scene.\n * It registers all observers needed to track certain events and triggers the blocks that are listening to them.\n * Abstracting the events from the class will allow us to easily change the events that are being listened to, and trigger them in any order.\n */\nexport class FlowGraphSceneEventCoordinator {\n /**\n * @internal\n */\n public readonly _scene: Scene;\n\n /**\n * register to this observable to get flow graph event notifications.\n */\n public onEventTriggeredObservable: Observable<IFlowGraphEventTrigger> = new Observable();\n\n /**\n * Was scene-ready already triggered?\n */\n public sceneReadyTriggered: boolean = false;\n\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\n private _sceneReadyObserver: Nullable<Observer<Scene>>;\n private _sceneOnBeforeRenderObserver: Nullable<Observer<Scene>>;\n private _meshPickedObserver: Nullable<Observer<PointerInfo>>;\n private _meshUnderPointerObserver: Nullable<Observer<{ mesh: Nullable<AbstractMesh>; pointerId: number }>>;\n private _pointerUnderMeshState: { [pointerId: number]: Nullable<AbstractMesh> } = {};\n\n private _startingTime: number = 0;\n\n constructor(scene: Scene) {\n this._scene = scene;\n this._initialize();\n }\n\n private _initialize() {\n this._sceneReadyObserver = this._scene.onReadyObservable.add(() => {\n if (!this.sceneReadyTriggered) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneReady });\n this.sceneReadyTriggered = true;\n }\n });\n\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.SceneDispose });\n });\n this._sceneOnBeforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\n const deltaTime = this._scene.getEngine().getDeltaTime() / 1000; // set in seconds\n this.onEventTriggeredObservable.notifyObservers({\n type: FlowGraphEventType.SceneBeforeRender,\n payload: {\n timeSinceStart: this._startingTime,\n deltaTime,\n },\n });\n this._startingTime += deltaTime;\n });\n\n this._meshPickedObserver = this._scene.onPointerObservable.add((pointerInfo) => {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.MeshPick, payload: pointerInfo });\n }, PointerEventTypes.POINTERPICK); // should it be pointerdown?\n\n this._meshUnderPointerObserver = this._scene.onMeshUnderPointerUpdatedObservable.add((data) => {\n // check if the data has changed. Check the state of the last change and see if it is a mesh or null.\n // if it is a mesh and the previous state was null, trigger over event. If it is null and the previous state was a mesh, trigger out event.\n // if it is a mesh and the previous state was a mesh, trigger out from the old mesh and over the new mesh\n // if it is null and the previous state was null, do nothing.\n const pointerId = data.pointerId;\n const mesh = data.mesh;\n const previousState = this._pointerUnderMeshState[pointerId];\n if (!previousState && mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOver, payload: { pointerId, mesh } });\n } else if (previousState && !mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOut, payload: { pointerId, mesh: previousState } });\n } else if (previousState && mesh && previousState !== mesh) {\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOut, payload: { pointerId, mesh: previousState, over: mesh } });\n this.onEventTriggeredObservable.notifyObservers({ type: FlowGraphEventType.PointerOver, payload: { pointerId, mesh, out: previousState } });\n }\n this._pointerUnderMeshState[pointerId] = mesh;\n }, PointerEventTypes.POINTERMOVE);\n }\n\n public dispose() {\n this._sceneDisposeObserver?.remove();\n this._sceneReadyObserver?.remove();\n this._sceneOnBeforeRenderObserver?.remove();\n this._meshPickedObserver?.remove();\n this._meshUnderPointerObserver?.remove();\n this.onEventTriggeredObservable.clear();\n }\n}\n"]}
|
|
@@ -2,19 +2,22 @@ import type { FlowGraphExecutionBlock } from "./flowGraphExecutionBlock";
|
|
|
2
2
|
import { FlowGraphConnection } from "./flowGraphConnection";
|
|
3
3
|
import type { FlowGraphContext } from "./flowGraphContext";
|
|
4
4
|
/**
|
|
5
|
-
* @experimental
|
|
6
5
|
* Represents a connection point for a signal.
|
|
7
6
|
* When an output point is activated, it will activate the connected input point.
|
|
8
7
|
* When an input point is activated, it will execute the block it belongs to.
|
|
9
8
|
*/
|
|
10
9
|
export declare class FlowGraphSignalConnection extends FlowGraphConnection<FlowGraphExecutionBlock, FlowGraphSignalConnection> {
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* Optional payload. Can be used, for example, when an error is thrown to pass additional information.
|
|
12
|
+
*/
|
|
13
|
+
payload: any;
|
|
14
|
+
/**
|
|
15
|
+
* The priority of the signal. Signals with higher priority will be executed first.
|
|
16
|
+
* Set priority before adding the connection as sorting happens only when the connection is added.
|
|
16
17
|
*/
|
|
18
|
+
priority: number;
|
|
17
19
|
_isSingularConnection(): boolean;
|
|
20
|
+
connectTo(point: FlowGraphSignalConnection): void;
|
|
18
21
|
/**
|
|
19
22
|
* @internal
|
|
20
23
|
*/
|