@babylonjs/core 6.31.0 → 6.32.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.
Files changed (149) hide show
  1. package/Actions/action.js.map +1 -1
  2. package/Animations/animation.d.ts +8 -2
  3. package/Animations/animation.js +21 -13
  4. package/Animations/animation.js.map +1 -1
  5. package/Animations/runtimeAnimation.js +6 -15
  6. package/Animations/runtimeAnimation.js.map +1 -1
  7. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  8. package/Debug/skeletonViewer.d.ts +2 -2
  9. package/Debug/skeletonViewer.js +38 -12
  10. package/Debug/skeletonViewer.js.map +1 -1
  11. package/DeviceInput/InputDevices/deviceSource.js.map +1 -1
  12. package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
  13. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  14. package/Engines/Processors/shaderCodeNode.js.map +1 -1
  15. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  16. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  17. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  18. package/Engines/thinEngine.js +2 -2
  19. package/Engines/thinEngine.js.map +1 -1
  20. package/Engines/webgpuEngine.js.map +1 -1
  21. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +12 -12
  22. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
  23. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +4 -4
  24. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
  25. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +9 -9
  26. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
  27. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +11 -11
  28. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
  29. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +10 -10
  30. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +2 -2
  32. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  33. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +1 -1
  34. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  35. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +4 -4
  36. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +1 -1
  38. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  39. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +4 -4
  40. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  41. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +2 -2
  42. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  44. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  45. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +4 -4
  46. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +16 -6
  47. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  48. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +1 -0
  49. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +5 -1
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  51. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +1 -1
  52. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  53. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +17 -6
  54. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +16 -9
  55. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  56. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +1 -1
  57. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  58. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +1 -1
  59. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  60. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +1 -1
  61. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  62. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +1 -1
  63. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  64. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -1
  65. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  66. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -2
  67. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +2 -2
  69. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +1 -1
  71. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  72. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +4 -4
  73. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +1 -0
  75. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +8 -1
  76. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +1 -0
  78. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +5 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +2 -2
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +1 -1
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +1 -0
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +4 -0
  86. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  87. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +1 -0
  88. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +6 -1
  89. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  90. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +1 -1
  91. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +2 -2
  93. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +8 -12
  95. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +9 -19
  96. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  97. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +2 -2
  98. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  99. package/FlowGraph/flowGraphBlock.d.ts +2 -2
  100. package/FlowGraph/flowGraphBlock.js +20 -4
  101. package/FlowGraph/flowGraphBlock.js.map +1 -1
  102. package/FlowGraph/flowGraphContext.d.ts +4 -4
  103. package/FlowGraph/flowGraphContext.js +22 -40
  104. package/FlowGraph/flowGraphContext.js.map +1 -1
  105. package/FlowGraph/flowGraphPath.d.ts +27 -0
  106. package/FlowGraph/flowGraphPath.js +136 -0
  107. package/FlowGraph/flowGraphPath.js.map +1 -0
  108. package/FlowGraph/flowGraphPathComponent.d.ts +42 -0
  109. package/FlowGraph/flowGraphPathComponent.js +51 -0
  110. package/FlowGraph/flowGraphPathComponent.js.map +1 -0
  111. package/FlowGraph/index.d.ts +1 -0
  112. package/FlowGraph/index.js +1 -0
  113. package/FlowGraph/index.js.map +1 -1
  114. package/Lights/Shadows/shadowGenerator.d.ts +8 -0
  115. package/Lights/Shadows/shadowGenerator.js +12 -0
  116. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  117. package/Loading/sceneLoader.js.map +1 -1
  118. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  119. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  120. package/Materials/Node/Blocks/modBlock.js +1 -0
  121. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  122. package/Maths/math.size.d.ts +6 -0
  123. package/Maths/math.size.js +8 -0
  124. package/Maths/math.size.js.map +1 -1
  125. package/Maths/math.vector.js +1 -1
  126. package/Maths/math.vector.js.map +1 -1
  127. package/Meshes/geometry.d.ts +8 -0
  128. package/Meshes/geometry.js +20 -1
  129. package/Meshes/geometry.js.map +1 -1
  130. package/Meshes/mesh.d.ts +8 -0
  131. package/Meshes/mesh.js +14 -2
  132. package/Meshes/mesh.js.map +1 -1
  133. package/Meshes/mesh.vertexData.js.map +1 -1
  134. package/Misc/dds.js.map +1 -1
  135. package/Misc/greasedLineTools.js.map +1 -1
  136. package/Misc/tools.js.map +1 -1
  137. package/PostProcesses/postProcess.d.ts +9 -1
  138. package/PostProcesses/postProcess.js +16 -6
  139. package/PostProcesses/postProcess.js.map +1 -1
  140. package/Rendering/geometryBufferRenderer.d.ts +6 -3
  141. package/Rendering/geometryBufferRenderer.js +28 -10
  142. package/Rendering/geometryBufferRenderer.js.map +1 -1
  143. package/Rendering/geometryBufferRendererSceneComponent.d.ts +5 -2
  144. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  145. package/Shaders/ShadersInclude/bonesDeclaration.js +1 -1
  146. package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
  147. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  148. package/package.json +1 -1
  149. package/types.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,yBAAyB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBhD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAoCzB,YAAY,MAAsC;QAnClD;;WAEG;QAEI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAC/B;;WAEG;QACK,mBAAc,GAAqB,IAAI,GAAG,EAAE,CAAC;QACrD;;WAEG;QACK,w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AAE,KAAK,CAAC,CAAC;SACzC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC5C;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAjRU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * These are the variables defined by a user.\r\n */\r\n private _userVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: Map<string, any> = new Map();\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: Map<string, any> = new Map();\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return this._userVariables.has(name);\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables.set(name, value);\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables.get(name);\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables.set(this._getUniqueIdPrefixedName(block, name), value);\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables.get(this._getUniqueIdPrefixedName(block, name));\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n this._executionVariables.delete(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._executionVariables.has(this._getUniqueIdPrefixedName(block, name));\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return this._connectionValues.has(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues.set(connectionPoint.uniqueId, value);\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues.get(connectionPoint.uniqueId);\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n private _getEnclosedSubstring(subString: string): string {\r\n return `{${subString}}`;\r\n }\r\n\r\n /** @internal */\r\n public _getTargetFromPath(path: string, subString: string, block: FlowGraphBlock) {\r\n let finalPath = path;\r\n if (subString && path.indexOf(this._getEnclosedSubstring(subString)) !== -1) {\r\n const nodeToSub = block.getDataInput(subString);\r\n if (!nodeToSub) {\r\n throw new Error(`Invalid substitution input for substitution string ${subString}`);\r\n }\r\n const index = Math.floor(nodeToSub.getValue(this));\r\n if (isNaN(index)) {\r\n throw new Error(`Invalid substitution value for substitution string ${subString}`);\r\n }\r\n finalPath = path.replace(this._getEnclosedSubstring(subString), index.toString());\r\n }\r\n return this.getVariable(finalPath);\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n this._userVariables.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._userVariables);\r\n });\r\n serializationObject._connectionValues = {};\r\n this._connectionValues.forEach((value, key) => {\r\n valueSerializationFunction(key, value, serializationObject._connectionValues);\r\n });\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(\r\n serializationObject: any = {},\r\n graph: FlowGraph,\r\n valueParseFunction: (key: string, serializationObject: any, scene: Scene) => any = defaultValueParseFunction\r\n ): FlowGraphContext {\r\n const result = graph.createContext();\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables.set(key, value);\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues.set(key, value);\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"flowGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,yBAAyB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAE/F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBhD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAqCzB,YAAY,MAAsC;QApClD;;WAEG;QAEI,aAAQ,GAAG,UAAU,EAAE,CAAC;QAC/B;;;WAGG;QACI,mBAAc,GAA2B,EAAE,CAAC;QACnD;;WAEG;QACK,wBAAmB,GAA2B,EAAE,CAAC;QACzD;;WAEG;QACK,sBAAiB,GAA2B,EAAE,CAAC;QAKvD;;WAEG;QACK,mBAAc,GAAmC,EAAE,CAAC;QAC5D;;;WAGG;QACK,iBAAY,GAAG,CAAC,CAAC;QACzB;;WAEG;QAC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AAC,GAAG,KAAK,CAAC;SACtC;QACD,KAAK,MAAM,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;YACrD,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACzC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7PU;IADN,SAAS,EAAE;kDACmB","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { FlowGraphAsyncExecutionBlock } from \"./flowGraphAsyncExecutionBlock\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraph } from \"./flowGraph\";\r\nimport { defaultValueParseFunction, defaultValueSerializationFunction } from \"./serialization\";\r\nimport type { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\r\nimport { Observable } from \"../Misc/observable\";\r\n\r\n/**\r\n * Construction parameters for the context.\r\n * @experimental\r\n */\r\nexport interface IFlowGraphContextConfiguration {\r\n /**\r\n * The scene that the flow graph context belongs to.\r\n */\r\n readonly scene: Scene;\r\n /**\r\n * The event coordinator used by the flow graph context.\r\n */\r\n readonly coordinator: FlowGraphCoordinator;\r\n}\r\n/**\r\n * @experimental\r\n * The context represents the current state and execution of the flow graph.\r\n * It contains both user-defined variables, which are derived from\r\n * a more general variable definition, and execution variables that\r\n * are set by the blocks.\r\n */\r\nexport class FlowGraphContext {\r\n /**\r\n * A randomly generated GUID for each context.\r\n */\r\n @serialize()\r\n public uniqueId = RandomGUID();\r\n /**\r\n * @internal\r\n * These are the variables defined by a user.\r\n */\r\n public _userVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the blocks.\r\n */\r\n private _executionVariables: { [key: string]: any } = {};\r\n /**\r\n * These are the values for the data connection points\r\n */\r\n private _connectionValues: { [key: string]: any } = {};\r\n /**\r\n * These are the variables set by the graph.\r\n */\r\n private readonly _configuration: IFlowGraphContextConfiguration;\r\n /**\r\n * These are blocks that have currently pending tasks/listeners that need to be cleaned up.\r\n */\r\n private _pendingBlocks: FlowGraphAsyncExecutionBlock[] = [];\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n private _executionId = 0;\r\n /**\r\n * Observable that is triggered when a node is executed.\r\n */\r\n public onNodeExecutedObservable: Observable<FlowGraphBlock> = new Observable<FlowGraphBlock>();\r\n\r\n constructor(params: IFlowGraphContextConfiguration) {\r\n this._configuration = params;\r\n }\r\n\r\n /**\r\n * Check if a user-defined variable is defined.\r\n * @param name\r\n * @returns\r\n */\r\n public hasVariable(name: string) {\r\n return name in this._userVariables;\r\n }\r\n\r\n /**\r\n * Set a user-defined variable.\r\n * @param name\r\n * @param value\r\n */\r\n public setVariable(name: string, value: any) {\r\n this._userVariables[name] = value;\r\n }\r\n\r\n /**\r\n * Get a user-defined variable.\r\n * @param name\r\n * @returns\r\n */\r\n public getVariable(name: string): any {\r\n return this._userVariables[name];\r\n }\r\n\r\n private _getUniqueIdPrefixedName(obj: FlowGraphBlock, name: string): string {\r\n return `${obj.uniqueId}_${name}`;\r\n }\r\n\r\n /**\r\n * Set an internal execution variable\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public _setExecutionVariable(block: FlowGraphBlock, name: string, value: any) {\r\n this._executionVariables[this._getUniqueIdPrefixedName(block, name)] = value;\r\n }\r\n\r\n /**\r\n * Get an internal execution variable\r\n * @internal\r\n * @param name\r\n * @returns\r\n */\r\n public _getExecutionVariable(block: FlowGraphBlock, name: string, defaultValue?: any): any {\r\n if (this._hasExecutionVariable(block, name)) {\r\n return this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n\r\n /**\r\n * Delete an internal execution variable\r\n * @internal\r\n * @param block\r\n * @param name\r\n */\r\n public _deleteExecutionVariable(block: FlowGraphBlock, name: string) {\r\n delete this._executionVariables[this._getUniqueIdPrefixedName(block, name)];\r\n }\r\n\r\n /**\r\n * Check if an internal execution variable is defined\r\n * @internal\r\n * @param block\r\n * @param name\r\n * @returns\r\n */\r\n public _hasExecutionVariable(block: FlowGraphBlock, name: string) {\r\n return this._getUniqueIdPrefixedName(block, name) in this._executionVariables;\r\n }\r\n\r\n /**\r\n * Check if a connection value is defined\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _hasConnectionValue(connectionPoint: FlowGraphDataConnection<any>) {\r\n return connectionPoint.uniqueId in this._connectionValues;\r\n }\r\n\r\n /**\r\n * Set a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @param value\r\n */\r\n public _setConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>, value: T) {\r\n this._connectionValues[connectionPoint.uniqueId] = value;\r\n }\r\n\r\n /**\r\n * Get a connection value\r\n * @internal\r\n * @param connectionPoint\r\n * @returns\r\n */\r\n public _getConnectionValue<T>(connectionPoint: FlowGraphDataConnection<T>): T {\r\n return this._connectionValues[connectionPoint.uniqueId];\r\n }\r\n\r\n /**\r\n * Get the configuration\r\n * @internal\r\n * @param name\r\n * @param value\r\n */\r\n public get configuration() {\r\n return this._configuration;\r\n }\r\n\r\n /**\r\n * Add a block to the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _addPendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n this._pendingBlocks.push(block);\r\n }\r\n\r\n /**\r\n * Remove a block from the list of blocks that have pending tasks.\r\n * @internal\r\n * @param block\r\n */\r\n public _removePendingBlock(block: FlowGraphAsyncExecutionBlock) {\r\n const index = this._pendingBlocks.indexOf(block);\r\n if (index !== -1) {\r\n this._pendingBlocks.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Clear all pending blocks.\r\n * @internal\r\n */\r\n public _clearPendingBlocks() {\r\n for (const block of this._pendingBlocks) {\r\n block._cancelPendingTasks(this);\r\n }\r\n this._pendingBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n * Function that notifies the node executed observable\r\n * @param node\r\n */\r\n public _notifyExecuteNode(node: FlowGraphBlock) {\r\n this.onNodeExecutedObservable.notifyObservers(node);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _increaseExecutionId() {\r\n this._executionId++;\r\n }\r\n /**\r\n * A monotonically increasing ID for each execution.\r\n * Incremented for every block executed.\r\n */\r\n public get executionId() {\r\n return this._executionId;\r\n }\r\n\r\n /**\r\n * Serializes a context\r\n * @param serializationObject the object to write the values in\r\n * @param valueSerializationFunction a function to serialize complex values\r\n */\r\n public serialize(serializationObject: any = {}, valueSerializationFunction: (key: string, value: any, serializationObject: any) => void = defaultValueSerializationFunction) {\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject._userVariables = {};\r\n for (const key in this._userVariables) {\r\n valueSerializationFunction(key, this._userVariables[key], serializationObject._userVariables);\r\n }\r\n serializationObject._connectionValues = {};\r\n for (const key in this._connectionValues) {\r\n valueSerializationFunction(key, this._connectionValues[key], serializationObject._connectionValues);\r\n }\r\n }\r\n\r\n public getClassName() {\r\n return \"FGContext\";\r\n }\r\n\r\n /**\r\n * Parses a context\r\n * @param serializationObject the object containing the context serialization values\r\n * @param graph the graph to which the context should belong\r\n * @param valueParseFunction a function to parse complex values\r\n * @returns\r\n */\r\n public static Parse(\r\n serializationObject: any = {},\r\n graph: FlowGraph,\r\n valueParseFunction: (key: string, serializationObject: any, scene: Scene) => any = defaultValueParseFunction\r\n ): FlowGraphContext {\r\n const result = graph.createContext();\r\n result.uniqueId = serializationObject.uniqueId;\r\n for (const key in serializationObject._userVariables) {\r\n const value = valueParseFunction(key, serializationObject._userVariables, result._configuration.scene);\r\n result._userVariables[key] = value;\r\n }\r\n for (const key in serializationObject._connectionValues) {\r\n const value = valueParseFunction(key, serializationObject._connectionValues, result._configuration.scene);\r\n result._connectionValues[key] = value;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,27 @@
1
+ import type { FlowGraphContext } from "./flowGraphContext";
2
+ export declare class FlowGraphPath {
3
+ private _path;
4
+ private _templateSubstitutions;
5
+ private _pathParts;
6
+ private _templateStrings;
7
+ /**
8
+ * Whether this path has any template strings in it.
9
+ */
10
+ hasTemplateStrings: boolean;
11
+ constructor(path: string);
12
+ private _getPathPartsAndTemplateStrings;
13
+ /**
14
+ * Gets the template strings in this path.
15
+ * @returns an array containing the template strings in this path.
16
+ */
17
+ getTemplateStrings(): string[];
18
+ setTemplateSubstitution(template: string, value: number): void;
19
+ private _evaluateTemplates;
20
+ private _getFinalPath;
21
+ private _evaluatePath;
22
+ getProperty(context: FlowGraphContext): any;
23
+ setProperty(context: FlowGraphContext, value: any): void;
24
+ getClassName(): string;
25
+ serialize(serializationObject?: any): any;
26
+ Parse(serializationObject: any): FlowGraphPath;
27
+ }
@@ -0,0 +1,136 @@
1
+ import { RegisterClass } from "../Misc/typeStore.js";
2
+ // Path: /x/{y}/z/.../w
3
+ const PATH_REGEX = /([./])({?\w+}?)/g;
4
+ /*
5
+ * @experimental
6
+ * This class represents a path of type /x/{y}/z/.../w that is evaluated
7
+ * on a target object. The string between curly braces ({y} in the example)
8
+ * is a special template string that is replaced during runtime.
9
+ */
10
+ export class FlowGraphPath {
11
+ constructor(path) {
12
+ this._templateSubstitutions = {}; // this is a map of template strings to values that are substituted during runtime
13
+ this._pathParts = []; // this is the path divided into parts, with each part being either a template string or a regular string
14
+ this._templateStrings = []; // this is the list of template strings in the path
15
+ /**
16
+ * Whether this path has any template strings in it.
17
+ */
18
+ this.hasTemplateStrings = false;
19
+ this._path = path;
20
+ const { pathParts, templateStrings } = this._getPathPartsAndTemplateStrings(path);
21
+ this._pathParts = pathParts;
22
+ this._templateStrings = templateStrings;
23
+ this.hasTemplateStrings = templateStrings.length > 0;
24
+ }
25
+ _getPathPartsAndTemplateStrings(path) {
26
+ const allMatches = path.matchAll(PATH_REGEX);
27
+ const pathParts = [];
28
+ const templateStrings = [];
29
+ let nextMatch = allMatches.next();
30
+ while (!nextMatch.done) {
31
+ const singleMatch = nextMatch.value;
32
+ const [, separator, value] = singleMatch;
33
+ let valueWithoutBraces = value;
34
+ let isTemplate = false;
35
+ if (value.startsWith("{") && value.endsWith("}")) {
36
+ isTemplate = true;
37
+ valueWithoutBraces = value.slice(1, value.length - 1);
38
+ if (templateStrings.indexOf(valueWithoutBraces) === -1) {
39
+ templateStrings.push(valueWithoutBraces);
40
+ }
41
+ }
42
+ pathParts.push({
43
+ value,
44
+ isTemplate,
45
+ valueWithoutBraces,
46
+ separator,
47
+ });
48
+ nextMatch = allMatches.next();
49
+ }
50
+ return { pathParts, templateStrings };
51
+ }
52
+ /**
53
+ * Gets the template strings in this path.
54
+ * @returns an array containing the template strings in this path.
55
+ */
56
+ getTemplateStrings() {
57
+ return this._templateStrings;
58
+ }
59
+ setTemplateSubstitution(template, value) {
60
+ if (this._templateStrings.indexOf(template) === -1) {
61
+ throw new Error(`Template string ${template} does not exist in path ${this._path}`);
62
+ }
63
+ this._templateSubstitutions[template] = value;
64
+ }
65
+ _evaluateTemplates() {
66
+ for (const pathPart of this._pathParts) {
67
+ if (pathPart.isTemplate) {
68
+ const value = this._templateSubstitutions[pathPart.valueWithoutBraces];
69
+ if (value === undefined) {
70
+ throw new Error(`Template string ${pathPart.value} was not substituted`);
71
+ }
72
+ pathPart.replacedValue = value.toString();
73
+ }
74
+ }
75
+ }
76
+ _getFinalPath() {
77
+ let finalPath = "";
78
+ for (const pathPart of this._pathParts) {
79
+ finalPath += pathPart.separator;
80
+ if (pathPart.isTemplate) {
81
+ finalPath += pathPart.replacedValue;
82
+ }
83
+ else {
84
+ finalPath += pathPart.value;
85
+ }
86
+ }
87
+ return finalPath;
88
+ }
89
+ /*
90
+ * Breaks the path into a chain of entities, for example,
91
+ * /x/y/z would be split into [context._userVariables.x, context._userVariables.x.y, context._userVariables.x.y.z],
92
+ * and the path that was split, i.e. /x/y/z, would be split into ["x", "y", "z"].
93
+ */
94
+ _evaluatePath(context) {
95
+ this._evaluateTemplates();
96
+ const entityChain = [];
97
+ const splitPath = [];
98
+ let currentTarget = context._userVariables;
99
+ for (const pathPart of this._pathParts) {
100
+ if (currentTarget === undefined) {
101
+ throw new Error(`Could not find path ${this._getFinalPath()} in target context`);
102
+ }
103
+ const value = pathPart.isTemplate ? pathPart.replacedValue : pathPart.value;
104
+ if (!value) {
105
+ throw new Error(`Invalid path ${this._getFinalPath()}`);
106
+ }
107
+ currentTarget = currentTarget[value];
108
+ entityChain.push(currentTarget);
109
+ splitPath.push(value);
110
+ }
111
+ return { entityChain, splitPath };
112
+ }
113
+ getProperty(context) {
114
+ const { entityChain } = this._evaluatePath(context);
115
+ return entityChain[entityChain.length - 1];
116
+ }
117
+ setProperty(context, value) {
118
+ const { entityChain, splitPath } = this._evaluatePath(context);
119
+ const target = entityChain[entityChain.length - 2];
120
+ const property = splitPath[splitPath.length - 1];
121
+ target[property] = value;
122
+ }
123
+ getClassName() {
124
+ return "FGPath";
125
+ }
126
+ serialize(serializationObject = {}) {
127
+ serializationObject.path = this._path;
128
+ serializationObject.className = this.getClassName();
129
+ return serializationObject;
130
+ }
131
+ Parse(serializationObject) {
132
+ return new FlowGraphPath(serializationObject.path);
133
+ }
134
+ }
135
+ RegisterClass("FGPath", FlowGraphPath);
136
+ //# sourceMappingURL=flowGraphPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphPath.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,uBAAuB;AACvB,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAStC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAYtB,YAAY,IAA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AC7C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED,YAAY;QACR,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,SAAS,CAAC,sBAA2B,EAAE;QACnC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACtC,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACpD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,mBAAwB;QAC1B,OAAO,IAAI,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;CACJ;AACD,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\n\r\n// Path: /x/{y}/z/.../w\r\nconst PATH_REGEX = /([./])({?\\w+}?)/g;\r\n\r\ninterface IPathPart {\r\n value: string;\r\n isTemplate: boolean;\r\n valueWithoutBraces: string;\r\n replacedValue?: string;\r\n separator: string;\r\n}\r\n/*\r\n * @experimental\r\n * This class represents a path of type /x/{y}/z/.../w that is evaluated\r\n * on a target object. The string between curly braces ({y} in the example)\r\n * is a special template string that is replaced during runtime.\r\n */\r\nexport class FlowGraphPath {\r\n private _path: string;\r\n private _templateSubstitutions: {\r\n [key: string]: number;\r\n } = {}; // this is a map of template strings to values that are substituted during runtime\r\n private _pathParts: IPathPart[] = []; // this is the path divided into parts, with each part being either a template string or a regular string\r\n private _templateStrings: string[] = []; // this is the list of template strings in the path\r\n /**\r\n * Whether this path has any template strings in it.\r\n */\r\n public hasTemplateStrings: boolean = false;\r\n\r\n constructor(path: string) {\r\n this._path = path;\r\n const { pathParts, templateStrings } = this._getPathPartsAndTemplateStrings(path);\r\n this._pathParts = pathParts;\r\n this._templateStrings = templateStrings;\r\n this.hasTemplateStrings = templateStrings.length > 0;\r\n }\r\n\r\n private _getPathPartsAndTemplateStrings(path: string) {\r\n const allMatches = path.matchAll(PATH_REGEX);\r\n\r\n const pathParts = [];\r\n const templateStrings = [];\r\n let nextMatch = allMatches.next();\r\n while (!nextMatch.done) {\r\n const singleMatch = nextMatch.value;\r\n const [, separator, value] = singleMatch;\r\n let valueWithoutBraces = value;\r\n let isTemplate = false;\r\n if (value.startsWith(\"{\") && value.endsWith(\"}\")) {\r\n isTemplate = true;\r\n valueWithoutBraces = value.slice(1, value.length - 1);\r\n if (templateStrings.indexOf(valueWithoutBraces) === -1) {\r\n templateStrings.push(valueWithoutBraces);\r\n }\r\n }\r\n pathParts.push({\r\n value,\r\n isTemplate,\r\n valueWithoutBraces,\r\n separator,\r\n });\r\n nextMatch = allMatches.next();\r\n }\r\n return { pathParts, templateStrings };\r\n }\r\n\r\n /**\r\n * Gets the template strings in this path.\r\n * @returns an array containing the template strings in this path.\r\n */\r\n getTemplateStrings(): string[] {\r\n return this._templateStrings;\r\n }\r\n\r\n setTemplateSubstitution(template: string, value: number) {\r\n if (this._templateStrings.indexOf(template) === -1) {\r\n throw new Error(`Template string ${template} does not exist in path ${this._path}`);\r\n }\r\n this._templateSubstitutions[template] = value;\r\n }\r\n\r\n private _evaluateTemplates() {\r\n for (const pathPart of this._pathParts) {\r\n if (pathPart.isTemplate) {\r\n const value = this._templateSubstitutions[pathPart.valueWithoutBraces];\r\n if (value === undefined) {\r\n throw new Error(`Template string ${pathPart.value} was not substituted`);\r\n }\r\n pathPart.replacedValue = value.toString();\r\n }\r\n }\r\n }\r\n\r\n private _getFinalPath() {\r\n let finalPath = \"\";\r\n for (const pathPart of this._pathParts) {\r\n finalPath += pathPart.separator;\r\n if (pathPart.isTemplate) {\r\n finalPath += pathPart.replacedValue;\r\n } else {\r\n finalPath += pathPart.value;\r\n }\r\n }\r\n return finalPath;\r\n }\r\n\r\n /*\r\n * Breaks the path into a chain of entities, for example,\r\n * /x/y/z would be split into [context._userVariables.x, context._userVariables.x.y, context._userVariables.x.y.z],\r\n * and the path that was split, i.e. /x/y/z, would be split into [\"x\", \"y\", \"z\"].\r\n */\r\n private _evaluatePath(context: FlowGraphContext): { entityChain: any[]; splitPath: string[] } {\r\n this._evaluateTemplates();\r\n\r\n const entityChain = [];\r\n const splitPath = [];\r\n let currentTarget = context._userVariables;\r\n for (const pathPart of this._pathParts) {\r\n if (currentTarget === undefined) {\r\n throw new Error(`Could not find path ${this._getFinalPath()} in target context`);\r\n }\r\n const value = pathPart.isTemplate ? pathPart.replacedValue : pathPart.value;\r\n if (!value) {\r\n throw new Error(`Invalid path ${this._getFinalPath()}`);\r\n }\r\n currentTarget = currentTarget[value];\r\n entityChain.push(currentTarget);\r\n splitPath.push(value);\r\n }\r\n\r\n return { entityChain, splitPath };\r\n }\r\n\r\n getProperty(context: FlowGraphContext): any {\r\n const { entityChain } = this._evaluatePath(context);\r\n return entityChain[entityChain.length - 1];\r\n }\r\n\r\n setProperty(context: FlowGraphContext, value: any) {\r\n const { entityChain, splitPath } = this._evaluatePath(context);\r\n const target = entityChain[entityChain.length - 2];\r\n const property = splitPath[splitPath.length - 1];\r\n target[property] = value;\r\n }\r\n\r\n getClassName() {\r\n return \"FGPath\";\r\n }\r\n\r\n serialize(serializationObject: any = {}) {\r\n serializationObject.path = this._path;\r\n serializationObject.className = this.getClassName();\r\n return serializationObject;\r\n }\r\n\r\n Parse(serializationObject: any) {\r\n return new FlowGraphPath(serializationObject.path);\r\n }\r\n}\r\nRegisterClass(\"FGPath\", FlowGraphPath);\r\n"]}
@@ -0,0 +1,42 @@
1
+ import type { FlowGraphBlock } from "./flowGraphBlock";
2
+ import type { FlowGraphContext } from "./flowGraphContext";
3
+ import type { FlowGraphDataConnection } from "./flowGraphDataConnection";
4
+ import type { FlowGraphPath } from "./flowGraphPath";
5
+ /**
6
+ * This class represents a component that has a path and a series of numeric
7
+ * data inputs which fill in the template strings in the path.
8
+ */
9
+ export declare class FlowGraphPathComponent {
10
+ /**
11
+ * The path that this component is associated with.
12
+ */
13
+ path: FlowGraphPath;
14
+ /**
15
+ * The list of numeric data inputs that fill in the template strings in the path.
16
+ */
17
+ templateStringInputs: FlowGraphDataConnection<number>[];
18
+ /**
19
+ * The block that owns this component.
20
+ */
21
+ ownerBlock: FlowGraphBlock;
22
+ constructor(path: FlowGraphPath, ownerBlock: FlowGraphBlock);
23
+ /**
24
+ * Get the inputs of all of the numeric data inputs and use them to fill in the
25
+ * template strings in the path.
26
+ * @param context the context to use to get the values of the numeric data inputs
27
+ * @returns the path with the template strings filled in
28
+ */
29
+ substitutePath(context: FlowGraphContext): FlowGraphPath;
30
+ /**
31
+ * Substitutes the template strings in the path and gets the property on the target object.
32
+ * @param context
33
+ * @returns
34
+ */
35
+ getProperty(context: FlowGraphContext): any;
36
+ /**
37
+ * Substitutes the template strings in the path and sets the property on the target object.
38
+ * @param context
39
+ * @param value
40
+ */
41
+ setProperty(context: FlowGraphContext, value: any): void;
42
+ }
@@ -0,0 +1,51 @@
1
+ import { RichTypeNumber } from "./flowGraphRichTypes.js";
2
+ /**
3
+ * This class represents a component that has a path and a series of numeric
4
+ * data inputs which fill in the template strings in the path.
5
+ */
6
+ export class FlowGraphPathComponent {
7
+ constructor(path, ownerBlock) {
8
+ /**
9
+ * The list of numeric data inputs that fill in the template strings in the path.
10
+ */
11
+ this.templateStringInputs = [];
12
+ this.path = path;
13
+ this.ownerBlock = ownerBlock;
14
+ for (const templateString of path.getTemplateStrings()) {
15
+ this.templateStringInputs.push(this.ownerBlock.registerDataInput(templateString, RichTypeNumber));
16
+ }
17
+ }
18
+ /**
19
+ * Get the inputs of all of the numeric data inputs and use them to fill in the
20
+ * template strings in the path.
21
+ * @param context the context to use to get the values of the numeric data inputs
22
+ * @returns the path with the template strings filled in
23
+ */
24
+ substitutePath(context) {
25
+ for (const templateStringInput of this.templateStringInputs) {
26
+ const templateStringValue = templateStringInput.getValue(context);
27
+ const templateString = templateStringInput.name;
28
+ this.path.setTemplateSubstitution(templateString, templateStringValue);
29
+ }
30
+ return this.path;
31
+ }
32
+ /**
33
+ * Substitutes the template strings in the path and gets the property on the target object.
34
+ * @param context
35
+ * @returns
36
+ */
37
+ getProperty(context) {
38
+ this.substitutePath(context);
39
+ return this.path.getProperty(context);
40
+ }
41
+ /**
42
+ * Substitutes the template strings in the path and sets the property on the target object.
43
+ * @param context
44
+ * @param value
45
+ */
46
+ setProperty(context, value) {
47
+ this.substitutePath(context);
48
+ this.path.setProperty(context, value);
49
+ }
50
+ }
51
+ //# sourceMappingURL=flowGraphPathComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphPathComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphPathComponent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAc/B,YAAY,IAAmB,EAAE,UAA0B;QAT3D;;WAEG;QACH,yBAAoB,GAAsC,EAAE,CAAC;QAOzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;YACpD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;SACrG;IACL,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,OAAyB;QACpC,KAAK,MAAM,mBAAmB,IAAI,IAAI,CAAC,oBAAoB,EAAE;YACzD,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAClE,MAAM,cAAc,GAAG,mBAAmB,CAAC,IAAI,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;SAC1E;QACD,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAyB;QACjC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAyB,EAAE,KAAU;QAC7C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["import type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\r\nimport type { FlowGraphPath } from \"./flowGraphPath\";\r\nimport { RichTypeNumber } from \"./flowGraphRichTypes\";\r\n\r\n/**\r\n * This class represents a component that has a path and a series of numeric\r\n * data inputs which fill in the template strings in the path.\r\n */\r\nexport class FlowGraphPathComponent {\r\n /**\r\n * The path that this component is associated with.\r\n */\r\n path: FlowGraphPath;\r\n /**\r\n * The list of numeric data inputs that fill in the template strings in the path.\r\n */\r\n templateStringInputs: FlowGraphDataConnection<number>[] = [];\r\n /**\r\n * The block that owns this component.\r\n */\r\n ownerBlock: FlowGraphBlock;\r\n\r\n constructor(path: FlowGraphPath, ownerBlock: FlowGraphBlock) {\r\n this.path = path;\r\n this.ownerBlock = ownerBlock;\r\n for (const templateString of path.getTemplateStrings()) {\r\n this.templateStringInputs.push(this.ownerBlock.registerDataInput(templateString, RichTypeNumber));\r\n }\r\n }\r\n\r\n /**\r\n * Get the inputs of all of the numeric data inputs and use them to fill in the\r\n * template strings in the path.\r\n * @param context the context to use to get the values of the numeric data inputs\r\n * @returns the path with the template strings filled in\r\n */\r\n substitutePath(context: FlowGraphContext): FlowGraphPath {\r\n for (const templateStringInput of this.templateStringInputs) {\r\n const templateStringValue = templateStringInput.getValue(context);\r\n const templateString = templateStringInput.name;\r\n this.path.setTemplateSubstitution(templateString, templateStringValue);\r\n }\r\n return this.path;\r\n }\r\n\r\n /**\r\n * Substitutes the template strings in the path and gets the property on the target object.\r\n * @param context\r\n * @returns\r\n */\r\n getProperty(context: FlowGraphContext): any {\r\n this.substitutePath(context);\r\n return this.path.getProperty(context);\r\n }\r\n\r\n /**\r\n * Substitutes the template strings in the path and sets the property on the target object.\r\n * @param context\r\n * @param value\r\n */\r\n setProperty(context: FlowGraphContext, value: any) {\r\n this.substitutePath(context);\r\n this.path.setProperty(context, value);\r\n }\r\n}\r\n"]}
@@ -7,4 +7,5 @@ export * from "./flowGraphRichTypes";
7
7
  export * from "./flowGraphContext";
8
8
  export * from "./flowGraphCoordinator";
9
9
  export * from "./flowGraphContextLogger";
10
+ export * from "./flowGraphPath";
10
11
  export * from "./Blocks/index";
@@ -7,6 +7,7 @@ export * from "./flowGraphRichTypes.js";
7
7
  export * from "./flowGraphContext.js";
8
8
  export * from "./flowGraphCoordinator.js";
9
9
  export * from "./flowGraphContextLogger.js";
10
+ export * from "./flowGraphPath.js";
10
11
  // eslint-disable-next-line import/no-internal-modules
11
12
  export * from "./Blocks/index.js";
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,sDAAsD;AACtD,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./flowGraph\";\r\nexport * from \"./flowGraphBlock\";\r\nexport * from \"./flowGraphSignalConnection\";\r\nexport * from \"./flowGraphExecutionBlock\";\r\nexport * from \"./flowGraphEventBlock\";\r\nexport * from \"./flowGraphRichTypes\";\r\nexport * from \"./flowGraphContext\";\r\nexport * from \"./flowGraphCoordinator\";\r\nexport * from \"./flowGraphContextLogger\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./Blocks/index\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,sDAAsD;AACtD,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./flowGraph\";\r\nexport * from \"./flowGraphBlock\";\r\nexport * from \"./flowGraphSignalConnection\";\r\nexport * from \"./flowGraphExecutionBlock\";\r\nexport * from \"./flowGraphEventBlock\";\r\nexport * from \"./flowGraphRichTypes\";\r\nexport * from \"./flowGraphContext\";\r\nexport * from \"./flowGraphCoordinator\";\r\nexport * from \"./flowGraphContextLogger\";\r\nexport * from \"./flowGraphPath\";\r\n// eslint-disable-next-line import/no-internal-modules\r\nexport * from \"./Blocks/index\";\r\n"]}
@@ -577,6 +577,14 @@ export declare class ShadowGenerator implements IShadowGenerator {
577
577
  * @param effect The effect we are binding the information for
578
578
  */
579
579
  bindShadowLight(lightIndex: string, effect: Effect): void;
580
+ /**
581
+ * Gets the view matrix used to render the shadow map.
582
+ */
583
+ get viewMatrix(): Matrix;
584
+ /**
585
+ * Gets the projection matrix used to render the shadow map.
586
+ */
587
+ get projectionMatrix(): Matrix;
580
588
  /**
581
589
  * Gets the transformation matrix used to project the meshes into the map from the light point of view.
582
590
  * (eq to shadow projection matrix * light transform matrix)
@@ -1282,6 +1282,18 @@ export class ShadowGenerator {
1282
1282
  }
1283
1283
  light._uniformBuffer.updateFloat2("depthValues", this.getLight().getDepthMinZ(camera), this.getLight().getDepthMinZ(camera) + this.getLight().getDepthMaxZ(camera), lightIndex);
1284
1284
  }
1285
+ /**
1286
+ * Gets the view matrix used to render the shadow map.
1287
+ */
1288
+ get viewMatrix() {
1289
+ return this._viewMatrix;
1290
+ }
1291
+ /**
1292
+ * Gets the projection matrix used to render the shadow map.
1293
+ */
1294
+ get projectionMatrix() {
1295
+ return this._projectionMatrix;
1296
+ }
1285
1297
  /**
1286
1298
  * Gets the transformation matrix used to project the meshes into the map from the light point of view.
1287
1299
  * (eq to shadow projection matrix * light transform matrix)