@onerjs/core 8.54.3 → 8.54.5

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 (211) hide show
  1. package/DeviceInput/webDeviceInputSystem.js +4 -0
  2. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
  4. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
  5. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
  6. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
  7. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
  8. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
  9. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  10. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
  11. package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
  12. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
  13. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
  14. package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
  15. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  16. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
  18. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  19. package/Engines/WebGPU/webgpuTextureManager.js +4 -2
  20. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  21. package/Engines/abstractEngine.pure.js +2 -2
  22. package/Engines/abstractEngine.pure.js.map +1 -1
  23. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  24. package/Engines/thinNativeEngine.pure.js +29 -6
  25. package/Engines/thinNativeEngine.pure.js.map +1 -1
  26. package/Engines/webgpuEngine.pure.d.ts +1 -0
  27. package/Engines/webgpuEngine.pure.js +21 -8
  28. package/Engines/webgpuEngine.pure.js.map +1 -1
  29. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  30. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  36. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  37. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  38. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  39. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  41. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  42. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  44. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  46. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  47. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  48. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  49. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  51. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  52. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  53. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  54. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  55. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  56. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  57. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  58. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  61. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  62. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  63. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  64. package/FlowGraph/Blocks/Event/index.js +1 -0
  65. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  66. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  67. package/FlowGraph/Blocks/Event/pure.js +1 -0
  68. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  69. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  70. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  75. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  76. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  78. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  84. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  85. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  86. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  87. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  88. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  89. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  90. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  91. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  92. package/FlowGraph/flowGraphContext.d.ts +23 -0
  93. package/FlowGraph/flowGraphContext.js +29 -0
  94. package/FlowGraph/flowGraphContext.js.map +1 -1
  95. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  96. package/FlowGraph/flowGraphCoordinator.js +72 -0
  97. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  98. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  99. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  100. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  101. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  102. package/FlowGraph/flowGraphHostResolver.js +25 -0
  103. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  104. package/FlowGraph/flowGraphMath.d.ts +48 -1
  105. package/FlowGraph/flowGraphMath.js +169 -4
  106. package/FlowGraph/flowGraphMath.js.map +1 -1
  107. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  108. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  109. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  110. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  111. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  112. package/FlowGraph/index.d.ts +2 -0
  113. package/FlowGraph/index.js +2 -0
  114. package/FlowGraph/index.js.map +1 -1
  115. package/FlowGraph/pure.d.ts +2 -0
  116. package/FlowGraph/pure.js +2 -0
  117. package/FlowGraph/pure.js.map +1 -1
  118. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +3 -1
  119. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  120. package/Maths/math.vector.pure.d.ts +10 -0
  121. package/Maths/math.vector.pure.js +13 -0
  122. package/Maths/math.vector.pure.js.map +1 -1
  123. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  124. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  125. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  126. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  127. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +487 -54
  128. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  129. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  130. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  131. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +48 -10
  133. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  134. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  135. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  136. package/Meshes/abstractMesh.pure.js +5 -3
  137. package/Meshes/abstractMesh.pure.js.map +1 -1
  138. package/Misc/greasedLineTools.js +1 -1
  139. package/Misc/greasedLineTools.js.map +1 -1
  140. package/Misc/tools.pure.js +14 -2
  141. package/Misc/tools.pure.js.map +1 -1
  142. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  143. package/Particles/gpuParticleSystem.pure.js +189 -49
  144. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  145. package/Physics/v2/Plugins/havokPlugin.d.ts +15 -0
  146. package/Physics/v2/Plugins/havokPlugin.js +16 -6
  147. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  148. package/Physics/v2/characterController.js +71 -19
  149. package/Physics/v2/characterController.js.map +1 -1
  150. package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.d.ts +5 -0
  151. package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.js +29 -0
  152. package/ShadersWGSL/ShadersInclude/clusteredLightingCompute.js.map +1 -0
  153. package/ShadersWGSL/ShadersInclude/lightFragment.js +2 -3
  154. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  155. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
  156. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +2 -17
  157. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  158. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.d.ts +6 -0
  159. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js +123 -0
  160. package/ShadersWGSL/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -0
  161. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +1 -1
  162. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +2 -111
  163. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  164. package/ShadersWGSL/background.fragment.js +2 -1
  165. package/ShadersWGSL/background.fragment.js.map +1 -1
  166. package/ShadersWGSL/default.fragment.js +2 -1
  167. package/ShadersWGSL/default.fragment.js.map +1 -1
  168. package/ShadersWGSL/openpbr.fragment.js +2 -1
  169. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  170. package/ShadersWGSL/pbr.fragment.js +2 -1
  171. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  172. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  173. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  174. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  175. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  176. package/XR/features/WebXRAbstractFeature.js +16 -0
  177. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  178. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  179. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  180. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  181. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  182. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  183. package/XR/features/WebXRLayers.pure.js +65 -8
  184. package/XR/features/WebXRLayers.pure.js.map +1 -1
  185. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  186. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  187. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  188. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  189. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  190. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  191. package/XR/webXRCamera.js +27 -0
  192. package/XR/webXRCamera.js.map +1 -1
  193. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  194. package/XR/webXRFeatureWarningRegistry.js +19 -0
  195. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  196. package/XR/webXRFeaturesManager.d.ts +5 -0
  197. package/XR/webXRFeaturesManager.js +23 -4
  198. package/XR/webXRFeaturesManager.js.map +1 -1
  199. package/XR/webXRGraphicsBinding.d.ts +17 -10
  200. package/XR/webXRGraphicsBinding.js +8 -5
  201. package/XR/webXRGraphicsBinding.js.map +1 -1
  202. package/XR/webXRSessionManager.d.ts +3 -5
  203. package/XR/webXRSessionManager.js +1 -3
  204. package/XR/webXRSessionManager.js.map +1 -1
  205. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  206. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  207. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  208. package/package.json +1 -1
  209. package/scene.pure.d.ts +7 -0
  210. package/scene.pure.js +8 -0
  211. package/scene.pure.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphMatrixMathBlocks.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAqC,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGlG,OAAO,EAEH,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,cAA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CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1I,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACrC,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;YAC5D,OAAO,CAAC,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,wEAAyC;IAC7C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,iCAAiC;IAC7C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,gEAAgC,uBAAuB,CAAC,CAAC;IACtE,aAAa,oEAAkC,yBAAyB,CAAC,CAAC;IAC1E,aAAa,sEAAmC,0BAA0B,CAAC,CAAC;IAC5E,aAAa,sFAA2C,kCAAkC,CAAC,CAAC;IAC5F,aAAa,uEAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,mEAAoC,2BAA2B,CAAC,CAAC;AAClF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type IFlowGraphBlockConfiguration, FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport {\n FlowGraphTypes,\n getRichTypeByFlowGraphType,\n RichTypeBoolean,\n RichTypeMatrix,\n RichTypeNumber,\n RichTypeQuaternion,\n RichTypeVector3,\n} from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { Matrix, Quaternion, Vector3 } from \"core/Maths/math.vector.pure\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { type FlowGraphMatrix2D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { type FlowGraphMatrix } from \"core/FlowGraph/utils\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\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}\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}\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}\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) => b.multiply(a as any),\n FlowGraphBlockNames.MatrixMultiplication,\n config\n );\n }\n}\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 /**\n * Is the matrix valid\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\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 this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean, false);\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 // check matrix last column components should be 0,0,0,1\n // round them to 4 decimal places\n const m3 = Math.round(matrix.m[3] * 10000) / 10000;\n const m7 = Math.round(matrix.m[7] * 10000) / 10000;\n const m11 = Math.round(matrix.m[11] * 10000) / 10000;\n const m15 = Math.round(matrix.m[15] * 10000) / 10000;\n if (m3 !== 0 || m7 !== 0 || m11 !== 0 || m15 !== 1) {\n this.isValid.setValue(false, context);\n this.position.setValue(Vector3.Zero(), context);\n this.rotationQuaternion.setValue(Quaternion.Identity(), context);\n this.scaling.setValue(Vector3.One(), context);\n return;\n }\n // make the checks for validity\n const valid = matrix.decompose(scaling, rotation, position);\n this.isValid.setValue(valid, context);\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\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 value: 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.value = this.registerDataOutput(\"value\", 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.value.setValue(cachedMatrix, context);\n } else {\n const matrix = Matrix.Compose(this.scaling.getValue(context), this.rotationQuaternion.getValue(context), this.position.getValue(context));\n this.value.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\nlet _Registered = false;\n/**\n * Register side effects for flowGraphMatrixMathBlocks.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphMatrixMathBlocks(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.Transpose, FlowGraphTransposeBlock);\n RegisterClass(FlowGraphBlockNames.Determinant, FlowGraphDeterminantBlock);\n RegisterClass(FlowGraphBlockNames.InvertMatrix, FlowGraphInvertMatrixBlock);\n RegisterClass(FlowGraphBlockNames.MatrixMultiplication, FlowGraphMatrixMultiplicationBlock);\n RegisterClass(FlowGraphBlockNames.MatrixDecompose, FlowGraphMatrixDecomposeBlock);\n RegisterClass(FlowGraphBlockNames.MatrixCompose, FlowGraphMatrixComposeBlock);\n}\n"]}
1
+ {"version":3,"file":"flowGraphMatrixMathBlocks.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAqC,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGlG,OAAO,EAEH,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,GAClB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;GAGG;AACH,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAE9C;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,UAA0B;IAChD,IAAI,UAAU,6CAA4B,EAAE,CAAC;QACzC,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,UAAU,6CAA4B,EAAE,CAAC;QACzC,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,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AAyC;IAC7C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,iCAAiC;IAC7C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,gEAAgC,uBAAuB,CAAC,CAAC;IACtE,aAAa,oEAAkC,yBAAyB,CAAC,CAAC;IAC1E,aAAa,sEAAmC,0BAA0B,CAAC,CAAC;IAC5E,aAAa,sFAA2C,kCAAkC,CAAC,CAAC;IAC5F,aAAa,uEAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,mEAAoC,2BAA2B,CAAC,CAAC;AAClF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type Nullable } from \"core/types\";\nimport { type IFlowGraphBlockConfiguration, FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport {\n FlowGraphTypes,\n getRichTypeByFlowGraphType,\n RichTypeBoolean,\n RichTypeMatrix,\n RichTypeNumber,\n RichTypeQuaternion,\n RichTypeVector3,\n} from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { Matrix, Quaternion, Vector3 } from \"core/Maths/math.vector.pure\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { FlowGraphCachedOperationBlock } from \"../flowGraphCachedOperationBlock\";\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { type FlowGraphMatrix } from \"core/FlowGraph/utils\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\n/**\n * Threshold below which the determinant of the normalized 3x3 of a matrix is treated as zero, indicating a\n * degenerate (non-decomposable) matrix whose columns are linearly dependent.\n */\nconst MatrixDecomposeDegenerateEpsilon = 1e-6;\n\n/**\n * Builds a matrix of the given flow graph matrix type with every element set to zero.\n * @param matrixType the matrix type to build\n * @returns the zero matrix\n */\nfunction CreateZeroMatrix(matrixType: FlowGraphTypes): FlowGraphMatrix {\n if (matrixType === FlowGraphTypes.Matrix2D) {\n return new FlowGraphMatrix2D([0, 0, 0, 0]);\n }\n if (matrixType === FlowGraphTypes.Matrix3D) {\n return new FlowGraphMatrix3D([0, 0, 0, 0, 0, 0, 0, 0, 0]);\n }\n return Matrix.FromArray(new Array(16).fill(0));\n}\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/**\n * Configuration for the matrix decompose block.\n */\nexport interface IFlowGraphMatrixDecomposeBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * When a matrix cannot be decomposed, output the translation and the raw column lengths that were\n * extracted from the matrix instead of the type-default translation and scale. `isValid` is reported\n * as `false` either way. Defaults to `false`.\n *\n * A host whose specification requires those components to be preserved can turn this on; it is\n * opt-in so that the default block behaviour stays unchanged.\n */\n keepDegenerateComponents?: boolean;\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}\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}\n\n/**\n * Inverts a matrix.\n */\nexport class FlowGraphInvertMatrixBlock extends FlowGraphCachedOperationBlock<FlowGraphMatrix> {\n /**\n * The matrix to invert.\n */\n public readonly a: FlowGraphDataConnection<FlowGraphMatrix>;\n\n private readonly _matrixType: FlowGraphTypes;\n\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(getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix), config);\n this._matrixType = config?.matrixType || FlowGraphTypes.Matrix;\n this.a = this.registerDataInput(\"a\", getRichTypeByFlowGraphType(config?.matrixType || FlowGraphTypes.Matrix));\n }\n\n public override _doOperation(context: FlowGraphContext): FlowGraphMatrix | undefined {\n const a = this.a.getValue(context);\n // A matrix is only invertible when its determinant is a finite, non-zero number. For a zero, NaN, or\n // infinite determinant, returning undefined makes the cached base report isValid = false.\n const determinant = a.determinant();\n if (determinant === 0 || !Number.isFinite(determinant)) {\n return undefined;\n }\n return (a as FlowGraphMatrix2D).inverse ? (a as FlowGraphMatrix2D).inverse() : Matrix.Invert(a as Matrix);\n }\n\n /**\n * A matrix with no inverse reports an all-zero matrix rather than the identity default of the\n * matrix type, so the output is not mistaken for a meaningful transform.\n * @returns a matrix of the block's type with every element set to zero\n */\n protected override _getInvalidOutputValue(): FlowGraphMatrix {\n return CreateZeroMatrix(this._matrixType);\n }\n public override getClassName(): string {\n return FlowGraphBlockNames.InvertMatrix;\n }\n}\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) => b.multiply(a as any),\n FlowGraphBlockNames.MatrixMultiplication,\n config\n );\n }\n}\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 /**\n * Is the matrix valid\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphMatrixDecomposeBlockConfiguration) {\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 this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean, false);\n }\n\n public override _updateOutputs(context: FlowGraphContext) {\n // _updateOutputs runs on every read of any of this block's four outputs. Cache the decomposition\n // per executionId (matching FlowGraphMatrixComposeBlock below) so reading all four outputs in one\n // frame does the work once instead of four times.\n const cachedExecutionId = context._getExecutionVariable(this, \"executionId\", -1);\n const cachedPosition = context._getExecutionVariable<Nullable<Vector3>>(this, \"cachedPosition\", null);\n const cachedRotation = context._getExecutionVariable<Nullable<Quaternion>>(this, \"cachedRotation\", null);\n const cachedScaling = context._getExecutionVariable<Nullable<Vector3>>(this, \"cachedScaling\", null);\n const cachedIsValid = context._getExecutionVariable<Nullable<boolean>>(this, \"cachedIsValid\", null);\n if (cachedExecutionId === context.executionId && cachedPosition && cachedRotation && cachedScaling && cachedIsValid !== null) {\n this.isValid.setValue(cachedIsValid, context);\n this.position.setValue(cachedPosition, context);\n this.rotationQuaternion.setValue(cachedRotation, context);\n this.scaling.setValue(cachedScaling, context);\n return;\n }\n\n const matrix = this.input.getValue(context);\n const m = matrix.m;\n const keepDegenerateComponents = !!(this.config as IFlowGraphMatrixDecomposeBlockConfiguration | undefined)?.keepDegenerateComponents;\n\n // The fourth row of the matrix is ignored: the translation comes from the first three elements of the\n // fourth column, the scale from the lengths of the first three columns of the upper-left 3x3, and the\n // rotation from that 3x3 once normalized.\n const translation = new Vector3(m[12], m[13], m[14]);\n const scaleX = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\n const scaleY = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\n const scaleZ = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\n\n // The matrix cannot be decomposed: the rotation is undefined, so report an identity rotation and either the\n // components that were extracted from the matrix or the type defaults.\n const degenerateOutputs = (keepComponents: boolean) => ({\n isValid: false,\n rotationQuaternion: Quaternion.Identity(),\n position: keepComponents ? translation : Vector3.Zero(),\n scaling: keepComponents ? new Vector3(scaleX, scaleY, scaleZ) : Vector3.One(),\n });\n\n let result: { isValid: boolean; position: Vector3; rotationQuaternion: Quaternion; scaling: Vector3 };\n\n const areScalesFinite = Number.isFinite(scaleX) && Number.isFinite(scaleY) && Number.isFinite(scaleZ);\n const isTranslationFinite = Number.isFinite(m[12]) && Number.isFinite(m[13]) && Number.isFinite(m[14]);\n if (!areScalesFinite || (!keepDegenerateComponents && !isTranslationFinite)) {\n result = degenerateOutputs(keepDegenerateComponents);\n } else if (scaleX === 0 || scaleY === 0 || scaleZ === 0) {\n // A zero scale component leaves the rotation undefined, but the translation and the (degenerate) scale\n // are still well-defined, so they are reported as-is.\n result = degenerateOutputs(true);\n } else {\n // The determinant of the upper-left 3x3 (the fourth row is ignored) gives the handedness; dividing by the\n // product of the scales yields the determinant of the normalized 3x3, which is (close to) zero only when the\n // columns are linearly dependent — a degenerate matrix that cannot represent a rotation.\n const determinant = m[0] * (m[5] * m[10] - m[6] * m[9]) - m[4] * (m[1] * m[10] - m[2] * m[9]) + m[8] * (m[1] * m[6] - m[2] * m[5]);\n const normalizedDeterminant = determinant / (scaleX * scaleY * scaleZ);\n if (Math.abs(normalizedDeterminant) < MatrixDecomposeDegenerateEpsilon) {\n result = degenerateOutputs(keepDegenerateComponents);\n } else {\n // The remaining matrix is well-formed, so the actual translation/rotation/scale extraction is delegated\n // to the shared Matrix.decompose. That keeps the rotation and the handedness-sign convention identical to\n // the rest of Babylon (a left-handed matrix negates the same scale component everywhere). The fourth row is\n // reset to (0, 0, 0, 1) first because this operation ignores it, whereas Matrix.decompose's internal\n // determinant would otherwise let a non-standard fourth row flip the handedness.\n const normalized = Matrix.FromValues(m[0], m[1], m[2], 0, m[4], m[5], m[6], 0, m[8], m[9], m[10], 0, m[12], m[13], m[14], 1);\n const outScaling = new Vector3();\n const outRotation = new Quaternion();\n const outPosition = new Vector3();\n normalized.decompose(outScaling, outRotation, outPosition);\n result = { isValid: true, position: outPosition, rotationQuaternion: outRotation, scaling: outScaling };\n }\n }\n\n this.isValid.setValue(result.isValid, context);\n this.position.setValue(result.position, context);\n this.rotationQuaternion.setValue(result.rotationQuaternion, context);\n this.scaling.setValue(result.scaling, context);\n context._setExecutionVariable(this, \"cachedIsValid\", result.isValid);\n context._setExecutionVariable(this, \"cachedPosition\", result.position);\n context._setExecutionVariable(this, \"cachedRotation\", result.rotationQuaternion);\n context._setExecutionVariable(this, \"cachedScaling\", result.scaling);\n context._setExecutionVariable(this, \"executionId\", context.executionId);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.MatrixDecompose;\n }\n}\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 value: 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.value = this.registerDataOutput(\"value\", 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.value.setValue(cachedMatrix, context);\n } else {\n const matrix = Matrix.Compose(this.scaling.getValue(context), this.rotationQuaternion.getValue(context), this.position.getValue(context));\n this.value.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\nlet _Registered = false;\n/**\n * Register side effects for flowGraphMatrixMathBlocks.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphMatrixMathBlocks(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.Transpose, FlowGraphTransposeBlock);\n RegisterClass(FlowGraphBlockNames.Determinant, FlowGraphDeterminantBlock);\n RegisterClass(FlowGraphBlockNames.InvertMatrix, FlowGraphInvertMatrixBlock);\n RegisterClass(FlowGraphBlockNames.MatrixMultiplication, FlowGraphMatrixMultiplicationBlock);\n RegisterClass(FlowGraphBlockNames.MatrixDecompose, FlowGraphMatrixDecomposeBlock);\n RegisterClass(FlowGraphBlockNames.MatrixCompose, FlowGraphMatrixComposeBlock);\n}\n"]}
@@ -3,7 +3,9 @@ import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from "../../../flow
3
3
  import { FlowGraphTypes } from "../../../flowGraphRichTypes.pure.js";
4
4
  import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
5
5
  import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
6
- import { Quaternion, Vector3, type Matrix, type Vector2 } from "../../../../Maths/math.vector.pure.js";
6
+ import { FlowGraphTernaryOperationBlock } from "../flowGraphTernaryOperationBlock.js";
7
+ import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js";
8
+ import { Quaternion, Vector2, Vector3, type Matrix } from "../../../../Maths/math.vector.pure.js";
7
9
  import { type FlowGraphMatrix, type FlowGraphVector } from "../../../utils.js";
8
10
  import { type FlowGraphDataConnection } from "../../../flowGraphDataConnection.pure.js";
9
11
  import { type FlowGraphContext } from "../../../flowGraphContext.js";
@@ -27,9 +29,22 @@ export interface IFlowGraphNormalizeBlockConfiguration extends IFlowGraphBlockCo
27
29
  /**
28
30
  * Vector normalize block.
29
31
  */
30
- export declare class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock<FlowGraphVector, FlowGraphVector> {
32
+ export declare class FlowGraphNormalizeBlock extends FlowGraphCachedOperationBlock<FlowGraphVector> {
33
+ /**
34
+ * The vector to normalize.
35
+ */
36
+ readonly a: FlowGraphDataConnection<FlowGraphVector>;
31
37
  constructor(config?: IFlowGraphNormalizeBlockConfiguration);
38
+ _doOperation(context: FlowGraphContext): FlowGraphVector | undefined;
39
+ /**
40
+ * A vector that cannot be normalized reports a vector of the same type with every component set
41
+ * to zero, so the output stays type-consistent with the input instead of being left undefined.
42
+ * @param context the graph context
43
+ * @returns a zero vector matching the input's type
44
+ */
45
+ protected _getInvalidOutputValue(context: FlowGraphContext): FlowGraphVector;
32
46
  private _polymorphicNormalize;
47
+ getClassName(): string;
33
48
  }
34
49
  /**
35
50
  * Dot product block.
@@ -131,6 +146,45 @@ export declare class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBloc
131
146
  export declare class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {
132
147
  constructor(config?: IFlowGraphBlockConfiguration);
133
148
  }
149
+ /**
150
+ * Get a rotation quaternion from the specified up and forward directions.
151
+ */
152
+ export declare class FlowGraphQuaternionFromUpForwardBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {
153
+ constructor(config?: IFlowGraphBlockConfiguration);
154
+ }
155
+ /**
156
+ * Spherical linear interpolation between two vectors.
157
+ * Supports float2 and float3 vectors; the interpolation coefficient is a number.
158
+ */
159
+ export declare class FlowGraphVectorSlerpBlock extends FlowGraphTernaryOperationBlock<FlowGraphVector, FlowGraphVector, number, FlowGraphVector> {
160
+ constructor(config?: IFlowGraphBlockConfiguration);
161
+ private _polymorphicSlerp;
162
+ }
163
+ /**
164
+ * The configuration of the FlowGraphQuaternionFromAnglesBlock.
165
+ */
166
+ export interface IFlowGraphQuaternionFromAnglesBlockConfiguration extends IFlowGraphBlockConfiguration {
167
+ /**
168
+ * The intrinsic Tait–Bryan rotation order, one of `xyz`, `xzy`, `yxz`, `yzx`, `zxy`, `zyx`.
169
+ * Any other (or missing) value falls back to the spec default `yxz`.
170
+ */
171
+ order?: string;
172
+ }
173
+ /**
174
+ * Creates a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in a
175
+ * configurable order.
176
+ *
177
+ * Inputs `a`, `b`, `c` are the rotations (in radians) around the X, Y and Z axes respectively.
178
+ * The `order` configuration selects the intrinsic rotation order; NaN and infinite inputs
179
+ * propagate into the resulting quaternion components.
180
+ */
181
+ export declare class FlowGraphQuaternionFromAnglesBlock extends FlowGraphTernaryOperationBlock<number, number, number, Quaternion> {
182
+ /**
183
+ * The validated intrinsic rotation order used to compose the quaternion.
184
+ */
185
+ private readonly _order;
186
+ constructor(config?: IFlowGraphQuaternionFromAnglesBlockConfiguration);
187
+ }
134
188
  /**
135
189
  * Register side effects for flowGraphVectorMathBlocks.
136
190
  * Safe to call multiple times; only the first call has an effect.
@@ -3,9 +3,11 @@ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
3
3
  import { RichTypeVector3, RichTypeNumber, RichTypeAny, RichTypeVector2, RichTypeMatrix, getRichTypeByFlowGraphType, RichTypeQuaternion, RichTypeBoolean, } from "../../../flowGraphRichTypes.pure.js";
4
4
  import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
5
5
  import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
6
- import { Quaternion, Vector3, Vector4 } from "../../../../Maths/math.vector.pure.js";
6
+ import { FlowGraphTernaryOperationBlock } from "../flowGraphTernaryOperationBlock.js";
7
+ import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js";
8
+ import { Quaternion, Vector2, Vector3, Vector4 } from "../../../../Maths/math.vector.pure.js";
7
9
  import { _GetClassNameOf } from "../../../utils.js";
8
- import { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from "../../../flowGraphMath.js";
10
+ import { GetAngleBetweenQuaternions, GetQuaternionFromDirections, GetQuaternionFromEulerAngles, GetQuaternionFromUpForward, GetVector2Slerp, GetVector3Slerp, QuaternionEulerAngleOrders, } from "../../../flowGraphMath.js";
9
11
  import { RegisterClass } from "../../../../Misc/typeStore.js";
10
12
  const AxisCacheName = "cachedOperationAxis";
11
13
  const AngleCacheName = "cachedOperationAngle";
@@ -33,30 +35,62 @@ export class FlowGraphLengthBlock extends FlowGraphUnaryOperationBlock {
33
35
  /**
34
36
  * Vector normalize block.
35
37
  */
36
- export class FlowGraphNormalizeBlock extends FlowGraphUnaryOperationBlock {
38
+ export class FlowGraphNormalizeBlock extends FlowGraphCachedOperationBlock {
37
39
  constructor(config) {
38
- super(RichTypeAny, RichTypeAny, (a) => this._polymorphicNormalize(a), "FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */, config);
40
+ super(RichTypeAny, config);
41
+ this.a = this.registerDataInput("a", RichTypeAny);
42
+ }
43
+ _doOperation(context) {
44
+ return this._polymorphicNormalize(this.a.getValue(context));
45
+ }
46
+ /**
47
+ * A vector that cannot be normalized reports a vector of the same type with every component set
48
+ * to zero, so the output stays type-consistent with the input instead of being left undefined.
49
+ * @param context the graph context
50
+ * @returns a zero vector matching the input's type
51
+ */
52
+ _getInvalidOutputValue(context) {
53
+ const a = this.a.getValue(context);
54
+ switch (_GetClassNameOf(a)) {
55
+ case "Vector2" /* FlowGraphTypes.Vector2 */:
56
+ return new Vector2(0, 0);
57
+ case "Vector4" /* FlowGraphTypes.Vector4 */:
58
+ return new Vector4(0, 0, 0, 0);
59
+ case "Quaternion" /* FlowGraphTypes.Quaternion */:
60
+ return new Quaternion(0, 0, 0, 0);
61
+ default:
62
+ return new Vector3(0, 0, 0);
63
+ }
39
64
  }
40
65
  _polymorphicNormalize(a) {
41
66
  const aClassName = _GetClassNameOf(a);
42
- let normalized;
43
67
  switch (aClassName) {
44
68
  case "Vector2" /* FlowGraphTypes.Vector2 */:
45
69
  case "Vector3" /* FlowGraphTypes.Vector3 */:
46
70
  case "Vector4" /* FlowGraphTypes.Vector4 */:
47
- case "Quaternion" /* FlowGraphTypes.Quaternion */:
48
- normalized = a.normalizeToNew();
49
- if (this.config?.nanOnZeroLength) {
50
- const length = a.length();
51
- if (length === 0) {
52
- normalized.setAll(NaN);
71
+ case "Quaternion" /* FlowGraphTypes.Quaternion */: {
72
+ // Normalization is only valid when the length is a positive finite number. For zero, NaN, or
73
+ // +Infinity length the operation is invalid: returning undefined makes the cached base report
74
+ // isValid = false and deliver a zero vector of the same type on `value`.
75
+ const length = a.length();
76
+ if (length === 0 || !Number.isFinite(length)) {
77
+ if (this.config?.nanOnZeroLength) {
78
+ // Legacy behavior preserved for consumers that opt into NaN output.
79
+ const nanVector = a.normalizeToNew();
80
+ nanVector.setAll(NaN);
81
+ return nanVector;
53
82
  }
83
+ return undefined;
54
84
  }
55
- return normalized;
85
+ return a.normalizeToNew();
86
+ }
56
87
  default:
57
88
  throw new Error(`Cannot normalize value ${a}`);
58
89
  }
59
90
  }
91
+ getClassName() {
92
+ return "FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */;
93
+ }
60
94
  }
61
95
  /**
62
96
  * Dot product block.
@@ -112,8 +146,11 @@ function TransformVector(a, b) {
112
146
  return b.transformVector(a);
113
147
  case "Vector4" /* FlowGraphTypes.Vector4 */:
114
148
  a = a;
115
- // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4
116
- 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]);
149
+ // transform the vector 4 with the matrix here. Vector4.TransformCoordinates transforms a 3D coordinate, not Vector4.
150
+ // Babylon's Matrix stores its elements column-major (m[0..3] is the first column), and the incoming
151
+ // float4x4 values are column-major as well, so M * a reads down the columns: value[i] = sum_j M[i][j] * a[j]
152
+ // with M[i][j] = m[j * 4 + i].
153
+ return new Vector4(a.x * b.m[0] + a.y * b.m[4] + a.z * b.m[8] + a.w * b.m[12], a.x * b.m[1] + a.y * b.m[5] + a.z * b.m[9] + a.w * b.m[13], a.x * b.m[2] + a.y * b.m[6] + a.z * b.m[10] + a.w * b.m[14], a.x * b.m[3] + a.y * b.m[7] + a.z * b.m[11] + a.w * b.m[15]);
117
154
  default:
118
155
  throw new Error(`Cannot transform value ${a}`);
119
156
  }
@@ -212,6 +249,50 @@ export class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOpera
212
249
  super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), "FlowGraphQuaternionFromDirectionsBlock" /* FlowGraphBlockNames.QuaternionFromDirections */, config);
213
250
  }
214
251
  }
252
+ /**
253
+ * Get a rotation quaternion from the specified up and forward directions.
254
+ */
255
+ export class FlowGraphQuaternionFromUpForwardBlock extends FlowGraphBinaryOperationBlock {
256
+ constructor(config) {
257
+ super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (up, forward) => GetQuaternionFromUpForward(up, forward), "FlowGraphQuaternionFromUpForwardBlock" /* FlowGraphBlockNames.QuaternionFromUpForward */, config);
258
+ }
259
+ }
260
+ /**
261
+ * Spherical linear interpolation between two vectors.
262
+ * Supports float2 and float3 vectors; the interpolation coefficient is a number.
263
+ */
264
+ export class FlowGraphVectorSlerpBlock extends FlowGraphTernaryOperationBlock {
265
+ constructor(config) {
266
+ super(RichTypeAny, RichTypeAny, RichTypeNumber, RichTypeAny, (a, b, c) => this._polymorphicSlerp(a, b, c), "FlowGraphVectorSlerpBlock" /* FlowGraphBlockNames.VectorSlerp */, config);
267
+ }
268
+ _polymorphicSlerp(a, b, c) {
269
+ const className = _GetClassNameOf(a);
270
+ switch (className) {
271
+ case "Vector2" /* FlowGraphTypes.Vector2 */:
272
+ return GetVector2Slerp(a, b, c);
273
+ case "Vector3" /* FlowGraphTypes.Vector3 */:
274
+ return GetVector3Slerp(a, b, c);
275
+ default:
276
+ throw new Error(`Cannot slerp value ${a}`);
277
+ }
278
+ }
279
+ }
280
+ /**
281
+ * Creates a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in a
282
+ * configurable order.
283
+ *
284
+ * Inputs `a`, `b`, `c` are the rotations (in radians) around the X, Y and Z axes respectively.
285
+ * The `order` configuration selects the intrinsic rotation order; NaN and infinite inputs
286
+ * propagate into the resulting quaternion components.
287
+ */
288
+ export class FlowGraphQuaternionFromAnglesBlock extends FlowGraphTernaryOperationBlock {
289
+ constructor(config) {
290
+ super(RichTypeNumber, RichTypeNumber, RichTypeNumber, RichTypeQuaternion, (a, b, c) => GetQuaternionFromEulerAngles(this._order, a, b, c), "FlowGraphQuaternionFromAnglesBlock" /* FlowGraphBlockNames.QuaternionFromAngles */, config);
291
+ const order = config?.order;
292
+ // A missing, non-string or unrecognized order falls back to the default `yxz`.
293
+ this._order = typeof order === "string" && QuaternionEulerAngleOrders.indexOf(order) !== -1 ? order : "yxz";
294
+ }
295
+ }
215
296
  let _Registered = false;
216
297
  /**
217
298
  * Register side effects for flowGraphVectorMathBlocks.
@@ -234,5 +315,9 @@ export function RegisterFlowGraphVectorMathBlocks() {
234
315
  RegisterClass("FlowGraphAngleBetweenBlock" /* FlowGraphBlockNames.AngleBetween */, FlowGraphAngleBetweenBlock);
235
316
  RegisterClass("FlowGraphQuaternionFromAxisAngleBlock" /* FlowGraphBlockNames.QuaternionFromAxisAngle */, FlowGraphQuaternionFromAxisAngleBlock);
236
317
  RegisterClass("FlowGraphAxisAngleFromQuaternionBlock" /* FlowGraphBlockNames.AxisAngleFromQuaternion */, FlowGraphAxisAngleFromQuaternionBlock);
318
+ RegisterClass("FlowGraphQuaternionFromDirectionsBlock" /* FlowGraphBlockNames.QuaternionFromDirections */, FlowGraphQuaternionFromDirectionsBlock);
319
+ RegisterClass("FlowGraphQuaternionFromUpForwardBlock" /* FlowGraphBlockNames.QuaternionFromUpForward */, FlowGraphQuaternionFromUpForwardBlock);
320
+ RegisterClass("FlowGraphQuaternionFromAnglesBlock" /* FlowGraphBlockNames.QuaternionFromAngles */, FlowGraphQuaternionFromAnglesBlock);
321
+ RegisterClass("FlowGraphVectorSlerpBlock" /* FlowGraphBlockNames.VectorSlerp */, FlowGraphVectorSlerpBlock);
237
322
  }
238
323
  //# sourceMappingURL=flowGraphVectorMathBlocks.pure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphVectorMathBlocks.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,cAAc,EAAqC,MAAM,+BAA+B,CAAC;AAClG,OAAO,EACH,eAAe,EAEf,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAA6B,MAAM,6BAA6B,CAAC;AAEtG,OAAO,EAA8C,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAInG,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;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,4CAA4B;YAC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,CAAC,CAAC,EAAE,CAAC,CAAC,+FAAgD,MAAM,CAAC,CAAC;IACnK,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,iCAAiC;IAC7C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,0DAA6B,oBAAoB,CAAC,CAAC;IAChE,aAAa,gEAAgC,uBAAuB,CAAC,CAAC;IACtE,aAAa,oDAA0B,iBAAiB,CAAC,CAAC;IAC1D,aAAa,wDAA4B,mBAAmB,CAAC,CAAC;IAC9D,aAAa,8DAA+B,sBAAsB,CAAC,CAAC;IACpE,aAAa,8DAA+B,sBAAsB,CAAC,CAAC;IACpE,aAAa,4EAAsC,uBAAuB,CAAC,CAAC;IAC5E,aAAa,sFAA2C,kCAAkC,CAAC,CAAC;IAC5F,aAAa,gEAAgC,uBAAuB,CAAC,CAAC;IACtE,aAAa,sEAAmC,0BAA0B,CAAC,CAAC;IAC5E,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;IAClG,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;AACtG,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport {\n RichTypeVector3,\n FlowGraphTypes,\n RichTypeNumber,\n RichTypeAny,\n RichTypeVector2,\n RichTypeMatrix,\n getRichTypeByFlowGraphType,\n RichTypeQuaternion,\n RichTypeBoolean,\n} from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { Quaternion, Vector3, Vector4, type Matrix, type Vector2 } from \"core/Maths/math.vector.pure\";\nimport { type FlowGraphMatrix2D, type FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport { type FlowGraphMatrix, type FlowGraphVector, _GetClassNameOf } from \"core/FlowGraph/utils\";\nimport { type FlowGraphDataConnection } from \"../../../flowGraphDataConnection.pure\";\nimport { type FlowGraphContext } from \"../../../flowGraphContext\";\nimport { type Nullable } from \"../../../../types\";\nimport { GetAngleBetweenQuaternions, GetQuaternionFromDirections } from \"core/FlowGraph/flowGraphMath\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\nconst AxisCacheName = \"cachedOperationAxis\";\nconst AngleCacheName = \"cachedOperationAngle\";\nconst CacheExecIdName = \"cachedExecutionId\";\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 case FlowGraphTypes.Quaternion:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\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 case FlowGraphTypes.Quaternion:\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}\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 case FlowGraphTypes.Quaternion:\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}\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}\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) => a.rotate(b), FlowGraphBlockNames.Rotate2D, config);\n }\n}\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphBinaryOperationBlock<Vector3, Quaternion, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeQuaternion, RichTypeVector3, (a, b) => a.applyRotationQuaternion(b), FlowGraphBlockNames.Rotate3D, config);\n }\n}\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\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\n/**\n * Conjugate the quaternion.\n */\nexport class FlowGraphConjugateBlock extends FlowGraphUnaryOperationBlock<Quaternion, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, (a) => a.conjugate(), FlowGraphBlockNames.Conjugate, config);\n }\n}\n\n/**\n * Get the angle between two quaternions.\n */\nexport class FlowGraphAngleBetweenBlock extends FlowGraphBinaryOperationBlock<Quaternion, Quaternion, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, RichTypeNumber, (a, b) => GetAngleBetweenQuaternions(a, b), FlowGraphBlockNames.AngleBetween, config);\n }\n}\n\n/**\n * Get the quaternion from an axis and an angle.\n */\nexport class FlowGraphQuaternionFromAxisAngleBlock extends FlowGraphBinaryOperationBlock<Vector3, number, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeNumber, RichTypeQuaternion, (a, b) => Quaternion.RotationAxis(a, b), FlowGraphBlockNames.QuaternionFromAxisAngle, config);\n }\n}\n\n/**\n * Get the axis and angle from a quaternion.\n */\nexport class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBlock {\n /**\n * The input of this block.\n */\n public readonly a: FlowGraphDataConnection<Quaternion>;\n\n /**\n * The output axis of rotation.\n */\n public readonly axis: FlowGraphDataConnection<Vector3>;\n\n /**\n * The output angle of rotation.\n */\n public readonly angle: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.a = this.registerDataInput(\"a\", RichTypeQuaternion);\n\n this.axis = this.registerDataOutput(\"axis\", RichTypeVector3);\n this.angle = this.registerDataOutput(\"angle\", RichTypeNumber);\n\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\n }\n\n /** @override */\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\n const cachedAxis = context._getExecutionVariable<Nullable<Vector3>>(this, AxisCacheName, null);\n const cachedAngle = context._getExecutionVariable<Nullable<number>>(this, AngleCacheName, null);\n if (cachedAxis !== undefined && cachedAxis !== null && cachedAngle !== undefined && cachedAngle !== null && cachedExecutionId === context.executionId) {\n this.axis.setValue(cachedAxis, context);\n this.angle.setValue(cachedAngle, context);\n } else {\n try {\n const { axis, angle } = this.a.getValue(context).toAxisAngle();\n context._setExecutionVariable(this, AxisCacheName, axis);\n context._setExecutionVariable(this, AngleCacheName, angle);\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\n this.axis.setValue(axis, context);\n this.angle.setValue(angle, context);\n this.isValid.setValue(true, context);\n } catch (e) {\n this.isValid.setValue(false, context);\n }\n }\n }\n\n /**\n * Gets the class name\n * @override\n * @returns the class name\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.AxisAngleFromQuaternion;\n }\n}\n\n/**\n * Get the quaternion from two direction vectors.\n */\nexport class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), FlowGraphBlockNames.QuaternionFromDirections, config);\n }\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphVectorMathBlocks.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphVectorMathBlocks(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n RegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n RegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n RegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n RegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n RegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n RegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n RegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n RegisterClass(FlowGraphBlockNames.Conjugate, FlowGraphConjugateBlock);\n RegisterClass(FlowGraphBlockNames.AngleBetween, FlowGraphAngleBetweenBlock);\n RegisterClass(FlowGraphBlockNames.QuaternionFromAxisAngle, FlowGraphQuaternionFromAxisAngleBlock);\n RegisterClass(FlowGraphBlockNames.AxisAngleFromQuaternion, FlowGraphAxisAngleFromQuaternionBlock);\n}\n"]}
1
+ {"version":3,"file":"flowGraphVectorMathBlocks.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,cAAc,EAAqC,MAAM,+BAA+B,CAAC;AAClG,OAAO,EACH,eAAe,EAEf,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,eAAe,GAClB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,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C,CAAC;IACpE,aAAa,8DAA+B,sBAAsB,CAAC,CAAC;IACpE,aAAa,4EAAsC,uBAAuB,CAAC,CAAC;IAC5E,aAAa,sFAA2C,kCAAkC,CAAC,CAAC;IAC5F,aAAa,gEAAgC,uBAAuB,CAAC,CAAC;IACtE,aAAa,sEAAmC,0BAA0B,CAAC,CAAC;IAC5E,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;IAClG,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;IAClG,aAAa,8FAA+C,sCAAsC,CAAC,CAAC;IACpG,aAAa,4FAA8C,qCAAqC,CAAC,CAAC;IAClG,aAAa,sFAA2C,kCAAkC,CAAC,CAAC;IAC5F,aAAa,oEAAkC,yBAAyB,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport {\n RichTypeVector3,\n FlowGraphTypes,\n RichTypeNumber,\n RichTypeAny,\n RichTypeVector2,\n RichTypeMatrix,\n getRichTypeByFlowGraphType,\n RichTypeQuaternion,\n RichTypeBoolean,\n} from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphBinaryOperationBlock } from \"../flowGraphBinaryOperationBlock\";\nimport { FlowGraphUnaryOperationBlock } from \"../flowGraphUnaryOperationBlock\";\nimport { FlowGraphTernaryOperationBlock } from \"../flowGraphTernaryOperationBlock\";\nimport { FlowGraphCachedOperationBlock } from \"../flowGraphCachedOperationBlock\";\nimport { Quaternion, Vector2, Vector3, Vector4, type Matrix } from \"core/Maths/math.vector.pure\";\nimport { type FlowGraphMatrix2D, type FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes\";\nimport { type FlowGraphMatrix, type FlowGraphVector, _GetClassNameOf } from \"core/FlowGraph/utils\";\nimport { type FlowGraphDataConnection } from \"../../../flowGraphDataConnection.pure\";\nimport { type FlowGraphContext } from \"../../../flowGraphContext\";\nimport { type Nullable } from \"../../../../types\";\nimport {\n GetAngleBetweenQuaternions,\n GetQuaternionFromDirections,\n GetQuaternionFromEulerAngles,\n GetQuaternionFromUpForward,\n GetVector2Slerp,\n GetVector3Slerp,\n QuaternionEulerAngleOrders,\n} from \"core/FlowGraph/flowGraphMath\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\nconst AxisCacheName = \"cachedOperationAxis\";\nconst AngleCacheName = \"cachedOperationAngle\";\nconst CacheExecIdName = \"cachedExecutionId\";\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 case FlowGraphTypes.Quaternion:\n return (a as Vector3).length();\n default:\n throw new Error(`Cannot compute length of value ${a}`);\n }\n }\n}\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 FlowGraphCachedOperationBlock<FlowGraphVector> {\n /**\n * The vector to normalize.\n */\n public readonly a: FlowGraphDataConnection<FlowGraphVector>;\n\n constructor(config?: IFlowGraphNormalizeBlockConfiguration) {\n super(RichTypeAny, config);\n this.a = this.registerDataInput(\"a\", RichTypeAny);\n }\n\n public override _doOperation(context: FlowGraphContext): FlowGraphVector | undefined {\n return this._polymorphicNormalize(this.a.getValue(context));\n }\n\n /**\n * A vector that cannot be normalized reports a vector of the same type with every component set\n * to zero, so the output stays type-consistent with the input instead of being left undefined.\n * @param context the graph context\n * @returns a zero vector matching the input's type\n */\n protected override _getInvalidOutputValue(context: FlowGraphContext): FlowGraphVector {\n const a = this.a.getValue(context);\n switch (_GetClassNameOf(a)) {\n case FlowGraphTypes.Vector2:\n return new Vector2(0, 0);\n case FlowGraphTypes.Vector4:\n return new Vector4(0, 0, 0, 0);\n case FlowGraphTypes.Quaternion:\n return new Quaternion(0, 0, 0, 0);\n default:\n return new Vector3(0, 0, 0);\n }\n }\n\n private _polymorphicNormalize(a: FlowGraphVector): FlowGraphVector | undefined {\n const aClassName = _GetClassNameOf(a);\n switch (aClassName) {\n case FlowGraphTypes.Vector2:\n case FlowGraphTypes.Vector3:\n case FlowGraphTypes.Vector4:\n case FlowGraphTypes.Quaternion: {\n // Normalization is only valid when the length is a positive finite number. For zero, NaN, or\n // +Infinity length the operation is invalid: returning undefined makes the cached base report\n // isValid = false and deliver a zero vector of the same type on `value`.\n const length = (a as Vector3).length();\n if (length === 0 || !Number.isFinite(length)) {\n if (this.config?.nanOnZeroLength) {\n // Legacy behavior preserved for consumers that opt into NaN output.\n const nanVector = a.normalizeToNew();\n nanVector.setAll(NaN);\n return nanVector;\n }\n return undefined;\n }\n return a.normalizeToNew();\n }\n default:\n throw new Error(`Cannot normalize value ${a}`);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.Normalize;\n }\n}\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 case FlowGraphTypes.Quaternion:\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}\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}\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) => a.rotate(b), FlowGraphBlockNames.Rotate2D, config);\n }\n}\n\n/**\n * 3D rotation block.\n */\nexport class FlowGraphRotate3DBlock extends FlowGraphBinaryOperationBlock<Vector3, Quaternion, Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeQuaternion, RichTypeVector3, (a, b) => a.applyRotationQuaternion(b), FlowGraphBlockNames.Rotate3D, config);\n }\n}\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 // Babylon's Matrix stores its elements column-major (m[0..3] is the first column), and the incoming\n // float4x4 values are column-major as well, so M * a reads down the columns: value[i] = sum_j M[i][j] * a[j]\n // with M[i][j] = m[j * 4 + i].\n return new Vector4(\n a.x * b.m[0] + a.y * b.m[4] + a.z * b.m[8] + a.w * b.m[12],\n a.x * b.m[1] + a.y * b.m[5] + a.z * b.m[9] + a.w * b.m[13],\n a.x * b.m[2] + a.y * b.m[6] + a.z * b.m[10] + a.w * b.m[14],\n a.x * b.m[3] + a.y * b.m[7] + a.z * b.m[11] + 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\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\n/**\n * Conjugate the quaternion.\n */\nexport class FlowGraphConjugateBlock extends FlowGraphUnaryOperationBlock<Quaternion, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, (a) => a.conjugate(), FlowGraphBlockNames.Conjugate, config);\n }\n}\n\n/**\n * Get the angle between two quaternions.\n */\nexport class FlowGraphAngleBetweenBlock extends FlowGraphBinaryOperationBlock<Quaternion, Quaternion, number> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeQuaternion, RichTypeQuaternion, RichTypeNumber, (a, b) => GetAngleBetweenQuaternions(a, b), FlowGraphBlockNames.AngleBetween, config);\n }\n}\n\n/**\n * Get the quaternion from an axis and an angle.\n */\nexport class FlowGraphQuaternionFromAxisAngleBlock extends FlowGraphBinaryOperationBlock<Vector3, number, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeNumber, RichTypeQuaternion, (a, b) => Quaternion.RotationAxis(a, b), FlowGraphBlockNames.QuaternionFromAxisAngle, config);\n }\n}\n\n/**\n * Get the axis and angle from a quaternion.\n */\nexport class FlowGraphAxisAngleFromQuaternionBlock extends FlowGraphBlock {\n /**\n * The input of this block.\n */\n public readonly a: FlowGraphDataConnection<Quaternion>;\n\n /**\n * The output axis of rotation.\n */\n public readonly axis: FlowGraphDataConnection<Vector3>;\n\n /**\n * The output angle of rotation.\n */\n public readonly angle: FlowGraphDataConnection<number>;\n\n /**\n * Output connection: Whether the value is valid.\n */\n public readonly isValid: FlowGraphDataConnection<boolean>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n\n this.a = this.registerDataInput(\"a\", RichTypeQuaternion);\n\n this.axis = this.registerDataOutput(\"axis\", RichTypeVector3);\n this.angle = this.registerDataOutput(\"angle\", RichTypeNumber);\n\n this.isValid = this.registerDataOutput(\"isValid\", RichTypeBoolean);\n }\n\n /** @override */\n public override _updateOutputs(context: FlowGraphContext) {\n const cachedExecutionId = context._getExecutionVariable(this, CacheExecIdName, -1);\n const cachedAxis = context._getExecutionVariable<Nullable<Vector3>>(this, AxisCacheName, null);\n const cachedAngle = context._getExecutionVariable<Nullable<number>>(this, AngleCacheName, null);\n if (cachedAxis !== undefined && cachedAxis !== null && cachedAngle !== undefined && cachedAngle !== null && cachedExecutionId === context.executionId) {\n this.axis.setValue(cachedAxis, context);\n this.angle.setValue(cachedAngle, context);\n } else {\n try {\n const { axis, angle } = this.a.getValue(context).toAxisAngle();\n context._setExecutionVariable(this, AxisCacheName, axis);\n context._setExecutionVariable(this, AngleCacheName, angle);\n context._setExecutionVariable(this, CacheExecIdName, context.executionId);\n this.axis.setValue(axis, context);\n this.angle.setValue(angle, context);\n this.isValid.setValue(true, context);\n } catch (e) {\n this.isValid.setValue(false, context);\n }\n }\n }\n\n /**\n * Gets the class name\n * @override\n * @returns the class name\n */\n public override getClassName(): string {\n return FlowGraphBlockNames.AxisAngleFromQuaternion;\n }\n}\n\n/**\n * Get the quaternion from two direction vectors.\n */\nexport class FlowGraphQuaternionFromDirectionsBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (a, b) => GetQuaternionFromDirections(a, b), FlowGraphBlockNames.QuaternionFromDirections, config);\n }\n}\n\n/**\n * Get a rotation quaternion from the specified up and forward directions.\n */\nexport class FlowGraphQuaternionFromUpForwardBlock extends FlowGraphBinaryOperationBlock<Vector3, Vector3, Quaternion> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeVector3, RichTypeVector3, RichTypeQuaternion, (up, forward) => GetQuaternionFromUpForward(up, forward), FlowGraphBlockNames.QuaternionFromUpForward, config);\n }\n}\n\n/**\n * Spherical linear interpolation between two vectors.\n * Supports float2 and float3 vectors; the interpolation coefficient is a number.\n */\nexport class FlowGraphVectorSlerpBlock extends FlowGraphTernaryOperationBlock<FlowGraphVector, FlowGraphVector, number, FlowGraphVector> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(RichTypeAny, RichTypeAny, RichTypeNumber, RichTypeAny, (a, b, c) => this._polymorphicSlerp(a, b, c), FlowGraphBlockNames.VectorSlerp, config);\n }\n\n private _polymorphicSlerp(a: FlowGraphVector, b: FlowGraphVector, c: number): FlowGraphVector {\n const className = _GetClassNameOf(a);\n switch (className) {\n case FlowGraphTypes.Vector2:\n return GetVector2Slerp(a as Vector2, b as Vector2, c);\n case FlowGraphTypes.Vector3:\n return GetVector3Slerp(a as Vector3, b as Vector3, c);\n default:\n throw new Error(`Cannot slerp value ${a}`);\n }\n }\n}\n\n/**\n * The configuration of the FlowGraphQuaternionFromAnglesBlock.\n */\nexport interface IFlowGraphQuaternionFromAnglesBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * The intrinsic Tait–Bryan rotation order, one of `xyz`, `xzy`, `yxz`, `yzx`, `zxy`, `zyx`.\n * Any other (or missing) value falls back to the spec default `yxz`.\n */\n order?: string;\n}\n\n/**\n * Creates a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in a\n * configurable order.\n *\n * Inputs `a`, `b`, `c` are the rotations (in radians) around the X, Y and Z axes respectively.\n * The `order` configuration selects the intrinsic rotation order; NaN and infinite inputs\n * propagate into the resulting quaternion components.\n */\nexport class FlowGraphQuaternionFromAnglesBlock extends FlowGraphTernaryOperationBlock<number, number, number, Quaternion> {\n /**\n * The validated intrinsic rotation order used to compose the quaternion.\n */\n private readonly _order: string;\n\n constructor(config?: IFlowGraphQuaternionFromAnglesBlockConfiguration) {\n super(\n RichTypeNumber,\n RichTypeNumber,\n RichTypeNumber,\n RichTypeQuaternion,\n (a, b, c) => GetQuaternionFromEulerAngles(this._order, a, b, c),\n FlowGraphBlockNames.QuaternionFromAngles,\n config\n );\n const order = config?.order;\n // A missing, non-string or unrecognized order falls back to the default `yxz`.\n this._order = typeof order === \"string\" && (QuaternionEulerAngleOrders as readonly string[]).indexOf(order) !== -1 ? order : \"yxz\";\n }\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphVectorMathBlocks.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphVectorMathBlocks(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.Length, FlowGraphLengthBlock);\n RegisterClass(FlowGraphBlockNames.Normalize, FlowGraphNormalizeBlock);\n RegisterClass(FlowGraphBlockNames.Dot, FlowGraphDotBlock);\n RegisterClass(FlowGraphBlockNames.Cross, FlowGraphCrossBlock);\n RegisterClass(FlowGraphBlockNames.Rotate2D, FlowGraphRotate2DBlock);\n RegisterClass(FlowGraphBlockNames.Rotate3D, FlowGraphRotate3DBlock);\n RegisterClass(FlowGraphBlockNames.TransformVector, FlowGraphTransformBlock);\n RegisterClass(FlowGraphBlockNames.TransformCoordinates, FlowGraphTransformCoordinatesBlock);\n RegisterClass(FlowGraphBlockNames.Conjugate, FlowGraphConjugateBlock);\n RegisterClass(FlowGraphBlockNames.AngleBetween, FlowGraphAngleBetweenBlock);\n RegisterClass(FlowGraphBlockNames.QuaternionFromAxisAngle, FlowGraphQuaternionFromAxisAngleBlock);\n RegisterClass(FlowGraphBlockNames.AxisAngleFromQuaternion, FlowGraphAxisAngleFromQuaternionBlock);\n RegisterClass(FlowGraphBlockNames.QuaternionFromDirections, FlowGraphQuaternionFromDirectionsBlock);\n RegisterClass(FlowGraphBlockNames.QuaternionFromUpForward, FlowGraphQuaternionFromUpForwardBlock);\n RegisterClass(FlowGraphBlockNames.QuaternionFromAngles, FlowGraphQuaternionFromAnglesBlock);\n RegisterClass(FlowGraphBlockNames.VectorSlerp, FlowGraphVectorSlerpBlock);\n}\n"]}
@@ -27,7 +27,9 @@ export class FlowGraphJsonPointerParserBlock extends FlowGraphCachedOperationBlo
27
27
  }
28
28
  _doOperation(context) {
29
29
  const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
30
- const value = accessorContainer.info.get(accessorContainer.object);
30
+ // Pass the context as the accessor payload so context-aware object-model accessors, such as
31
+ // one validating a delay handle against the runtime active-delay set, can resolve.
32
+ const value = accessorContainer.info.get(accessorContainer.object, undefined, context);
31
33
  const object = accessorContainer.info.getTarget?.(accessorContainer.object);
32
34
  const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);
33
35
  if (!object) {
@@ -47,12 +49,18 @@ export class FlowGraphJsonPointerParserBlock extends FlowGraphCachedOperationBlo
47
49
  if (type.startsWith("Color")) {
48
50
  value = ToColor(value, type);
49
51
  }
52
+ // Unwrap FlowGraphInteger to plain number for numeric setters
53
+ if (typeof value?.value === "number" && value?.getClassName?.() === "FlowGraphInteger") {
54
+ value = value.value;
55
+ }
50
56
  accessorContainer.info.set?.(value, accessorContainer.object);
51
57
  }
52
58
  _getPropertyValue(_target, _propertyName, context) {
53
59
  const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);
54
60
  const type = accessorContainer.info.type;
55
- const value = accessorContainer.info.get(accessorContainer.object);
61
+ // Pass the context as the accessor payload (see _doOperation) so context-aware accessors
62
+ // can resolve.
63
+ const value = accessorContainer.info.get(accessorContainer.object, undefined, context);
56
64
  if (type.startsWith("Color")) {
57
65
  return FromColor(value);
58
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphJsonPointerParserBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAM7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAMrE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAqBpD;;;;GAIG;AACH,MAAM,OAAO,+BAA6E,SAAQ,6BAAgC;IA+B9H;IACI;;OAEG;IACa,MAAqD;QAErE,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAFX,WAAM,GAAN,M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ACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,SAAS,CAAC,KAAsB;IACrC,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;QAC1B,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;SAAM,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;QACjC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,uCAAuC;IACnD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,gFAAwC,+BAA+B,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type FlowGraphAssetType } from \"core/FlowGraph/flowGraphAssetsContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport { FlowGraphPathConverterComponent } from \"core/FlowGraph/flowGraphPathConverterComponent\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { type IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\nimport { type IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { type Animation } from \"core/Animations/animation.pure\";\nimport { type EasingFunction } from \"core/Animations/easing\";\nimport { Vector3, Vector4 } from \"core/Maths/math.vector.pure\";\nimport { Color3, Color4 } from \"core/Maths/math.color.pure\";\nimport { FlowGraphCachedOperationBlock } from \"../flowGraphCachedOperationBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\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 FlowGraphCachedOperationBlock<P> {\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: 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 * 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(RichTypeAny, config);\n this.object = this.registerDataOutput(\"object\", RichTypeAny);\n this.propertyName = this.registerDataOutput(\"propertyName\", RichTypeAny);\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 _doOperation(context: FlowGraphContext): P {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n const value = accessorContainer.info.get(accessorContainer.object) as P;\n const object = accessorContainer.info.getTarget?.(accessorContainer.object);\n const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);\n if (!object) {\n throw new Error(\"Object is undefined\");\n } else {\n this.object.setValue(object, context);\n if (propertyName) {\n this.propertyName.setValue(propertyName, context);\n }\n }\n return value;\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 const type = accessorContainer.info.type;\n const value = accessorContainer.info.get(accessorContainer.object);\n if (type.startsWith(\"Color\")) {\n return FromColor(value as Color3 | Color4) as unknown as P;\n }\n return value as P | undefined;\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 for (const animation of animationData) {\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\nfunction FromColor(value: Color3 | Color4): Vector3 | Vector4 {\n if (value instanceof Color3) {\n return new Vector3(value.r, value.g, value.b);\n } else if (value instanceof Color4) {\n return new Vector4(value.r, value.g, value.b, value.a);\n }\n throw new Error(\"Invalid color type\");\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphJsonPointerParserBlock.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphJsonPointerParserBlock(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.JsonPointerParser, FlowGraphJsonPointerParserBlock);\n}\n"]}
1
+ {"version":3,"file":"flowGraphJsonPointerParserBlock.pure.js","sourceRoot":"","s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KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,uCAAuC;IACnD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,gFAAwC,+BAA+B,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type FlowGraphAssetType } from \"core/FlowGraph/flowGraphAssetsContext\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport { FlowGraphPathConverterComponent } from \"core/FlowGraph/flowGraphPathConverterComponent\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { type IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\nimport { type IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { type Animation } from \"core/Animations/animation.pure\";\nimport { type EasingFunction } from \"core/Animations/easing\";\nimport { Vector3, Vector4 } from \"core/Maths/math.vector.pure\";\nimport { Color3, Color4 } from \"core/Maths/math.color.pure\";\nimport { FlowGraphCachedOperationBlock } from \"../flowGraphCachedOperationBlock\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\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 FlowGraphCachedOperationBlock<P> {\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: 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 * 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(RichTypeAny, config);\n this.object = this.registerDataOutput(\"object\", RichTypeAny);\n this.propertyName = this.registerDataOutput(\"propertyName\", RichTypeAny);\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 _doOperation(context: FlowGraphContext): P {\n const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n // Pass the context as the accessor payload so context-aware object-model accessors, such as\n // one validating a delay handle against the runtime active-delay set, can resolve.\n const value = accessorContainer.info.get(accessorContainer.object, undefined, context) as P;\n const object = accessorContainer.info.getTarget?.(accessorContainer.object);\n const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);\n if (!object) {\n throw new Error(\"Object is undefined\");\n } else {\n this.object.setValue(object, context);\n if (propertyName) {\n this.propertyName.setValue(propertyName, context);\n }\n }\n return value;\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 // Unwrap FlowGraphInteger to plain number for numeric setters\n if (typeof (value as any)?.value === \"number\" && (value as any)?.getClassName?.() === \"FlowGraphInteger\") {\n value = (value as any).value 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 const type = accessorContainer.info.type;\n // Pass the context as the accessor payload (see _doOperation) so context-aware accessors\n // can resolve.\n const value = accessorContainer.info.get(accessorContainer.object, undefined, context);\n if (type.startsWith(\"Color\")) {\n return FromColor(value as Color3 | Color4) as unknown as P;\n }\n return value as P | undefined;\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 for (const animation of animationData) {\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\nfunction FromColor(value: Color3 | Color4): Vector3 | Vector4 {\n if (value instanceof Color3) {\n return new Vector3(value.r, value.g, value.b);\n } else if (value instanceof Color4) {\n return new Vector4(value.r, value.g, value.b, value.a);\n }\n throw new Error(\"Invalid color type\");\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphJsonPointerParserBlock.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphJsonPointerParserBlock(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.JsonPointerParser, FlowGraphJsonPointerParserBlock);\n}\n"]}
@@ -24,7 +24,27 @@ export class FlowGraphArrayIndexBlock extends FlowGraphBlock {
24
24
  */
25
25
  _updateOutputs(context) {
26
26
  const array = this.array.getValue(context);
27
- const index = getNumericValue(this.index.getValue(context));
27
+ const rawIndex = this.index.getValue(context);
28
+ // An undefined or unconnected input short-circuits to a null output rather than crashing
29
+ // `getNumericValue` on a missing `.value` property.
30
+ if (rawIndex === undefined || rawIndex === null) {
31
+ this.value.setValue(null, context);
32
+ return;
33
+ }
34
+ // A string index is an opaque reference whose format the host environment owns, so ask it
35
+ // which element the reference denotes.
36
+ let index;
37
+ if (typeof rawIndex === "string") {
38
+ const decoded = context.decodeIndexReference(rawIndex);
39
+ if (decoded === undefined) {
40
+ this.value.setValue(null, context);
41
+ return;
42
+ }
43
+ index = decoded;
44
+ }
45
+ else {
46
+ index = getNumericValue(rawIndex);
47
+ }
28
48
  if (array && index >= 0 && index < array.length) {
29
49
  this.value.setValue(array[index], context);
30
50
  }