@babylonjs/core 7.51.1 → 7.51.2

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 (313) hide show
  1. package/Animations/animation.js +2 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/Buffers/bufferUtils.d.ts +7 -5
  4. package/Buffers/bufferUtils.js +13 -9
  5. package/Buffers/bufferUtils.js.map +1 -1
  6. package/Engines/abstractEngine.js +2 -2
  7. package/Engines/abstractEngine.js.map +1 -1
  8. package/Engines/constants.d.ts +32 -0
  9. package/Engines/constants.js +33 -0
  10. package/Engines/constants.js.map +1 -1
  11. package/Engines/webgpuEngine.js +6 -3
  12. package/Engines/webgpuEngine.js.map +1 -1
  13. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +148 -465
  14. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +394 -691
  15. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  16. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.d.ts +142 -0
  17. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js +342 -0
  18. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.js.map +1 -0
  19. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.d.ts +107 -0
  20. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +130 -0
  21. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -0
  22. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +77 -0
  23. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +139 -0
  24. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -0
  25. package/FlowGraph/Blocks/Data/Math/index.d.ts +3 -0
  26. package/FlowGraph/Blocks/Data/Math/index.js +3 -0
  27. package/FlowGraph/Blocks/Data/Math/index.js.map +1 -1
  28. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +85 -0
  29. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +133 -0
  30. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -0
  31. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.d.ts +49 -0
  32. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js +71 -0
  33. package/FlowGraph/Blocks/Data/Transformers/flowGraphTypeToTypeBlocks.js.map +1 -0
  34. package/FlowGraph/Blocks/Data/Transformers/index.d.ts +2 -0
  35. package/FlowGraph/Blocks/Data/Transformers/index.js +3 -0
  36. package/FlowGraph/Blocks/Data/Transformers/index.js.map +1 -0
  37. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.d.ts +39 -0
  38. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js +46 -0
  39. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.js.map +1 -0
  40. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.d.ts +35 -0
  41. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +34 -0
  42. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -0
  43. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.d.ts +20 -0
  44. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js +25 -0
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphContextBlock.js.map +1 -0
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.d.ts +34 -0
  47. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js +35 -0
  48. package/FlowGraph/Blocks/Data/Utils/flowGraphFunctionReferenceBlock.js.map +1 -0
  49. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.d.ts +39 -0
  50. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js +42 -0
  51. package/FlowGraph/Blocks/Data/Utils/flowGraphIndexOfBlock.js.map +1 -0
  52. package/FlowGraph/Blocks/Data/Utils/index.d.ts +5 -0
  53. package/FlowGraph/Blocks/Data/Utils/index.js +6 -0
  54. package/FlowGraph/Blocks/Data/Utils/index.js.map +1 -0
  55. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +0 -1
  56. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +3 -2
  57. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  58. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  59. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +4 -4
  60. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  61. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +6 -3
  62. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +12 -6
  63. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +0 -2
  65. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +2 -3
  66. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +5 -4
  68. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +5 -4
  69. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.d.ts +62 -0
  71. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js +41 -0
  72. package/FlowGraph/Blocks/Data/flowGraphGetAssetBlock.js.map +1 -0
  73. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +38 -33
  74. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +42 -25
  75. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +11 -16
  77. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +9 -17
  78. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  79. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +1 -1
  80. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +1 -1
  81. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.d.ts → flowGraphTransformCoordinatesSystemBlock.d.ts} +1 -2
  83. package/FlowGraph/Blocks/Data/{flowGraphCoordinateTransformBlock.js → flowGraphTransformCoordinatesSystemBlock.js} +4 -5
  84. package/FlowGraph/Blocks/Data/flowGraphTransformCoordinatesSystemBlock.js.map +1 -0
  85. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +1 -1
  86. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +1 -1
  87. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  88. package/FlowGraph/Blocks/Data/index.d.ts +7 -3
  89. package/FlowGraph/Blocks/Data/index.js +9 -4
  90. package/FlowGraph/Blocks/Data/index.js.map +1 -1
  91. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +45 -24
  92. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +45 -51
  93. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.d.ts +61 -0
  95. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js +39 -0
  96. package/FlowGraph/Blocks/Event/flowGraphPointerOutEventBlock.js.map +1 -0
  97. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.d.ts +61 -0
  98. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js +40 -0
  99. package/FlowGraph/Blocks/Event/flowGraphPointerOverEventBlock.js.map +1 -0
  100. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +12 -14
  101. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +19 -26
  102. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  103. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -12
  104. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +13 -24
  105. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  106. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +31 -7
  107. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +22 -20
  108. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  109. package/FlowGraph/Blocks/{Execution → Event}/flowGraphSendCustomEventBlock.d.ts +12 -7
  110. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +39 -0
  111. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -0
  112. package/FlowGraph/Blocks/Event/index.d.ts +3 -0
  113. package/FlowGraph/Blocks/Event/index.js +3 -0
  114. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  115. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.d.ts +44 -0
  116. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js +46 -0
  117. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.js.map +1 -0
  118. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.d.ts +60 -0
  119. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js +93 -0
  120. package/FlowGraph/Blocks/Execution/Animation/flowGraphEasingBlock.js.map +1 -0
  121. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.d.ts +82 -0
  122. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +105 -0
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -0
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +2 -2
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +2 -2
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +40 -42
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +116 -50
  129. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  130. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +12 -4
  131. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +86 -8
  132. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  133. package/FlowGraph/Blocks/Execution/Animation/index.d.ts +3 -0
  134. package/FlowGraph/Blocks/Execution/Animation/index.js +3 -0
  135. package/FlowGraph/Blocks/Execution/Animation/index.js.map +1 -1
  136. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +1 -2
  137. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -4
  138. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  139. package/FlowGraph/Blocks/Execution/{Audio/flowGraphStopAudioBlock.d.ts → ControlFlow/flowGraphCancelDelayBlock.d.ts} +6 -8
  140. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js +31 -0
  141. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.js.map +1 -0
  142. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +2 -2
  143. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +5 -5
  144. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  145. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +0 -1
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +2 -3
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +5 -10
  149. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -15
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +11 -3
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +5 -6
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +27 -7
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +28 -30
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +13 -16
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +50 -52
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +8 -9
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +26 -13
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.d.ts +32 -0
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js +84 -0
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -0
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +20 -6
  167. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +55 -16
  168. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -4
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +36 -13
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +13 -5
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +22 -17
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +12 -16
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +21 -21
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  178. package/FlowGraph/Blocks/Execution/ControlFlow/index.d.ts +2 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/index.js +2 -1
  180. package/FlowGraph/Blocks/Execution/ControlFlow/index.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -5
  182. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +13 -8
  183. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  184. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +33 -36
  185. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +42 -26
  186. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  187. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +10 -25
  188. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +38 -24
  189. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  190. package/FlowGraph/Blocks/Execution/index.d.ts +0 -3
  191. package/FlowGraph/Blocks/Execution/index.js +0 -3
  192. package/FlowGraph/Blocks/Execution/index.js.map +1 -1
  193. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +16 -0
  194. package/FlowGraph/Blocks/flowGraphBlockFactory.js +292 -0
  195. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -0
  196. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +145 -0
  197. package/FlowGraph/Blocks/flowGraphBlockNames.js +147 -0
  198. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -0
  199. package/FlowGraph/Blocks/index.d.ts +2 -0
  200. package/FlowGraph/Blocks/index.js +2 -0
  201. package/FlowGraph/Blocks/index.js.map +1 -1
  202. package/FlowGraph/{flowGraphInteger.d.ts → CustomTypes/flowGraphInteger.d.ts} +2 -3
  203. package/FlowGraph/{flowGraphInteger.js → CustomTypes/flowGraphInteger.js} +4 -5
  204. package/FlowGraph/CustomTypes/flowGraphInteger.js.map +1 -0
  205. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +196 -0
  206. package/FlowGraph/CustomTypes/flowGraphMatrix.js +272 -0
  207. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -0
  208. package/FlowGraph/CustomTypes/index.d.ts +2 -0
  209. package/FlowGraph/CustomTypes/index.js +3 -0
  210. package/FlowGraph/CustomTypes/index.js.map +1 -0
  211. package/FlowGraph/flowGraph.d.ts +29 -34
  212. package/FlowGraph/flowGraph.js +120 -104
  213. package/FlowGraph/flowGraph.js.map +1 -1
  214. package/FlowGraph/flowGraphAssetsContext.d.ts +29 -0
  215. package/FlowGraph/flowGraphAssetsContext.js +52 -0
  216. package/FlowGraph/flowGraphAssetsContext.js.map +1 -0
  217. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +15 -8
  218. package/FlowGraph/flowGraphAsyncExecutionBlock.js +25 -5
  219. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  220. package/FlowGraph/flowGraphBlock.d.ts +22 -15
  221. package/FlowGraph/flowGraphBlock.js +31 -52
  222. package/FlowGraph/flowGraphBlock.js.map +1 -1
  223. package/FlowGraph/flowGraphConnection.d.ts +13 -12
  224. package/FlowGraph/flowGraphConnection.js +31 -16
  225. package/FlowGraph/flowGraphConnection.js.map +1 -1
  226. package/FlowGraph/flowGraphContext.d.ts +89 -13
  227. package/FlowGraph/flowGraphContext.js +210 -23
  228. package/FlowGraph/flowGraphContext.js.map +1 -1
  229. package/FlowGraph/flowGraphCoordinator.d.ts +4 -10
  230. package/FlowGraph/flowGraphCoordinator.js +4 -16
  231. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  232. package/FlowGraph/flowGraphDataConnection.d.ts +52 -14
  233. package/FlowGraph/flowGraphDataConnection.js +73 -26
  234. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  235. package/FlowGraph/flowGraphEventBlock.d.ts +17 -1
  236. package/FlowGraph/flowGraphEventBlock.js +13 -2
  237. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  238. package/FlowGraph/flowGraphEventType.d.ts +16 -0
  239. package/FlowGraph/flowGraphEventType.js +18 -0
  240. package/FlowGraph/flowGraphEventType.js.map +1 -0
  241. package/FlowGraph/flowGraphExecutionBlock.d.ts +11 -1
  242. package/FlowGraph/flowGraphExecutionBlock.js +21 -2
  243. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  244. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.d.ts +2 -2
  245. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js +0 -1
  246. package/FlowGraph/flowGraphExecutionBlockWithOutSignal.js.map +1 -1
  247. package/FlowGraph/flowGraphLogger.d.ts +60 -0
  248. package/FlowGraph/flowGraphLogger.js +53 -0
  249. package/FlowGraph/flowGraphLogger.js.map +1 -0
  250. package/FlowGraph/flowGraphParser.d.ts +85 -0
  251. package/FlowGraph/flowGraphParser.js +271 -0
  252. package/FlowGraph/flowGraphParser.js.map +1 -0
  253. package/FlowGraph/flowGraphPathConverter.d.ts +1 -1
  254. package/FlowGraph/flowGraphPathConverter.js +3 -2
  255. package/FlowGraph/flowGraphPathConverter.js.map +1 -1
  256. package/FlowGraph/flowGraphPathConverterComponent.d.ts +8 -1
  257. package/FlowGraph/flowGraphPathConverterComponent.js +18 -2
  258. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  259. package/FlowGraph/flowGraphRichTypes.d.ts +51 -9
  260. package/FlowGraph/flowGraphRichTypes.js +160 -50
  261. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  262. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +45 -0
  263. package/FlowGraph/flowGraphSceneEventCoordinator.js +77 -0
  264. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -0
  265. package/FlowGraph/flowGraphSignalConnection.d.ts +8 -5
  266. package/FlowGraph/flowGraphSignalConnection.js +26 -9
  267. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  268. package/FlowGraph/index.d.ts +6 -1
  269. package/FlowGraph/index.js +7 -1
  270. package/FlowGraph/index.js.map +1 -1
  271. package/FlowGraph/serialization.d.ts +5 -2
  272. package/FlowGraph/serialization.js +94 -22
  273. package/FlowGraph/serialization.js.map +1 -1
  274. package/FlowGraph/typeDefinitions.d.ts +74 -12
  275. package/FlowGraph/typeDefinitions.js.map +1 -1
  276. package/FlowGraph/utils.d.ts +47 -0
  277. package/FlowGraph/utils.js +55 -0
  278. package/FlowGraph/utils.js.map +1 -1
  279. package/Maths/math.path.js +3 -0
  280. package/Maths/math.path.js.map +1 -1
  281. package/Meshes/geometry.d.ts +2 -1
  282. package/Meshes/geometry.js +8 -2
  283. package/Meshes/geometry.js.map +1 -1
  284. package/Meshes/mesh.d.ts +2 -1
  285. package/Meshes/mesh.js +3 -2
  286. package/Meshes/mesh.js.map +1 -1
  287. package/ObjectModel/objectModelInterfaces.d.ts +2 -2
  288. package/ObjectModel/objectModelInterfaces.js.map +1 -1
  289. package/package.json +1 -1
  290. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +0 -24
  291. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +0 -39
  292. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +0 -1
  293. package/FlowGraph/Blocks/Data/Logic/index.d.ts +0 -1
  294. package/FlowGraph/Blocks/Data/Logic/index.js +0 -2
  295. package/FlowGraph/Blocks/Data/Logic/index.js.map +0 -1
  296. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +0 -1
  297. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +0 -19
  298. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +0 -26
  299. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +0 -1
  300. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +0 -25
  301. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +0 -1
  302. package/FlowGraph/Blocks/Execution/Audio/index.d.ts +0 -2
  303. package/FlowGraph/Blocks/Execution/Audio/index.js +0 -3
  304. package/FlowGraph/Blocks/Execution/Audio/index.js.map +0 -1
  305. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +0 -31
  306. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +0 -69
  307. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +0 -1
  308. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +0 -38
  309. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +0 -1
  310. package/FlowGraph/flowGraphContextLogger.d.ts +0 -9
  311. package/FlowGraph/flowGraphContextLogger.js +0 -14
  312. package/FlowGraph/flowGraphContextLogger.js.map +0 -1
  313. package/FlowGraph/flowGraphInteger.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphMatrixMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAAkB,0BAA0B,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,uCAA0C;AACpK,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAErE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAYjF;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,4BAA8D;IACvG;;;OAGG;IACH,YAAY,MAA2C;QACnD,KAAK,CACD,0BAA0B,CAAC,MAAM,EAAE,UAAU,wCAAyB,CAAC,EACvE,0BAA0B,CAAC,MAAM,EAAE,UAAU,wCAAyB,CAAC,EACvE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SA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AAa,mEAAoC,2BAA2B,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { FlowGraphTypes, getRichTypeByFlowGraphType, RichTypeMatrix, RichTypeNumber, RichTypeQuaternion, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { Matrix, Quaternion, Vector3 } from \"core/Maths/math.vector\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport type { FlowGraphMatrix2D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport type { FlowGraphMatrix } from \"core/FlowGraph/utils\";\n\n/**\n * Configuration for the matrix blocks.\n */\nexport interface IFlowGraphMatrixBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The type of the matrix. Default is Matrix (which is 4x4)\n */\n matrixType: FlowGraphTypes;\n}\n/**\n * Transposes a matrix.\n */\nexport class FlowGraphTransposeBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a) => (a.transpose ? a.transpose() : Matrix.Transpose(a as Matrix)),\n FlowGraphBlockNames.Transpose,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.Transpose, FlowGraphTransposeBlock);\n\n/**\n * Gets the determinant of a matrix.\n */\nexport class FlowGraphDeterminantBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, number> {\n /**\n * Creates a new instance of the block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix), RichTypeNumber, (a) => a.determinant(), FlowGraphBlockNames.Determinant, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Determinant, FlowGraphDeterminantBlock);\n\n/**\n * Inverts a matrix.\n */\nexport class FlowGraphInvertMatrixBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the inverse block.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a) => ((a as FlowGraphMatrix2D).inverse ? (a as FlowGraphMatrix2D).inverse() : Matrix.Invert(a as Matrix)),\n FlowGraphBlockNames.InvertMatrix,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.InvertMatrix, FlowGraphInvertMatrixBlock);\n\n/**\n * Multiplies two matrices.\n */\nexport class FlowGraphMatrixMultiplicationBlock extends FlowGraphBinaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix, FlowGraphMatrix> {\n /**\n * Creates a new instance of the multiplication block.\n * Note - this is similar to the math multiplication if not using matrix per-component multiplication.\n * @param config the configuration of the block\n */\n constructor(config?: IFlowGraphMatrixBlockConfiguration) {\n super(\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix),\n (a, b) => a.multiply(b as any),\n FlowGraphBlockNames.MatrixMultiplication,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.MatrixMultiplication, FlowGraphMatrixMultiplicationBlock);\n\n/**\n * Matrix decompose block\n */\nexport class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {\n /**\n * The input of this block\n */\n public readonly input: FlowGraphDataConnection<Matrix>;\n\n /**\n * The position output of this block\n */\n public readonly position: FlowGraphDataConnection<Vector3>;\n /**\n * The rotation output of this block\n */\n public readonly rotationQuaternion: FlowGraphDataConnection<Quaternion>;\n /**\n * The scaling output of this block\n */\n public readonly scaling: FlowGraphDataConnection<Vector3>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.input = this.registerDataInput(\"input\", RichTypeMatrix);\n this.position = this.registerDataOutput(\"position\", RichTypeVector3);\n this.rotationQuaternion = this.registerDataOutput(\"rotationQuaternion\", RichTypeQuaternion);\n this.scaling = this.registerDataOutput(\"scaling\", RichTypeVector3);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedPosition = context._getExecutionVariable(this, \"cachedPosition\", null);\n const cachedRotation = context._getExecutionVariable(this, \"cachedRotation\", null);\n const cachedScaling = context._getExecutionVariable(this, \"cachedScaling\", null);\n if (cachedExecutionId === context.executionId && cachedPosition && cachedRotation && cachedScaling) {\n this.position.setValue(cachedPosition, context);\n this.rotationQuaternion.setValue(cachedRotation, context);\n this.scaling.setValue(cachedScaling, context);\n } else {\n const matrix = this.input.getValue(context);\n const position = cachedPosition || new Vector3();\n const rotation = cachedRotation || new Quaternion();\n const scaling = cachedScaling || new Vector3();\n matrix.decompose(scaling, rotation, position);\n this.position.setValue(position, context);\n this.rotationQuaternion.setValue(rotation, context);\n this.scaling.setValue(scaling, context);\n context._setExecutionVariable(this, \"cachedPosition\", position);\n context._setExecutionVariable(this, \"cachedRotation\", rotation);\n context._setExecutionVariable(this, \"cachedScaling\", scaling);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixDecompose;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.MatrixDecompose, FlowGraphMatrixDecomposeBlock);\n\n/**\n * Matrix compose block\n */\nexport class FlowGraphMatrixComposeBlock extends FlowGraphBlock {\n /**\n * The position input of this block\n */\n public readonly position: FlowGraphDataConnection<Vector3>;\n /**\n * The rotation input of this block\n */\n public readonly rotationQuaternion: FlowGraphDataConnection<Quaternion>;\n /**\n * The scaling input of this block\n */\n public readonly scaling: FlowGraphDataConnection<Vector3>;\n /**\n * The output of this block\n */\n public readonly output: FlowGraphDataConnection<Matrix>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.position = this.registerDataInput(\"position\", RichTypeVector3);\n this.rotationQuaternion = this.registerDataInput(\"rotationQuaternion\", RichTypeQuaternion);\n this.scaling = this.registerDataInput(\"scaling\", RichTypeVector3);\n this.output = this.registerDataOutput(\"output\", RichTypeMatrix);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedMatrix = context._getExecutionVariable(this, \"cachedMatrix\", null);\n if (cachedExecutionId === context.executionId && cachedMatrix) {\n this.output.setValue(cachedMatrix, context);\n } else {\n const matrix = Matrix.Compose(this.scaling.getValue(context), this.rotationQuaternion.getValue(context), this.position.getValue(context));\n this.output.setValue(matrix, context);\n context._setExecutionVariable(this, \"cachedMatrix\", matrix);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixCompose;\n }\n}\n\nRegisterClass(FlowGraphBlockNames.MatrixCompose, FlowGraphMatrixComposeBlock);\n"]}
@@ -0,0 +1,77 @@
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphTypes } from "../../../flowGraphRichTypes.js";
3
+ import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock";
4
+ import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock";
5
+ import { Matrix, Vector2, Vector3 } from "../../../../Maths/math.vector.js";
6
+ import { FlowGraphTernaryOperationBlock } from "../flowGraphTernaryOperationBlock";
7
+ import type { FlowGraphMatrix, FlowGraphVector } from "../../../utils.js";
8
+ /**
9
+ * Vector length block.
10
+ */
11
+ export declare class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, number> {
12
+ constructor(config?: IFlowGraphBlockConfiguration);
13
+ private _polymorphicLength;
14
+ }
15
+ /**
16
+ * Configuration for normalized vector
17
+ */
18
+ export interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockConfiguration {
19
+ /**
20
+ * If true, the block will return NaN if the input vector has a length of 0.
21
+ * This is the expected behavior for glTF interactivity graphs.
22
+ */
23
+ nanOnZeroLength?: boolean;
24
+ }
25
+ /**
26
+ * Vector normalize block.
27
+ */
28
+ export declare class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {
29
+ constructor(config?: IFlowGraphNormalizeBlockConfiguration);
30
+ private _polymorphicNormalize;
31
+ }
32
+ /**
33
+ * Dot product block.
34
+ */
35
+ export declare class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphVector, number> {
36
+ constructor(config?: IFlowGraphBlockConfiguration);
37
+ private _polymorphicDot;
38
+ }
39
+ /**
40
+ * Cross product block.
41
+ */
42
+ export declare class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {
43
+ constructor(config?: IFlowGraphBlockConfiguration);
44
+ }
45
+ /**
46
+ * 2D rotation block.
47
+ */
48
+ export declare class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {
49
+ constructor(config?: IFlowGraphBlockConfiguration);
50
+ }
51
+ /**
52
+ * 3D rotation block.
53
+ */
54
+ export declare class FlowGraphRotate3DBlock extends FlowGraphTernaryOperationBlock<Vector3, Vector3, number, Vector3> {
55
+ constructor(config?: IFlowGraphBlockConfiguration);
56
+ }
57
+ /**
58
+ * Configuration for the transform block.
59
+ */
60
+ export interface IFlowGraphTransformBlockConfiguration extends IFlowGraphBlockConfiguration {
61
+ /**
62
+ * The vector type
63
+ */
64
+ vectorType: FlowGraphTypes;
65
+ }
66
+ /**
67
+ * Transform a vector3 by a matrix.
68
+ */
69
+ export declare class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphMatrix, FlowGraphVector> {
70
+ constructor(config?: IFlowGraphTransformBlockConfiguration);
71
+ }
72
+ /**
73
+ * Transform a vector3 by a matrix.
74
+ */
75
+ export declare class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock<Vector3, Matrix, Vector3> {
76
+ constructor(config?: IFlowGraphBlockConfiguration);
77
+ }
@@ -0,0 +1,139 @@
1
+ import { RichTypeVector3, RichTypeNumber, RichTypeAny, RichTypeVector2, RichTypeMatrix, getRichTypeByFlowGraphType } from "../../../flowGraphRichTypes.js";
2
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
3
+ import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
4
+ import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
5
+ import { Matrix, Vector2, Vector3, Vector4 } from "../../../../Maths/math.vector.js";
6
+ import { FlowGraphTernaryOperationBlock } from "../flowGraphTernaryOperationBlock.js";
7
+ import { _getClassNameOf } from "../../../utils.js";
8
+ /**
9
+ * Vector length block.
10
+ */
11
+ export class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock {
12
+ constructor(config) {
13
+ super(RichTypeAny, RichTypeNumber, (a) => this._polymorphicLength(a), "FlowGraphLengthBlock" /* FlowGraphBlockNames.Length */, config);
14
+ }
15
+ _polymorphicLength(a) {
16
+ const aClassName = _getClassNameOf(a);
17
+ switch (aClassName) {
18
+ case "Vector2" /* FlowGraphTypes.Vector2 */:
19
+ case "Vector3" /* FlowGraphTypes.Vector3 */:
20
+ case "Vector4" /* FlowGraphTypes.Vector4 */:
21
+ return a.length();
22
+ default:
23
+ throw new Error(`Cannot compute length of value ${a}`);
24
+ }
25
+ }
26
+ }
27
+ RegisterClass("FlowGraphLengthBlock" /* FlowGraphBlockNames.Length */, FlowGraphLengthBlock);
28
+ /**
29
+ * Vector normalize block.
30
+ */
31
+ export class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock {
32
+ constructor(config) {
33
+ super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), "FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */, config);
34
+ }
35
+ _polymorphicNormalize(a) {
36
+ const aClassName = _getClassNameOf(a);
37
+ let normalized;
38
+ switch (aClassName) {
39
+ case "Vector2" /* FlowGraphTypes.Vector2 */:
40
+ case "Vector3" /* FlowGraphTypes.Vector3 */:
41
+ case "Vector4" /* FlowGraphTypes.Vector4 */:
42
+ normalized = a.normalizeToNew();
43
+ if (this.config?.nanOnZeroLength) {
44
+ const length = a.length();
45
+ if (length === 0) {
46
+ normalized.setAll(NaN);
47
+ }
48
+ }
49
+ return normalized;
50
+ default:
51
+ throw new Error(`Cannot normalize value ${a}`);
52
+ }
53
+ }
54
+ }
55
+ RegisterClass("FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */, FlowGraphNormalizeBlock);
56
+ /**
57
+ * Dot product block.
58
+ */
59
+ export class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock {
60
+ constructor(config) {
61
+ super(RichTypeAny, RichTypeAny, RichTypeNumber, (a, b) => this._polymorphicDot(a, b), "FlowGraphDotBlock" /* FlowGraphBlockNames.Dot */, config);
62
+ }
63
+ _polymorphicDot(a, b) {
64
+ const className = _getClassNameOf(a);
65
+ switch (className) {
66
+ case "Vector2" /* FlowGraphTypes.Vector2 */:
67
+ case "Vector3" /* FlowGraphTypes.Vector3 */:
68
+ case "Vector4" /* FlowGraphTypes.Vector4 */:
69
+ // casting is needed because dot requires both to be the same type
70
+ return a.dot(b);
71
+ default:
72
+ throw new Error(`Cannot get dot product of ${a} and ${b}`);
73
+ }
74
+ }
75
+ }
76
+ RegisterClass("FlowGraphDotBlock" /* FlowGraphBlockNames.Dot */, FlowGraphDotBlock);
77
+ /**
78
+ * Cross product block.
79
+ */
80
+ export class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock {
81
+ constructor(config) {
82
+ super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (a, b) => Vector3.Cross(a, b), "FlowGraphCrossBlock" /* FlowGraphBlockNames.Cross */, config);
83
+ }
84
+ }
85
+ RegisterClass("FlowGraphCrossBlock" /* FlowGraphBlockNames.Cross */, FlowGraphCrossBlock);
86
+ /**
87
+ * 2D rotation block.
88
+ */
89
+ export class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock {
90
+ constructor(config) {
91
+ super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (a, b) => Vector2.Transform(a, Matrix.RotationZ(b)), "FlowGraphRotate2DBlock" /* FlowGraphBlockNames.Rotate2D */, config);
92
+ }
93
+ }
94
+ RegisterClass("FlowGraphRotate2DBlock" /* FlowGraphBlockNames.Rotate2D */, FlowGraphRotate2DBlock);
95
+ /**
96
+ * 3D rotation block.
97
+ */
98
+ export class FlowGraphRotate3DBlock extends FlowGraphTernaryOperationBlock {
99
+ constructor(config) {
100
+ super(RichTypeVector3, RichTypeVector3, RichTypeNumber, RichTypeVector3, (a, b, c) => Vector3.TransformCoordinates(a, Matrix.RotationAxis(b, c)), "FlowGraphRotate3DBlock" /* FlowGraphBlockNames.Rotate3D */, config);
101
+ }
102
+ }
103
+ RegisterClass("FlowGraphRotate3DBlock" /* FlowGraphBlockNames.Rotate3D */, FlowGraphRotate3DBlock);
104
+ function _transformVector(a, b) {
105
+ const className = _getClassNameOf(a);
106
+ switch (className) {
107
+ case "Vector2" /* FlowGraphTypes.Vector2 */:
108
+ return b.transformVector(a);
109
+ case "Vector3" /* FlowGraphTypes.Vector3 */:
110
+ return b.transformVector(a);
111
+ case "Vector4" /* FlowGraphTypes.Vector4 */:
112
+ a = a;
113
+ // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4
114
+ return new Vector4(a.x * b.m[0] + a.y * b.m[1] + a.z * b.m[2] + a.w * b.m[3], a.x * b.m[4] + a.y * b.m[5] + a.z * b.m[6] + a.w * b.m[7], a.x * b.m[8] + a.y * b.m[9] + a.z * b.m[10] + a.w * b.m[11], a.x * b.m[12] + a.y * b.m[13] + a.z * b.m[14] + a.w * b.m[15]);
115
+ default:
116
+ throw new Error(`Cannot transform value ${a}`);
117
+ }
118
+ }
119
+ /**
120
+ * Transform a vector3 by a matrix.
121
+ */
122
+ export class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock {
123
+ constructor(config) {
124
+ const vectorType = config?.vectorType || "Vector3" /* FlowGraphTypes.Vector3 */;
125
+ const matrixType = vectorType === "Vector2" /* FlowGraphTypes.Vector2 */ ? "Matrix2D" /* FlowGraphTypes.Matrix2D */ : vectorType === "Vector3" /* FlowGraphTypes.Vector3 */ ? "Matrix3D" /* FlowGraphTypes.Matrix3D */ : "Matrix" /* FlowGraphTypes.Matrix */;
126
+ super(getRichTypeByFlowGraphType(vectorType), getRichTypeByFlowGraphType(matrixType), getRichTypeByFlowGraphType(vectorType), _transformVector, "FlowGraphTransformVectorBlock" /* FlowGraphBlockNames.TransformVector */, config);
127
+ }
128
+ }
129
+ RegisterClass("FlowGraphTransformVectorBlock" /* FlowGraphBlockNames.TransformVector */, FlowGraphTransformBlock);
130
+ /**
131
+ * Transform a vector3 by a matrix.
132
+ */
133
+ export class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock {
134
+ constructor(config) {
135
+ super(RichTypeVector3, RichTypeMatrix, RichTypeVector3, (a, b) => Vector3.TransformCoordinates(a, b), "FlowGraphTransformCoordinatesBlock" /* FlowGraphBlockNames.TransformCoordinates */, config);
136
+ }
137
+ }
138
+ RegisterClass("FlowGraphTransformCoordinatesBlock" /* FlowGraphBlockNames.TransformCoordinates */, FlowGraphTransformCoordinatesBlock);
139
+ //# sourceMappingURL=flowGraphVectorMathBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphVectorMathBlocks.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAkB,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,0BAA0B,EAAE,uCAA0C;AAC9K,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAC3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAGnF,OAAO,EAAE,eAAe,EAAE,0BAA6B;AAEvD;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,4BAAqD;IAC3F,YAAY,MAAqC;QAC7C,KAAK,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,2DAA8B,MAAM,CAAC,CAAC;IAC9G,CAAC;IAEO,kBAAkB,CAAC,CAAkB;QACzC,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QACtC,QAAQ,UAAU,EAAE,CAAC;YACjB,4CAA4B;YAC5B,4CAA4B;YAC5B;gBACI,OAAQ,CAAa,CAAC,MAAM,EAAE,CAAC;YACnC;gBACI,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC;CACJ;AACD,aAAa,0DAA6B,oBAAoB,C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GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAChE,CAAC;QACN;YACI,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;AACL,CAAC;AAYD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,6BAAgF;IACzH,YAAY,MAA8C;QACtD,MAAM,UAAU,GAAG,MAAM,EAAE,UAAU,0CAA0B,CAAC;QAChE,MAAM,UAAU,GACZ,UAAU,2CAA2B,CAAC,CAAC,0CAAyB,CAAC,CAAC,UAAU,2CAA2B,CAAC,CAAC,0CAAyB,CAAC,qCAAsB,CAAC;QAC9J,KAAK,CACD,0BAA0B,CAAC,UAAU,CAAC,EACtC,0BAA0B,CAAC,UAAU,CAAC,EACtC,0BAA0B,CAAC,UAAU,CAAC,EACtC,gBAAgB,6EAEhB,MAAM,CACT,CAAC;IACN,CAAC;CACJ;AAED,aAAa,4EAAsC,uBAAuB,CAAC,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,6BAAuD;IAC3G,YAAY,MAAqC;QAC7C,KAAK,CAAC,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,uFAA4C,MAAM,CAAC,CAAC;IAC5J,CAAC;CACJ;AAED,aAAa,sFAA2C,kCAAkC,CAAC,CAAC","sourcesContent":["import type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { RichTypeVector3, FlowGraphTypes, RichTypeNumber, RichTypeAny, RichTypeVector2, RichTypeMatrix, getRichTypeByFlowGraphType } from \"core/FlowGraph/flowGraphRichTypes\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { Matrix, Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\nimport { FlowGraphTernaryOperationBlock } from \"../flowGraphTernaryOperationBlock\";\nimport type { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport type { FlowGraphMatrix, FlowGraphVector } from \"core/FlowGraph/utils\";\nimport { _getClassNameOf } from \"core/FlowGraph/utils\";\n\n/**\n * Vector length block.\n */\nexport class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeNumber, (a) => this._polymorphicLength(a), FlowGraphBlockNames.Length, config);\n }\n\n private _polymorphicLength(a: FlowGraphVector) {\n const aClassName = _getClassNameOf(a);\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n\n/**\n * Configuration for normalized vector\n */\nexport interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * If true, the block will return NaN if the input vector has a length of 0.\n * This is the expected behavior for glTF interactivity graphs.\n */\n nanOnZeroLength?: boolean;\n}\n\n/**\n * Vector normalize block.\n */\nexport class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {\n constructor(config?: IFlowGraphNormalizeBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), FlowGraphBlockNames.Normalize, config);\n }\n\n private _polymorphicNormalize(a: FlowGraphVector) {\n const aClassName = _getClassNameOf(a);\n let normalized: FlowGraphVector;\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n normalized = a.normalizeToNew();\n if (this.config?.nanOnZeroLength) {\n const length = a.length();\n if (length === 0) {\n normalized.setAll(NaN);\n }\n }\n return normalized;\n default:\n throw new Error(`Cannot normalize value ${a}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n\n/**\n * Dot product block.\n */\nexport class FlowGraphDotBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphVector, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, RichTypeNumber, (a, b) => this._polymorphicDot(a, b), FlowGraphBlockNames.Dot, config);\n }\n\n private _polymorphicDot(a: FlowGraphVector, b: FlowGraphVector) {\n const className = _getClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n // casting is needed because dot requires both to be the same type\n return (a as Vector3).dot(b as Vector3);\n default:\n throw new Error(`Cannot get dot product of ${a} and ${b}`);\n }\n }\n}\nRegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n\n/**\n * Cross product block.\n */\nexport class FlowGraphCrossBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeVector3, (a, b) => Vector3.Cross(a, b), FlowGraphBlockNames.Cross, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n\n/**\n * 2D rotation block.\n */\nexport class FlowGraphRotate2DBlock extends FlowGraphBinaryOperationBlock<Vector2, number, Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector2, RichTypeNumber, RichTypeVector2, (a, b) => Vector2.Transform(a, Matrix.RotationZ(b)), FlowGraphBlockNames.Rotate2D, config);\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphTernaryOperationBlock<Vector3, Vector3, number, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(\n RichTypeVector3,\n RichTypeVector3,\n RichTypeNumber,\n RichTypeVector3,\n (a, b, c) => Vector3.TransformCoordinates(a, Matrix.RotationAxis(b, c)),\n FlowGraphBlockNames.Rotate3D,\n config\n );\n }\n}\nRegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n\nfunction _transformVector(a: FlowGraphVector, b: FlowGraphMatrix): FlowGraphVector {\n const className = _getClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n return (b as FlowGraphMatrix2D).transformVector(a as Vector2);\n case FlowGraphTypes.Vector3:\n return (b as FlowGraphMatrix3D).transformVector(a as Vector3);\n case FlowGraphTypes.Vector4:\n a = a as Vector4;\n // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4\n return new Vector4(\n a.x * b.m[0] + a.y * b.m[1] + a.z * b.m[2] + a.w * b.m[3],\n a.x * b.m[4] + a.y * b.m[5] + a.z * b.m[6] + a.w * b.m[7],\n a.x * b.m[8] + a.y * b.m[9] + a.z * b.m[10] + a.w * b.m[11],\n a.x * b.m[12] + a.y * b.m[13] + a.z * b.m[14] + a.w * b.m[15]\n );\n default:\n throw new Error(`Cannot transform value ${a}`);\n }\n}\n\n/**\n * Configuration for the transform block.\n */\nexport interface IFlowGraphTransformBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The vector type\n */\n vectorType: FlowGraphTypes;\n}\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformBlock extends FlowGraphBinaryOperationBlock<FlowGraphVector, FlowGraphMatrix, FlowGraphVector> {\n constructor(config?: IFlowGraphTransformBlockConfiguration) {\n const vectorType = config?.vectorType || FlowGraphTypes.Vector3;\n const matrixType =\n vectorType === FlowGraphTypes.Vector2 ? FlowGraphTypes.Matrix2D : vectorType === FlowGraphTypes.Vector3 ? FlowGraphTypes.Matrix3D : FlowGraphTypes.Matrix;\n super(\n getRichTypeByFlowGraphType(vectorType),\n getRichTypeByFlowGraphType(matrixType),\n getRichTypeByFlowGraphType(vectorType),\n _transformVector,\n FlowGraphBlockNames.TransformVector,\n config\n );\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n\n/**\n * Transform a vector3 by a matrix.\n */\nexport class FlowGraphTransformCoordinatesBlock extends FlowGraphBinaryOperationBlock<Vector3, Matrix, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeMatrix, RichTypeVector3, (a, b) => Vector3.TransformCoordinates(a, b), FlowGraphBlockNames.TransformCoordinates, config);\n }\n}\n\nRegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n"]}
@@ -1 +1,4 @@
1
1
  export * from "./flowGraphMathBlocks";
2
+ export * from "./flowGraphMathCombineExtractBlocks";
3
+ export * from "./flowGraphMatrixMathBlocks";
4
+ export * from "./flowGraphVectorMathBlocks";
@@ -1,2 +1,5 @@
1
1
  export * from "./flowGraphMathBlocks.js";
2
+ export * from "./flowGraphMathCombineExtractBlocks.js";
3
+ export * from "./flowGraphMatrixMathBlocks.js";
4
+ export * from "./flowGraphVectorMathBlocks.js";
2
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./flowGraphMathBlocks\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC","sourcesContent":["export * from \"./flowGraphMathBlocks\";\r\nexport * from \"./flowGraphMathCombineExtractBlocks\";\r\nexport * from \"./flowGraphMatrixMathBlocks\";\r\nexport * from \"./flowGraphVectorMathBlocks\";\r\n"]}
@@ -0,0 +1,85 @@
1
+ import type { FlowGraphAssetType } from "../../../flowGraphAssetsContext.js";
2
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
3
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
4
+ import type { FlowGraphContext } from "../../../flowGraphContext.js";
5
+ import type { FlowGraphDataConnection } from "../../../flowGraphDataConnection.js";
6
+ import { FlowGraphPathConverterComponent } from "../../../flowGraphPathConverterComponent.js";
7
+ import type { IObjectAccessor } from "../../../typeDefinitions.js";
8
+ import type { IPathToObjectConverter } from "../../../../ObjectModel/objectModelInterfaces.js";
9
+ import type { Animation } from "../../../../Animations/animation.js";
10
+ import type { EasingFunction } from "../../../../Animations/easing.js";
11
+ /**
12
+ * Configuration for the JSON pointer parser block.
13
+ */
14
+ export interface IFlowGraphJsonPointerParserBlockConfiguration extends IFlowGraphBlockConfiguration {
15
+ /**
16
+ * The JSON pointer to parse.
17
+ */
18
+ jsonPointer: string;
19
+ /**
20
+ * The path converter to use to convert the path to an object accessor.
21
+ */
22
+ pathConverter: IPathToObjectConverter<IObjectAccessor>;
23
+ /**
24
+ * Whether to output the value of the property.
25
+ */
26
+ outputValue?: boolean;
27
+ }
28
+ /**
29
+ * This block will take a JSON pointer and parse it to get the value from the JSON object.
30
+ * The output is an object and a property name.
31
+ * Optionally, the block can also output the value of the property. This is configurable.
32
+ */
33
+ export declare class FlowGraphJsonPointerParserBlock<P extends any, O extends FlowGraphAssetType> extends FlowGraphBlock {
34
+ /**
35
+ * the configuration of the block
36
+ */
37
+ config: IFlowGraphJsonPointerParserBlockConfiguration;
38
+ /**
39
+ * Output connection: The object that contains the property.
40
+ */
41
+ readonly object: FlowGraphDataConnection<O>;
42
+ /**
43
+ * Output connection: The property name.
44
+ */
45
+ readonly propertyName: FlowGraphDataConnection<string>;
46
+ /**
47
+ * Output connection: The value of the property.
48
+ * Note that per default this is not outputted. It can be enabled by setting the outputValue property to true.
49
+ */
50
+ readonly value: FlowGraphDataConnection<P>;
51
+ /**
52
+ * Output connection: A function that can be used to update the value of the property.
53
+ */
54
+ readonly setterFunction: FlowGraphDataConnection<(target: O, propertyName: string, value: P, context: FlowGraphContext) => void>;
55
+ /**
56
+ * Output connection: A function that can be used to get the value of the property.
57
+ */
58
+ readonly getterFunction: FlowGraphDataConnection<(target: O, propertyName: string, context: FlowGraphContext) => P | undefined>;
59
+ /**
60
+ * Output connection: A function that can be used to get the interpolation animation property info.
61
+ */
62
+ readonly generateAnimationsFunction: FlowGraphDataConnection<() => (keys: any[], fps: number, easingFunction?: EasingFunction) => Animation[]>;
63
+ /**
64
+ * Output connection: Whether the value is valid.
65
+ */
66
+ readonly isValid: FlowGraphDataConnection<boolean>;
67
+ /**
68
+ * The component with the templated inputs for the provided path.
69
+ */
70
+ readonly templateComponent: FlowGraphPathConverterComponent;
71
+ constructor(
72
+ /**
73
+ * the configuration of the block
74
+ */
75
+ config: IFlowGraphJsonPointerParserBlockConfiguration);
76
+ _updateOutputs(context: FlowGraphContext): void;
77
+ private _setPropertyValue;
78
+ private _getPropertyValue;
79
+ private _getInterpolationAnimationPropertyInfo;
80
+ /**
81
+ * Gets the class name of this block
82
+ * @returns the class name
83
+ */
84
+ getClassName(): string;
85
+ }
@@ -0,0 +1,133 @@
1
+ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphPathConverterComponent } from "../../../flowGraphPathConverterComponent.js";
3
+ import { RichTypeAny } from "../../../flowGraphRichTypes.js";
4
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
5
+ import { Color3, Color4 } from "../../../../Maths/math.color.js";
6
+ /**
7
+ * This block will take a JSON pointer and parse it to get the value from the JSON object.
8
+ * The output is an object and a property name.
9
+ * Optionally, the block can also output the value of the property. This is configurable.
10
+ */
11
+ export class FlowGraphJsonPointerParserBlock extends FlowGraphBlock {
12
+ constructor(
13
+ /**
14
+ * the configuration of the block
15
+ */
16
+ config) {
17
+ super(config);
18
+ this.config = config;
19
+ this.object = this.registerDataOutput("object", RichTypeAny);
20
+ this.propertyName = this.registerDataOutput("propertyName", RichTypeAny);
21
+ this.isValid = this.registerDataOutput("isValid", RichTypeAny);
22
+ if (config.outputValue) {
23
+ this.value = this.registerDataOutput("value", RichTypeAny);
24
+ }
25
+ this.setterFunction = this.registerDataOutput("setFunction", RichTypeAny, this._setPropertyValue.bind(this));
26
+ this.getterFunction = this.registerDataOutput("getFunction", RichTypeAny, this._getPropertyValue.bind(this));
27
+ this.generateAnimationsFunction = this.registerDataOutput("generateAnimationsFunction", RichTypeAny, this._getInterpolationAnimationPropertyInfo.bind(this));
28
+ this.templateComponent = new FlowGraphPathConverterComponent(config.jsonPointer, this);
29
+ }
30
+ _updateOutputs(context) {
31
+ try {
32
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
33
+ const value = accessorContainer.info.get(accessorContainer.object);
34
+ const object = accessorContainer.info.getTarget?.(accessorContainer.object);
35
+ const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);
36
+ if (!object) {
37
+ this.isValid.setValue(false, context);
38
+ return;
39
+ }
40
+ else {
41
+ this.object.setValue(object, context);
42
+ if (propertyName) {
43
+ this.propertyName.setValue(propertyName, context);
44
+ }
45
+ this.isValid.setValue(true, context);
46
+ }
47
+ if (this.config.outputValue) {
48
+ if (value === undefined) {
49
+ this.isValid.setValue(false, context);
50
+ }
51
+ else {
52
+ this.value.setValue(value, context);
53
+ this.isValid.setValue(true, context);
54
+ }
55
+ }
56
+ }
57
+ catch (e) {
58
+ this.isValid.setValue(false, context);
59
+ return;
60
+ }
61
+ }
62
+ _setPropertyValue(_target, _propertyName, value, context) {
63
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
64
+ const type = accessorContainer.info.type;
65
+ if (type.startsWith("Color")) {
66
+ value = ToColor(value, type);
67
+ }
68
+ accessorContainer.info.set?.(value, accessorContainer.object);
69
+ }
70
+ _getPropertyValue(_target, _propertyName, context) {
71
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
72
+ return accessorContainer.info.get(accessorContainer.object);
73
+ }
74
+ _getInterpolationAnimationPropertyInfo(_target, _propertyName, context) {
75
+ const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
76
+ return (keys, fps, animationType, easingFunction) => {
77
+ const animations = [];
78
+ // make sure keys are of the right type (in case of float3 color/vector)
79
+ const type = accessorContainer.info.type;
80
+ if (type.startsWith("Color")) {
81
+ keys = keys.map((key) => {
82
+ return {
83
+ frame: key.frame,
84
+ value: ToColor(key.value, type),
85
+ };
86
+ });
87
+ }
88
+ accessorContainer.info.interpolation?.forEach((info, index) => {
89
+ const name = accessorContainer.info.getPropertyName?.[index](accessorContainer.object) || "Animation-interpolation-" + index;
90
+ // generate the keys based on interpolation info
91
+ let newKeys = keys;
92
+ if (animationType !== info.type) {
93
+ // convert the keys to the right type
94
+ newKeys = keys.map((key) => {
95
+ return {
96
+ frame: key.frame,
97
+ value: info.getValue(undefined, key.value.asArray ? key.value.asArray() : [key.value], 0, 1),
98
+ };
99
+ });
100
+ }
101
+ const animationData = info.buildAnimations(accessorContainer.object, name, 60, newKeys);
102
+ animationData.forEach((animation) => {
103
+ if (easingFunction) {
104
+ animation.babylonAnimation.setEasingFunction(easingFunction);
105
+ }
106
+ animations.push(animation.babylonAnimation);
107
+ });
108
+ });
109
+ return animations;
110
+ };
111
+ }
112
+ /**
113
+ * Gets the class name of this block
114
+ * @returns the class name
115
+ */
116
+ getClassName() {
117
+ return "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */;
118
+ }
119
+ }
120
+ function ToColor(value, expectedValue) {
121
+ if (value.getClassName().startsWith("Color")) {
122
+ return value;
123
+ }
124
+ if (expectedValue === "Color3") {
125
+ return new Color3(value.x, value.y, value.z);
126
+ }
127
+ else if (expectedValue === "Color4") {
128
+ return new Color4(value.x, value.y, value.z, value.w);
129
+ }
130
+ return value;
131
+ }
132
+ RegisterClass("FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, FlowGraphJsonPointerParserBlock);
133
+ //# sourceMappingURL=flowGraphJsonPointerParserBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowGraphJsonPointerParserBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAG/D,OAAO,EAAE,+BAA+B,EAAE,oDAAuD;AACjG,OAAO,EAAE,WAAW,EAAE,uCAA0C;AAIhE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,wCAA8B;AAqBvD;;;;GAIG;AACH,MAAM,OAAO,+BAA6E,SAAQ,cAAc;IA0C5G;IACI;;OAEG;IACa,MAAqD;QAErE,KAAK,CAAC,MAAM,CAAC,CAAC;QAFE,WAAM,GAAN,MAAM,CAA+C;QAGrE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC/D,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,I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,CAAC;QAC7B,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;SAAM,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,aAAa,gFAAwC,+BAA+B,CAAC,CAAC","sourcesContent":["import type { FlowGraphAssetType } from \"core/FlowGraph/flowGraphAssetsContext\";\nimport type { IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport type { FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport type { FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { FlowGraphPathConverterComponent } from \"core/FlowGraph/flowGraphPathConverterComponent\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes\";\nimport type { IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\nimport type { IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport type { Animation } from \"core/Animations/animation\";\nimport type { EasingFunction } from \"core/Animations/easing\";\nimport type { Vector4 } from \"core/Maths/math.vector\";\nimport { Color3, Color4 } from \"core/Maths/math.color\";\n\n/**\n * Configuration for the JSON pointer parser block.\n */\nexport interface IFlowGraphJsonPointerParserBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The JSON pointer to parse.\n */\n jsonPointer: string;\n /**\n * The path converter to use to convert the path to an object accessor.\n */\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\n\n /**\n * Whether to output the value of the property.\n */\n outputValue?: boolean;\n}\n\n/**\n * This block will take a JSON pointer and parse it to get the value from the JSON object.\n * The output is an object and a property name.\n * Optionally, the block can also output the value of the property. This is configurable.\n */\nexport class FlowGraphJsonPointerParserBlock<P extends any, O extends FlowGraphAssetType> extends FlowGraphBlock {\n /**\n * Output connection: The object that contains the property.\n */\n public readonly object: FlowGraphDataConnection<O>;\n\n /**\n * Output connection: The property name.\n */\n public readonly propertyName: FlowGraphDataConnection<string>;\n\n /**\n * Output connection: The value of the property.\n * Note that per default this is not outputted. It can be enabled by setting the outputValue property to true.\n */\n public readonly value: FlowGraphDataConnection<P>;\n\n /**\n * Output connection: A function that can be used to update the value of the property.\n */\n public readonly setterFunction: FlowGraphDataConnection<(target: O, propertyName: string, value: P, context: FlowGraphContext) => void>;\n\n /**\n * Output connection: A function that can be used to get the value of the property.\n */\n public readonly getterFunction: FlowGraphDataConnection<(target: O, propertyName: string, context: FlowGraphContext) => P | undefined>;\n\n /**\n * Output connection: A function that can be used to get the interpolation animation property info.\n */\n public readonly generateAnimationsFunction: FlowGraphDataConnection<() => (keys: any[], fps: number, easingFunction?: EasingFunction) => Animation[]>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n /**\n * The component with the templated inputs for the provided path.\n */\n public readonly templateComponent: FlowGraphPathConverterComponent;\n\n constructor(\n /**\n * the configuration of the block\n */\n public override config: IFlowGraphJsonPointerParserBlockConfiguration\n ) {\n super(config);\n this.object = this.registerDataOutput(\"object\", RichTypeAny);\n this.propertyName = this.registerDataOutput(\"propertyName\", RichTypeAny);\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeAny);\n if (config.outputValue) {\n this.value = this.registerDataOutput(\"value\", RichTypeAny);\n }\n this.setterFunction = this.registerDataOutput(\"setFunction\", RichTypeAny, this._setPropertyValue.bind(this));\n this.getterFunction = this.registerDataOutput(\"getFunction\", RichTypeAny, this._getPropertyValue.bind(this));\n this.generateAnimationsFunction = this.registerDataOutput(\"generateAnimationsFunction\", RichTypeAny, this._getInterpolationAnimationPropertyInfo.bind(this));\n this.templateComponent = new FlowGraphPathConverterComponent(config.jsonPointer, this);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n try {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n const value = accessorContainer.info.get(accessorContainer.object);\n const object = accessorContainer.info.getTarget?.(accessorContainer.object);\n const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);\n if (!object) {\n this.isValid.setValue(false, context);\n return;\n } else {\n this.object.setValue(object, context);\n if (propertyName) {\n this.propertyName.setValue(propertyName, context);\n }\n this.isValid.setValue(true, context);\n }\n if (this.config.outputValue) {\n if (value === undefined) {\n this.isValid.setValue(false, context);\n } else {\n this.value.setValue(value, context);\n this.isValid.setValue(true, context);\n }\n }\n } catch (e) {\n this.isValid.setValue(false, context);\n return;\n }\n }\n\n private _setPropertyValue(_target: O, _propertyName: string, value: P, context: FlowGraphContext): void {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n const type = accessorContainer.info.type;\n if (type.startsWith(\"Color\")) {\n value = ToColor(value as Vector4, type) as unknown as P;\n }\n accessorContainer.info.set?.(value, accessorContainer.object);\n }\n\n private _getPropertyValue(_target: O, _propertyName: string, context: FlowGraphContext): P | undefined {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n return accessorContainer.info.get(accessorContainer.object);\n }\n\n private _getInterpolationAnimationPropertyInfo(\n _target: O,\n _propertyName: string,\n context: FlowGraphContext\n ): (keys: any[], fps: number, animationType: number, easingFunction?: EasingFunction) => Animation[] {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n return (keys: any[], fps: number, animationType: number, easingFunction?: EasingFunction) => {\n const animations: Animation[] = [];\n // make sure keys are of the right type (in case of float3 color/vector)\n const type = accessorContainer.info.type;\n if (type.startsWith(\"Color\")) {\n keys = keys.map((key) => {\n return {\n frame: key.frame,\n value: ToColor(key.value, type),\n };\n });\n }\n accessorContainer.info.interpolation?.forEach((info, index) => {\n const name = accessorContainer.info.getPropertyName?.[index](accessorContainer.object) || \"Animation-interpolation-\" + index;\n // generate the keys based on interpolation info\n let newKeys: any[] = keys;\n if (animationType !== info.type) {\n // convert the keys to the right type\n newKeys = keys.map((key) => {\n return {\n frame: key.frame,\n value: info.getValue(undefined, key.value.asArray ? key.value.asArray() : [key.value], 0, 1),\n };\n });\n }\n const animationData = info.buildAnimations(accessorContainer.object, name, 60, newKeys);\n animationData.forEach((animation) => {\n if (easingFunction) {\n animation.babylonAnimation.setEasingFunction(easingFunction);\n }\n animations.push(animation.babylonAnimation);\n });\n });\n\n return animations;\n };\n }\n\n /**\n * Gets the class name of this block\n * @returns the class name\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.JsonPointerParser;\n }\n}\n\nfunction ToColor(value: any, expectedValue: string) {\n if (value.getClassName().startsWith(\"Color\")) {\n return value as unknown as Color3 | Color4;\n }\n if (expectedValue === \"Color3\") {\n return new Color3(value.x, value.y, value.z);\n } else if (expectedValue === \"Color4\") {\n return new Color4(value.x, value.y, value.z, value.w);\n }\n return value;\n}\n\nRegisterClass(FlowGraphBlockNames.JsonPointerParser, FlowGraphJsonPointerParserBlock);\n"]}
@@ -0,0 +1,49 @@
1
+ import type { IFlowGraphBlockConfiguration } from "../../../flowGraphBlock.js";
2
+ import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock";
3
+ import { FlowGraphInteger } from "../../../CustomTypes/flowGraphInteger.js";
4
+ /**
5
+ * A block that converts a boolean to a float.
6
+ */
7
+ export declare class FlowGraphBooleanToFloat extends FlowGraphUnaryOperationBlock<boolean, number> {
8
+ constructor(config?: IFlowGraphBlockConfiguration);
9
+ }
10
+ /**
11
+ * A block that converts a boolean to an integer
12
+ */
13
+ export declare class FlowGraphBooleanToInt extends FlowGraphUnaryOperationBlock<boolean, FlowGraphInteger> {
14
+ constructor(config?: IFlowGraphBlockConfiguration);
15
+ }
16
+ /**
17
+ * A block that converts a float to a boolean.
18
+ */
19
+ export declare class FlowGraphFloatToBoolean extends FlowGraphUnaryOperationBlock<number, boolean> {
20
+ constructor(config?: IFlowGraphBlockConfiguration);
21
+ }
22
+ /**
23
+ * A block that converts an integer to a boolean.
24
+ */
25
+ export declare class FlowGraphIntToBoolean extends FlowGraphUnaryOperationBlock<FlowGraphInteger, boolean> {
26
+ constructor(config?: IFlowGraphBlockConfiguration);
27
+ }
28
+ /**
29
+ * A block that converts an integer to a float.
30
+ */
31
+ export declare class FlowGraphIntToFloat extends FlowGraphUnaryOperationBlock<FlowGraphInteger, number> {
32
+ constructor(config?: IFlowGraphBlockConfiguration);
33
+ }
34
+ /**
35
+ * Configuration for the float to int block.
36
+ */
37
+ export interface IFlowGraphFloatToIntConfiguration extends IFlowGraphBlockConfiguration {
38
+ /**
39
+ * The rounding mode to use.
40
+ * if not defined, it will use the FlowGraphInteger default rounding ( a | 0 )
41
+ */
42
+ roundingMode?: "floor" | "ceil" | "round";
43
+ }
44
+ /**
45
+ * A block that converts a float to an integer.
46
+ */
47
+ export declare class FlowGraphFloatToInt extends FlowGraphUnaryOperationBlock<number, FlowGraphInteger> {
48
+ constructor(config?: IFlowGraphFloatToIntConfiguration);
49
+ }