@onerjs/core 8.54.4 → 8.54.6

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 (234) hide show
  1. package/Engines/Native/nativeHelpers.js +5 -0
  2. package/Engines/Native/nativeHelpers.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/engineCapabilities.d.ts +5 -0
  24. package/Engines/engineCapabilities.js.map +1 -1
  25. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  26. package/Engines/thinNativeEngine.pure.js +52 -10
  27. package/Engines/thinNativeEngine.pure.js.map +1 -1
  28. package/Engines/webgpuEngine.pure.d.ts +1 -0
  29. package/Engines/webgpuEngine.pure.js +22 -8
  30. package/Engines/webgpuEngine.pure.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  36. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  38. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  39. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  42. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  44. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  48. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  49. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  51. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  53. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  54. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  55. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  56. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  57. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  58. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  61. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  63. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  64. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  65. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  66. package/FlowGraph/Blocks/Event/index.js +1 -0
  67. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  68. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  69. package/FlowGraph/Blocks/Event/pure.js +1 -0
  70. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  75. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  76. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  78. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  86. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  87. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  89. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  90. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  91. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  92. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  93. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  94. package/FlowGraph/flowGraphContext.d.ts +23 -0
  95. package/FlowGraph/flowGraphContext.js +29 -0
  96. package/FlowGraph/flowGraphContext.js.map +1 -1
  97. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  98. package/FlowGraph/flowGraphCoordinator.js +72 -0
  99. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  100. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  101. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  102. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  103. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  104. package/FlowGraph/flowGraphHostResolver.js +25 -0
  105. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  106. package/FlowGraph/flowGraphMath.d.ts +48 -1
  107. package/FlowGraph/flowGraphMath.js +169 -4
  108. package/FlowGraph/flowGraphMath.js.map +1 -1
  109. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  110. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  111. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  112. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  113. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  114. package/FlowGraph/index.d.ts +2 -0
  115. package/FlowGraph/index.js +2 -0
  116. package/FlowGraph/index.js.map +1 -1
  117. package/FlowGraph/pure.d.ts +2 -0
  118. package/FlowGraph/pure.js +2 -0
  119. package/FlowGraph/pure.js.map +1 -1
  120. package/Materials/Node/nodeMaterial.pure.d.ts +3 -1
  121. package/Materials/Node/nodeMaterial.pure.js +18 -1
  122. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  123. package/Materials/Textures/envCubeTexture.pure.js +7 -2
  124. package/Materials/Textures/envCubeTexture.pure.js.map +1 -1
  125. package/Materials/materialHelper.functions.d.ts +14 -0
  126. package/Materials/materialHelper.functions.js +67 -0
  127. package/Materials/materialHelper.functions.js.map +1 -1
  128. package/Maths/math.vector.pure.d.ts +11 -1
  129. package/Maths/math.vector.pure.js +13 -0
  130. package/Maths/math.vector.pure.js.map +1 -1
  131. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  133. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  134. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  135. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
  136. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  137. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  138. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  139. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  140. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
  141. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  142. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  143. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  144. package/Meshes/abstractMesh.pure.js +1 -0
  145. package/Meshes/abstractMesh.pure.js.map +1 -1
  146. package/Meshes/mesh.pure.js +5 -0
  147. package/Meshes/mesh.pure.js.map +1 -1
  148. package/Meshes/transformNode.pure.js +1 -0
  149. package/Meshes/transformNode.pure.js.map +1 -1
  150. package/Misc/areaLightsTextureTools.js +1 -1
  151. package/Misc/areaLightsTextureTools.js.map +1 -1
  152. package/Misc/greasedLineTools.js +1 -1
  153. package/Misc/greasedLineTools.js.map +1 -1
  154. package/Misc/tools.pure.js +14 -2
  155. package/Misc/tools.pure.js.map +1 -1
  156. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  157. package/Particles/gpuParticleSystem.pure.js +189 -49
  158. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  159. package/Physics/v2/characterController.js +69 -17
  160. package/Physics/v2/characterController.js.map +1 -1
  161. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.d.ts +79 -0
  162. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js +171 -0
  163. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js.map +1 -0
  164. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +5 -0
  165. package/PostProcesses/RenderPipeline/Pipelines/index.js +6 -0
  166. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  167. package/PostProcesses/RenderPipeline/Pipelines/pure.d.ts +1 -0
  168. package/PostProcesses/RenderPipeline/Pipelines/pure.js +1 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/pure.js.map +1 -1
  170. package/PostProcesses/thinFSR1SharpenPostProcess.d.ts +32 -0
  171. package/PostProcesses/thinFSR1SharpenPostProcess.js +58 -0
  172. package/PostProcesses/thinFSR1SharpenPostProcess.js.map +1 -0
  173. package/PostProcesses/thinFSR1UpscalePostProcess.d.ts +37 -0
  174. package/PostProcesses/thinFSR1UpscalePostProcess.js +68 -0
  175. package/PostProcesses/thinFSR1UpscalePostProcess.js.map +1 -0
  176. package/Shaders/ShadersInclude/ffxFunctions.d.ts +5 -0
  177. package/Shaders/ShadersInclude/ffxFunctions.js +18 -0
  178. package/Shaders/ShadersInclude/ffxFunctions.js.map +1 -0
  179. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -2
  180. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  181. package/Shaders/ShadersInclude/openpbrIblFunctions.js +1 -6
  182. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  183. package/Shaders/fsr1Sharpen.fragment.d.ts +5 -0
  184. package/Shaders/fsr1Sharpen.fragment.js +26 -0
  185. package/Shaders/fsr1Sharpen.fragment.js.map +1 -0
  186. package/Shaders/fsr1Upscale.fragment.d.ts +5 -0
  187. package/Shaders/fsr1Upscale.fragment.js +77 -0
  188. package/Shaders/fsr1Upscale.fragment.js.map +1 -0
  189. package/ShadersWGSL/ShadersInclude/ffxFunctions.d.ts +5 -0
  190. package/ShadersWGSL/ShadersInclude/ffxFunctions.js +18 -0
  191. package/ShadersWGSL/ShadersInclude/ffxFunctions.js.map +1 -0
  192. package/ShadersWGSL/fsr1Sharpen.fragment.d.ts +5 -0
  193. package/ShadersWGSL/fsr1Sharpen.fragment.js +34 -0
  194. package/ShadersWGSL/fsr1Sharpen.fragment.js.map +1 -0
  195. package/ShadersWGSL/fsr1Upscale.fragment.d.ts +5 -0
  196. package/ShadersWGSL/fsr1Upscale.fragment.js +68 -0
  197. package/ShadersWGSL/fsr1Upscale.fragment.js.map +1 -0
  198. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  199. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  200. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  201. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  202. package/XR/features/WebXRAbstractFeature.js +16 -0
  203. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  204. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  205. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  206. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  207. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  208. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  209. package/XR/features/WebXRLayers.pure.js +65 -8
  210. package/XR/features/WebXRLayers.pure.js.map +1 -1
  211. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  212. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  213. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  214. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  215. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  216. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  217. package/XR/webXRCamera.js +27 -0
  218. package/XR/webXRCamera.js.map +1 -1
  219. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  220. package/XR/webXRFeatureWarningRegistry.js +19 -0
  221. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  222. package/XR/webXRFeaturesManager.d.ts +5 -0
  223. package/XR/webXRFeaturesManager.js +23 -4
  224. package/XR/webXRFeaturesManager.js.map +1 -1
  225. package/XR/webXRGraphicsBinding.d.ts +17 -10
  226. package/XR/webXRGraphicsBinding.js +8 -5
  227. package/XR/webXRGraphicsBinding.js.map +1 -1
  228. package/XR/webXRSessionManager.d.ts +3 -5
  229. package/XR/webXRSessionManager.js +1 -3
  230. package/XR/webXRSessionManager.js.map +1 -1
  231. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  232. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  233. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  234. package/package.json +1 -1
@@ -101,9 +101,11 @@ export class FlowGraphCombineVector4Block extends FlowGraphMathCombineBlock {
101
101
  }
102
102
  }
103
103
  /**
104
- * Combines 16 floats into a new Matrix
104
+ * Combines 16 floats into a new Matrix.
105
105
  *
106
- * Note that glTF interactivity's combine4x4 uses column-major order, while Babylon.js uses row-major order.
106
+ * The inputs are in column-major order, matching Babylon's {@link Matrix} storage and the order used
107
+ * by `Matrix.FromArray`, `Matrix.FromValues` and {@link FlowGraphExtractMatrixBlock}, so combining
108
+ * and extracting round-trip.
107
109
  */
108
110
  export class FlowGraphCombineMatrixBlock extends FlowGraphMathCombineBlock {
109
111
  constructor(config) {
@@ -114,12 +116,12 @@ export class FlowGraphCombineMatrixBlock extends FlowGraphMathCombineBlock {
114
116
  context._setExecutionVariable(this, "cachedMatrix", new Matrix());
115
117
  }
116
118
  const matrix = context._getExecutionVariable(this, "cachedMatrix", null);
117
- if (this.config?.inputIsColumnMajor) {
119
+ if (this.config?.inputIsColumnMajor === false) {
120
+ // Legacy row-major input: transpose into the matrix's column-major storage.
118
121
  matrix.set(this.getDataInput("input_0").getValue(context), this.getDataInput("input_4").getValue(context), this.getDataInput("input_8").getValue(context), this.getDataInput("input_12").getValue(context), this.getDataInput("input_1").getValue(context), this.getDataInput("input_5").getValue(context), this.getDataInput("input_9").getValue(context), this.getDataInput("input_13").getValue(context), this.getDataInput("input_2").getValue(context), this.getDataInput("input_6").getValue(context), this.getDataInput("input_10").getValue(context), this.getDataInput("input_14").getValue(context), this.getDataInput("input_3").getValue(context), this.getDataInput("input_7").getValue(context), this.getDataInput("input_11").getValue(context), this.getDataInput("input_15").getValue(context));
122
+ return matrix;
119
123
  }
120
- else {
121
- matrix.set(this.getDataInput("input_0").getValue(context), this.getDataInput("input_1").getValue(context), this.getDataInput("input_2").getValue(context), this.getDataInput("input_3").getValue(context), this.getDataInput("input_4").getValue(context), this.getDataInput("input_5").getValue(context), this.getDataInput("input_6").getValue(context), this.getDataInput("input_7").getValue(context), this.getDataInput("input_8").getValue(context), this.getDataInput("input_9").getValue(context), this.getDataInput("input_10").getValue(context), this.getDataInput("input_11").getValue(context), this.getDataInput("input_12").getValue(context), this.getDataInput("input_13").getValue(context), this.getDataInput("input_14").getValue(context), this.getDataInput("input_15").getValue(context));
122
- }
124
+ matrix.set(this.getDataInput("input_0").getValue(context), this.getDataInput("input_1").getValue(context), this.getDataInput("input_2").getValue(context), this.getDataInput("input_3").getValue(context), this.getDataInput("input_4").getValue(context), this.getDataInput("input_5").getValue(context), this.getDataInput("input_6").getValue(context), this.getDataInput("input_7").getValue(context), this.getDataInput("input_8").getValue(context), this.getDataInput("input_9").getValue(context), this.getDataInput("input_10").getValue(context), this.getDataInput("input_11").getValue(context), this.getDataInput("input_12").getValue(context), this.getDataInput("input_13").getValue(context), this.getDataInput("input_14").getValue(context), this.getDataInput("input_15").getValue(context));
123
125
  return matrix;
124
126
  }
125
127
  getClassName() {
@@ -127,7 +129,7 @@ export class FlowGraphCombineMatrixBlock extends FlowGraphMathCombineBlock {
127
129
  }
128
130
  }
129
131
  /**
130
- * Combines 4 floats into a new Matrix
132
+ * Combines 4 floats into a new Matrix2D, in column-major order.
131
133
  */
132
134
  export class FlowGraphCombineMatrix2DBlock extends FlowGraphMathCombineBlock {
133
135
  constructor(config) {
@@ -138,21 +140,21 @@ export class FlowGraphCombineMatrix2DBlock extends FlowGraphMathCombineBlock {
138
140
  context._setExecutionVariable(this, "cachedMatrix", new FlowGraphMatrix2D());
139
141
  }
140
142
  const matrix = context._getExecutionVariable(this, "cachedMatrix", null);
141
- const array = this.config?.inputIsColumnMajor
143
+ const columnMajor = this.config?.inputIsColumnMajor !== false;
144
+ matrix.fromArray(columnMajor
142
145
  ? [
143
- // column to row-major
144
146
  this.getDataInput("input_0").getValue(context),
145
- this.getDataInput("input_2").getValue(context),
146
147
  this.getDataInput("input_1").getValue(context),
148
+ this.getDataInput("input_2").getValue(context),
147
149
  this.getDataInput("input_3").getValue(context),
148
150
  ]
149
151
  : [
152
+ // Legacy row-major input, transposed into column-major storage.
150
153
  this.getDataInput("input_0").getValue(context),
151
- this.getDataInput("input_1").getValue(context),
152
154
  this.getDataInput("input_2").getValue(context),
155
+ this.getDataInput("input_1").getValue(context),
153
156
  this.getDataInput("input_3").getValue(context),
154
- ];
155
- matrix.fromArray(array);
157
+ ]);
156
158
  return matrix;
157
159
  }
158
160
  getClassName() {
@@ -160,7 +162,7 @@ export class FlowGraphCombineMatrix2DBlock extends FlowGraphMathCombineBlock {
160
162
  }
161
163
  }
162
164
  /**
163
- * Combines 9 floats into a new Matrix3D
165
+ * Combines 9 floats into a new Matrix3D, in column-major order.
164
166
  */
165
167
  export class FlowGraphCombineMatrix3DBlock extends FlowGraphMathCombineBlock {
166
168
  constructor(config) {
@@ -171,31 +173,31 @@ export class FlowGraphCombineMatrix3DBlock extends FlowGraphMathCombineBlock {
171
173
  context._setExecutionVariable(this, "cachedMatrix", new FlowGraphMatrix3D());
172
174
  }
173
175
  const matrix = context._getExecutionVariable(this, "cachedMatrix", null);
174
- const array = this.config?.inputIsColumnMajor
176
+ const columnMajor = this.config?.inputIsColumnMajor !== false;
177
+ matrix.fromArray(columnMajor
175
178
  ? [
176
- // column to row major
177
179
  this.getDataInput("input_0").getValue(context),
178
- this.getDataInput("input_3").getValue(context),
179
- this.getDataInput("input_6").getValue(context),
180
180
  this.getDataInput("input_1").getValue(context),
181
- this.getDataInput("input_4").getValue(context),
182
- this.getDataInput("input_7").getValue(context),
183
181
  this.getDataInput("input_2").getValue(context),
182
+ this.getDataInput("input_3").getValue(context),
183
+ this.getDataInput("input_4").getValue(context),
184
184
  this.getDataInput("input_5").getValue(context),
185
+ this.getDataInput("input_6").getValue(context),
186
+ this.getDataInput("input_7").getValue(context),
185
187
  this.getDataInput("input_8").getValue(context),
186
188
  ]
187
189
  : [
190
+ // Legacy row-major input, transposed into column-major storage.
188
191
  this.getDataInput("input_0").getValue(context),
189
- this.getDataInput("input_1").getValue(context),
190
- this.getDataInput("input_2").getValue(context),
191
192
  this.getDataInput("input_3").getValue(context),
192
- this.getDataInput("input_4").getValue(context),
193
- this.getDataInput("input_5").getValue(context),
194
193
  this.getDataInput("input_6").getValue(context),
194
+ this.getDataInput("input_1").getValue(context),
195
+ this.getDataInput("input_4").getValue(context),
195
196
  this.getDataInput("input_7").getValue(context),
197
+ this.getDataInput("input_2").getValue(context),
198
+ this.getDataInput("input_5").getValue(context),
196
199
  this.getDataInput("input_8").getValue(context),
197
- ];
198
- matrix.fromArray(array);
200
+ ]);
199
201
  return matrix;
200
202
  }
201
203
  getClassName() {
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphMathCombineExtractBlocks.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAA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AC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,wEAAoC,2BAA2B,CAAC,CAAC;IAC9E,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,wEAAoC,2BAA2B,CAAC,CAAC;IAC9E,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { FlowGraphCachedOperationBlock } from \"../flowGraphCachedOperationBlock\";\nimport {\n RichTypeMatrix,\n RichTypeMatrix2D,\n RichTypeMatrix3D,\n RichTypeNumber,\n RichTypeVector2,\n RichTypeVector3,\n RichTypeVector4,\n type RichType,\n} from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { Matrix, Vector2, Vector3, Vector4 } from \"core/Maths/math.vector.pure\";\nimport { type Nullable } from \"core/types\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\nabstract class FlowGraphMathCombineBlock<ResultT> extends FlowGraphCachedOperationBlock<ResultT> {\n /**\n * Base class for blocks that combine multiple numeric inputs into a single result.\n * Handles registering data inputs and managing cached outputs.\n * @param numberOfInputs The number of input values to combine.\n * @param type The type of the result.\n * @param config The block configuration.\n */\n constructor(numberOfInputs: number, type: RichType<ResultT>, config?: IFlowGraphBlockConfiguration) {\n super(type, config);\n for (let i = 0; i < numberOfInputs; i++) {\n this.registerDataInput(`input_${i}`, RichTypeNumber, 0);\n }\n }\n}\n\n/**\n * Abstract class representing a flow graph block that extracts multiple outputs from a single input.\n */\nabstract class FlowGraphMathExtractBlock<InputT> extends FlowGraphBlock {\n /**\n * Creates an instance of FlowGraphMathExtractBlock.\n *\n * @param numberOfOutputs - The number of outputs to be extracted from the input.\n * @param type - The type of the input data.\n * @param config - Optional configuration for the flow graph block.\n */\n constructor(numberOfOutputs: number, type: RichType<InputT>, config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.registerDataInput(\"input\", type);\n for (let i = 0; i < numberOfOutputs; i++) {\n this.registerDataOutput(`output_${i}`, RichTypeNumber, 0);\n }\n }\n}\n/**\n * Combines two floats into a new Vector2\n */\nexport class FlowGraphCombineVector2Block extends FlowGraphMathCombineBlock<Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(2, RichTypeVector2, config);\n }\n\n /**\n * @internal\n * Combines two floats into a new Vector2\n */\n public override _doOperation(context: FlowGraphContext): Vector2 {\n if (!context._hasExecutionVariable(this, \"cachedVector\")) {\n context._setExecutionVariable(this, \"cachedVector\", new Vector2());\n }\n const vector = context._getExecutionVariable<Nullable<Vector2>>(this, \"cachedVector\", null) as Vector2;\n vector.set(this.getDataInput(\"input_0\")!.getValue(context), this.getDataInput(\"input_1\")!.getValue(context));\n return vector;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineVector2;\n }\n}\n\n/**\n * Combines three floats into a new Vector3\n */\nexport class FlowGraphCombineVector3Block extends FlowGraphMathCombineBlock<Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(3, RichTypeVector3, config);\n }\n\n public override _doOperation(context: FlowGraphContext): Vector3 {\n if (!context._hasExecutionVariable(this, \"cachedVector\")) {\n context._setExecutionVariable(this, \"cachedVector\", new Vector3());\n }\n const vector = context._getExecutionVariable<Nullable<Vector3>>(this, \"cachedVector\", null) as Vector3;\n vector.set(this.getDataInput(\"input_0\")!.getValue(context), this.getDataInput(\"input_1\")!.getValue(context), this.getDataInput(\"input_2\")!.getValue(context));\n return vector;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineVector3;\n }\n}\n\n/**\n * Combines four floats into a new Vector4\n */\nexport class FlowGraphCombineVector4Block extends FlowGraphMathCombineBlock<Vector4> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(4, RichTypeVector4, config);\n }\n\n public override _doOperation(context: FlowGraphContext): Vector4 {\n if (!context._hasExecutionVariable(this, \"cachedVector\")) {\n context._setExecutionVariable(this, \"cachedVector\", new Vector4());\n }\n const vector = context._getExecutionVariable<Nullable<Vector4>>(this, \"cachedVector\", null) as Vector4;\n vector.set(\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context)\n );\n return vector;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineVector4;\n }\n}\n\n/**\n * Configuration for the matrix combine blocks.\n */\nexport interface IFlowGraphCombineMatrixBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Whether the input is in column-major order. Default is false.\n * Note - Babylon's matrix is the same as WebGL's. So unless your matrix requires transformation, you should leave this as false.\n */\n inputIsColumnMajor?: boolean;\n}\n\n/**\n * Combines 16 floats into a new Matrix\n *\n * Note that glTF interactivity's combine4x4 uses column-major order, while Babylon.js uses row-major order.\n */\nexport class FlowGraphCombineMatrixBlock extends FlowGraphMathCombineBlock<Matrix> {\n constructor(config?: IFlowGraphCombineMatrixBlockConfiguration) {\n super(16, RichTypeMatrix, config);\n }\n\n public override _doOperation(context: FlowGraphContext): Matrix {\n if (!context._hasExecutionVariable(this, \"cachedMatrix\")) {\n context._setExecutionVariable(this, \"cachedMatrix\", new Matrix());\n }\n const matrix = context._getExecutionVariable<Nullable<Matrix>>(this, \"cachedMatrix\", null) as Matrix;\n if (this.config?.inputIsColumnMajor) {\n matrix.set(\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n this.getDataInput(\"input_12\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_9\")!.getValue(context),\n this.getDataInput(\"input_13\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_10\")!.getValue(context),\n this.getDataInput(\"input_14\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_11\")!.getValue(context),\n this.getDataInput(\"input_15\")!.getValue(context)\n );\n } else {\n matrix.set(\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n this.getDataInput(\"input_9\")!.getValue(context),\n this.getDataInput(\"input_10\")!.getValue(context),\n this.getDataInput(\"input_11\")!.getValue(context),\n this.getDataInput(\"input_12\")!.getValue(context),\n this.getDataInput(\"input_13\")!.getValue(context),\n this.getDataInput(\"input_14\")!.getValue(context),\n this.getDataInput(\"input_15\")!.getValue(context)\n );\n }\n return matrix;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineMatrix;\n }\n}\n\n/**\n * Combines 4 floats into a new Matrix\n */\nexport class FlowGraphCombineMatrix2DBlock extends FlowGraphMathCombineBlock<FlowGraphMatrix2D> {\n constructor(config?: IFlowGraphCombineMatrixBlockConfiguration) {\n super(4, RichTypeMatrix2D, config);\n }\n\n public override _doOperation(context: FlowGraphContext): FlowGraphMatrix2D {\n if (!context._hasExecutionVariable(this, \"cachedMatrix\")) {\n context._setExecutionVariable(this, \"cachedMatrix\", new FlowGraphMatrix2D());\n }\n const matrix = context._getExecutionVariable<Nullable<FlowGraphMatrix2D>>(this, \"cachedMatrix\", null) as FlowGraphMatrix2D;\n const array = this.config?.inputIsColumnMajor\n ? [\n // column to row-major\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n ]\n : [\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n ];\n matrix.fromArray(array);\n return matrix;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineMatrix2D;\n }\n}\n\n/**\n * Combines 9 floats into a new Matrix3D\n */\nexport class FlowGraphCombineMatrix3DBlock extends FlowGraphMathCombineBlock<FlowGraphMatrix3D> {\n constructor(config?: IFlowGraphCombineMatrixBlockConfiguration) {\n super(9, RichTypeMatrix3D, config);\n }\n\n public override _doOperation(context: FlowGraphContext): FlowGraphMatrix3D {\n if (!context._hasExecutionVariable(this, \"cachedMatrix\")) {\n context._setExecutionVariable(this, \"cachedMatrix\", new FlowGraphMatrix3D());\n }\n const matrix = context._getExecutionVariable<Nullable<FlowGraphMatrix3D>>(this, \"cachedMatrix\", null) as FlowGraphMatrix3D;\n const array = this.config?.inputIsColumnMajor\n ? [\n // column to row major\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n ]\n : [\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n ];\n matrix.fromArray(array);\n return matrix;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineMatrix3D;\n }\n}\n\n/**\n * Extracts two floats from a Vector2\n */\nexport class FlowGraphExtractVector2Block extends FlowGraphMathExtractBlock<Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(2, RichTypeVector2, config);\n }\n\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Vector2;\n if (!input) {\n input = Vector2.Zero();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n this.getDataOutput(\"output_0\")!.setValue(input.x, context);\n this.getDataOutput(\"output_1\")!.setValue(input.y, context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractVector2;\n }\n}\n\n/**\n * Extracts three floats from a Vector3\n */\nexport class FlowGraphExtractVector3Block extends FlowGraphMathExtractBlock<Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(3, RichTypeVector3, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Vector3;\n if (!input) {\n input = Vector3.Zero();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n this.getDataOutput(\"output_0\")!.setValue(input.x, context);\n this.getDataOutput(\"output_1\")!.setValue(input.y, context);\n this.getDataOutput(\"output_2\")!.setValue(input.z, context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractVector3;\n }\n}\n\n/**\n * Extracts four floats from a Vector4\n */\nexport class FlowGraphExtractVector4Block extends FlowGraphMathExtractBlock<Vector4> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(4, RichTypeVector4, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Vector4;\n if (!input) {\n input = Vector4.Zero();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n this.getDataOutput(\"output_0\")!.setValue(input.x, context);\n this.getDataOutput(\"output_1\")!.setValue(input.y, context);\n this.getDataOutput(\"output_2\")!.setValue(input.z, context);\n this.getDataOutput(\"output_3\")!.setValue(input.w, context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractVector4;\n }\n}\n\n/**\n * Extracts 16 floats from a Matrix\n */\nexport class FlowGraphExtractMatrixBlock extends FlowGraphMathExtractBlock<Matrix> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(16, RichTypeMatrix, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Matrix;\n if (!input) {\n input = Matrix.Identity();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n for (let i = 0; i < 16; i++) {\n this.getDataOutput(`output_${i}`)!.setValue(input.m[i], context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractMatrix;\n }\n}\n\n/**\n * Extracts 4 floats from a Matrix2D\n */\nexport class FlowGraphExtractMatrix2DBlock extends FlowGraphMathExtractBlock<FlowGraphMatrix2D> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(4, RichTypeMatrix2D, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as FlowGraphMatrix2D;\n if (!input) {\n input = new FlowGraphMatrix2D();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n for (let i = 0; i < 4; i++) {\n this.getDataOutput(`output_${i}`)!.setValue(input.m[i], context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractMatrix2D;\n }\n}\n\n/**\n * Extracts 4 floats from a Matrix2D\n */\nexport class FlowGraphExtractMatrix3DBlock extends FlowGraphMathExtractBlock<FlowGraphMatrix3D> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(9, RichTypeMatrix3D, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as FlowGraphMatrix3D;\n if (!input) {\n input = new FlowGraphMatrix3D();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n for (let i = 0; i < 9; i++) {\n this.getDataOutput(`output_${i}`)!.setValue(input.m[i], context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractMatrix3D;\n }\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphMathCombineExtractBlocks.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphMathCombineExtractBlocks(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.CombineVector2, FlowGraphCombineVector2Block);\n RegisterClass(FlowGraphBlockNames.CombineVector3, FlowGraphCombineVector3Block);\n RegisterClass(FlowGraphBlockNames.CombineVector4, FlowGraphCombineVector4Block);\n RegisterClass(FlowGraphBlockNames.CombineMatrix, FlowGraphCombineMatrixBlock);\n RegisterClass(FlowGraphBlockNames.CombineMatrix2D, FlowGraphCombineMatrix2DBlock);\n RegisterClass(FlowGraphBlockNames.CombineMatrix3D, FlowGraphCombineMatrix3DBlock);\n RegisterClass(FlowGraphBlockNames.ExtractVector2, FlowGraphExtractVector2Block);\n RegisterClass(FlowGraphBlockNames.ExtractVector3, FlowGraphExtractVector3Block);\n RegisterClass(FlowGraphBlockNames.ExtractVector4, FlowGraphExtractVector4Block);\n RegisterClass(FlowGraphBlockNames.ExtractMatrix, FlowGraphExtractMatrixBlock);\n RegisterClass(FlowGraphBlockNames.ExtractMatrix2D, FlowGraphExtractMatrix2DBlock);\n RegisterClass(FlowGraphBlockNames.ExtractMatrix3D, FlowGraphExtractMatrix3DBlock);\n}\n"]}
1
+ {"version":3,"file":"flowGraphMathCombineExtractBlocks.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,GAElB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,cAAc,EAAqC,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAe,yBAAmC,SAAQ,6BAAsC;IAC5F;;;;;;OAMG;IACH,YAAY,cAAsB,EAAE,IAAuB,EAAE,MAAqC;QAC9F,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;CACJ;AAED;;GAEG;AACH,MAAe,yBAAkC,SAAQ,cAAc;IACnE;;;;;;OAMG;IACH,YAAY,eAAuB,EAAE,IAAsB,EAAE,MAAqC;QAC9F,KAAK,CAAC,MAAM,CAAC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AAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;IACL,CAAC;IAEe,YAAY;QACxB,iFAA2C;IAC/C,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,yCAAyC;IACrD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,wEAAoC,2BAA2B,CAAC,CAAC;IAC9E,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,0EAAqC,4BAA4B,CAAC,CAAC;IAChF,aAAa,wEAAoC,2BAA2B,CAAC,CAAC;IAC9E,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;IAClF,aAAa,4EAAsC,6BAA6B,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { FlowGraphCachedOperationBlock } from \"../flowGraphCachedOperationBlock\";\nimport {\n RichTypeMatrix,\n RichTypeMatrix2D,\n RichTypeMatrix3D,\n RichTypeNumber,\n RichTypeVector2,\n RichTypeVector3,\n RichTypeVector4,\n type RichType,\n} from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { Matrix, Vector2, Vector3, Vector4 } from \"core/Maths/math.vector.pure\";\nimport { type Nullable } from \"core/types\";\nimport { FlowGraphBlockNames } from \"../../flowGraphBlockNames\";\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\n\nabstract class FlowGraphMathCombineBlock<ResultT> extends FlowGraphCachedOperationBlock<ResultT> {\n /**\n * Base class for blocks that combine multiple numeric inputs into a single result.\n * Handles registering data inputs and managing cached outputs.\n * @param numberOfInputs The number of input values to combine.\n * @param type The type of the result.\n * @param config The block configuration.\n */\n constructor(numberOfInputs: number, type: RichType<ResultT>, config?: IFlowGraphBlockConfiguration) {\n super(type, config);\n for (let i = 0; i < numberOfInputs; i++) {\n this.registerDataInput(`input_${i}`, RichTypeNumber, 0);\n }\n }\n}\n\n/**\n * Abstract class representing a flow graph block that extracts multiple outputs from a single input.\n */\nabstract class FlowGraphMathExtractBlock<InputT> extends FlowGraphBlock {\n /**\n * Creates an instance of FlowGraphMathExtractBlock.\n *\n * @param numberOfOutputs - The number of outputs to be extracted from the input.\n * @param type - The type of the input data.\n * @param config - Optional configuration for the flow graph block.\n */\n constructor(numberOfOutputs: number, type: RichType<InputT>, config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.registerDataInput(\"input\", type);\n for (let i = 0; i < numberOfOutputs; i++) {\n this.registerDataOutput(`output_${i}`, RichTypeNumber, 0);\n }\n }\n}\n/**\n * Combines two floats into a new Vector2\n */\nexport class FlowGraphCombineVector2Block extends FlowGraphMathCombineBlock<Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(2, RichTypeVector2, config);\n }\n\n /**\n * @internal\n * Combines two floats into a new Vector2\n */\n public override _doOperation(context: FlowGraphContext): Vector2 {\n if (!context._hasExecutionVariable(this, \"cachedVector\")) {\n context._setExecutionVariable(this, \"cachedVector\", new Vector2());\n }\n const vector = context._getExecutionVariable<Nullable<Vector2>>(this, \"cachedVector\", null) as Vector2;\n vector.set(this.getDataInput(\"input_0\")!.getValue(context), this.getDataInput(\"input_1\")!.getValue(context));\n return vector;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineVector2;\n }\n}\n\n/**\n * Combines three floats into a new Vector3\n */\nexport class FlowGraphCombineVector3Block extends FlowGraphMathCombineBlock<Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(3, RichTypeVector3, config);\n }\n\n public override _doOperation(context: FlowGraphContext): Vector3 {\n if (!context._hasExecutionVariable(this, \"cachedVector\")) {\n context._setExecutionVariable(this, \"cachedVector\", new Vector3());\n }\n const vector = context._getExecutionVariable<Nullable<Vector3>>(this, \"cachedVector\", null) as Vector3;\n vector.set(this.getDataInput(\"input_0\")!.getValue(context), this.getDataInput(\"input_1\")!.getValue(context), this.getDataInput(\"input_2\")!.getValue(context));\n return vector;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineVector3;\n }\n}\n\n/**\n * Combines four floats into a new Vector4\n */\nexport class FlowGraphCombineVector4Block extends FlowGraphMathCombineBlock<Vector4> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(4, RichTypeVector4, config);\n }\n\n public override _doOperation(context: FlowGraphContext): Vector4 {\n if (!context._hasExecutionVariable(this, \"cachedVector\")) {\n context._setExecutionVariable(this, \"cachedVector\", new Vector4());\n }\n const vector = context._getExecutionVariable<Nullable<Vector4>>(this, \"cachedVector\", null) as Vector4;\n vector.set(\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context)\n );\n return vector;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineVector4;\n }\n}\n\n/**\n * Configuration for the matrix combine blocks.\n * @deprecated The matrix combine blocks now default to column-major input, matching Babylon's\n * {@link Matrix} storage and the glTF/KHR_interactivity convention. This interface is retained so the\n * `inputIsColumnMajor` option keeps being honoured; set it to `false` to feed row-major input.\n *\n * BREAKING: the meaning of `inputIsColumnMajor` is inverted from previous releases, not just its\n * default. Previously `inputIsColumnMajor: true` took the transposing path and the default (unset)\n * treated input as row-major. Now the default (unset) is column-major, `inputIsColumnMajor: false`\n * takes the transposing path, and `inputIsColumnMajor: true` is the straight (non-transposing) path.\n * The unset behaviour is unchanged for graphs that never set the flag, but anyone who explicitly set\n * `true` or `false` before now gets the opposite transform and should drop the flag (or flip it).\n */\nexport interface IFlowGraphCombineMatrixBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * Whether the input is already in column-major order. Defaults to `true`.\n * @deprecated Provide column-major input (the default) and omit this flag. Set to `false` only to\n * keep feeding legacy row-major input, which is transposed into the matrix's column-major storage.\n * Note the inverted meaning versus previous releases (see the interface deprecation note): a former\n * `inputIsColumnMajor: true` no longer transposes, and a former `false` now does.\n */\n inputIsColumnMajor?: boolean;\n}\n\n/**\n * Combines 16 floats into a new Matrix.\n *\n * The inputs are in column-major order, matching Babylon's {@link Matrix} storage and the order used\n * by `Matrix.FromArray`, `Matrix.FromValues` and {@link FlowGraphExtractMatrixBlock}, so combining\n * and extracting round-trip.\n */\nexport class FlowGraphCombineMatrixBlock extends FlowGraphMathCombineBlock<Matrix> {\n constructor(config?: IFlowGraphCombineMatrixBlockConfiguration) {\n super(16, RichTypeMatrix, config);\n }\n\n public override _doOperation(context: FlowGraphContext): Matrix {\n if (!context._hasExecutionVariable(this, \"cachedMatrix\")) {\n context._setExecutionVariable(this, \"cachedMatrix\", new Matrix());\n }\n const matrix = context._getExecutionVariable<Nullable<Matrix>>(this, \"cachedMatrix\", null) as Matrix;\n if ((this.config as IFlowGraphCombineMatrixBlockConfiguration | undefined)?.inputIsColumnMajor === false) {\n // Legacy row-major input: transpose into the matrix's column-major storage.\n matrix.set(\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n this.getDataInput(\"input_12\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_9\")!.getValue(context),\n this.getDataInput(\"input_13\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_10\")!.getValue(context),\n this.getDataInput(\"input_14\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_11\")!.getValue(context),\n this.getDataInput(\"input_15\")!.getValue(context)\n );\n return matrix;\n }\n matrix.set(\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n this.getDataInput(\"input_9\")!.getValue(context),\n this.getDataInput(\"input_10\")!.getValue(context),\n this.getDataInput(\"input_11\")!.getValue(context),\n this.getDataInput(\"input_12\")!.getValue(context),\n this.getDataInput(\"input_13\")!.getValue(context),\n this.getDataInput(\"input_14\")!.getValue(context),\n this.getDataInput(\"input_15\")!.getValue(context)\n );\n return matrix;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineMatrix;\n }\n}\n\n/**\n * Combines 4 floats into a new Matrix2D, in column-major order.\n */\nexport class FlowGraphCombineMatrix2DBlock extends FlowGraphMathCombineBlock<FlowGraphMatrix2D> {\n constructor(config?: IFlowGraphCombineMatrixBlockConfiguration) {\n super(4, RichTypeMatrix2D, config);\n }\n\n public override _doOperation(context: FlowGraphContext): FlowGraphMatrix2D {\n if (!context._hasExecutionVariable(this, \"cachedMatrix\")) {\n context._setExecutionVariable(this, \"cachedMatrix\", new FlowGraphMatrix2D());\n }\n const matrix = context._getExecutionVariable<Nullable<FlowGraphMatrix2D>>(this, \"cachedMatrix\", null) as FlowGraphMatrix2D;\n const columnMajor = (this.config as IFlowGraphCombineMatrixBlockConfiguration | undefined)?.inputIsColumnMajor !== false;\n matrix.fromArray(\n columnMajor\n ? [\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n ]\n : [\n // Legacy row-major input, transposed into column-major storage.\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n ]\n );\n return matrix;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineMatrix2D;\n }\n}\n\n/**\n * Combines 9 floats into a new Matrix3D, in column-major order.\n */\nexport class FlowGraphCombineMatrix3DBlock extends FlowGraphMathCombineBlock<FlowGraphMatrix3D> {\n constructor(config?: IFlowGraphCombineMatrixBlockConfiguration) {\n super(9, RichTypeMatrix3D, config);\n }\n\n public override _doOperation(context: FlowGraphContext): FlowGraphMatrix3D {\n if (!context._hasExecutionVariable(this, \"cachedMatrix\")) {\n context._setExecutionVariable(this, \"cachedMatrix\", new FlowGraphMatrix3D());\n }\n const matrix = context._getExecutionVariable<Nullable<FlowGraphMatrix3D>>(this, \"cachedMatrix\", null) as FlowGraphMatrix3D;\n const columnMajor = (this.config as IFlowGraphCombineMatrixBlockConfiguration | undefined)?.inputIsColumnMajor !== false;\n matrix.fromArray(\n columnMajor\n ? [\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n ]\n : [\n // Legacy row-major input, transposed into column-major storage.\n this.getDataInput(\"input_0\")!.getValue(context),\n this.getDataInput(\"input_3\")!.getValue(context),\n this.getDataInput(\"input_6\")!.getValue(context),\n this.getDataInput(\"input_1\")!.getValue(context),\n this.getDataInput(\"input_4\")!.getValue(context),\n this.getDataInput(\"input_7\")!.getValue(context),\n this.getDataInput(\"input_2\")!.getValue(context),\n this.getDataInput(\"input_5\")!.getValue(context),\n this.getDataInput(\"input_8\")!.getValue(context),\n ]\n );\n return matrix;\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.CombineMatrix3D;\n }\n}\n\n/**\n * Extracts two floats from a Vector2\n */\nexport class FlowGraphExtractVector2Block extends FlowGraphMathExtractBlock<Vector2> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(2, RichTypeVector2, config);\n }\n\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Vector2;\n if (!input) {\n input = Vector2.Zero();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n this.getDataOutput(\"output_0\")!.setValue(input.x, context);\n this.getDataOutput(\"output_1\")!.setValue(input.y, context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractVector2;\n }\n}\n\n/**\n * Extracts three floats from a Vector3\n */\nexport class FlowGraphExtractVector3Block extends FlowGraphMathExtractBlock<Vector3> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(3, RichTypeVector3, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Vector3;\n if (!input) {\n input = Vector3.Zero();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n this.getDataOutput(\"output_0\")!.setValue(input.x, context);\n this.getDataOutput(\"output_1\")!.setValue(input.y, context);\n this.getDataOutput(\"output_2\")!.setValue(input.z, context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractVector3;\n }\n}\n\n/**\n * Extracts four floats from a Vector4\n */\nexport class FlowGraphExtractVector4Block extends FlowGraphMathExtractBlock<Vector4> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(4, RichTypeVector4, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Vector4;\n if (!input) {\n input = Vector4.Zero();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n this.getDataOutput(\"output_0\")!.setValue(input.x, context);\n this.getDataOutput(\"output_1\")!.setValue(input.y, context);\n this.getDataOutput(\"output_2\")!.setValue(input.z, context);\n this.getDataOutput(\"output_3\")!.setValue(input.w, context);\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractVector4;\n }\n}\n\n/**\n * Extracts 16 floats from a Matrix\n */\nexport class FlowGraphExtractMatrixBlock extends FlowGraphMathExtractBlock<Matrix> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(16, RichTypeMatrix, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as Matrix;\n if (!input) {\n input = Matrix.Identity();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n for (let i = 0; i < 16; i++) {\n this.getDataOutput(`output_${i}`)!.setValue(input.m[i], context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractMatrix;\n }\n}\n\n/**\n * Extracts 4 floats from a Matrix2D\n */\nexport class FlowGraphExtractMatrix2DBlock extends FlowGraphMathExtractBlock<FlowGraphMatrix2D> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(4, RichTypeMatrix2D, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as FlowGraphMatrix2D;\n if (!input) {\n input = new FlowGraphMatrix2D();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n for (let i = 0; i < 4; i++) {\n this.getDataOutput(`output_${i}`)!.setValue(input.m[i], context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractMatrix2D;\n }\n}\n\n/**\n * Extracts 4 floats from a Matrix2D\n */\nexport class FlowGraphExtractMatrix3DBlock extends FlowGraphMathExtractBlock<FlowGraphMatrix3D> {\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(9, RichTypeMatrix3D, config);\n }\n public override _updateOutputs(context: FlowGraphContext): void {\n let input = this.getDataInput(\"input\")?.getValue(context) as FlowGraphMatrix3D;\n if (!input) {\n input = new FlowGraphMatrix3D();\n this.getDataInput(\"input\")!.setValue(input, context);\n }\n for (let i = 0; i < 9; i++) {\n this.getDataOutput(`output_${i}`)!.setValue(input.m[i], context);\n }\n }\n\n public override getClassName(): string {\n return FlowGraphBlockNames.ExtractMatrix3D;\n }\n}\n\nlet _Registered = false;\n/**\n * Register side effects for flowGraphMathCombineExtractBlocks.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterFlowGraphMathCombineExtractBlocks(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n RegisterClass(FlowGraphBlockNames.CombineVector2, FlowGraphCombineVector2Block);\n RegisterClass(FlowGraphBlockNames.CombineVector3, FlowGraphCombineVector3Block);\n RegisterClass(FlowGraphBlockNames.CombineVector4, FlowGraphCombineVector4Block);\n RegisterClass(FlowGraphBlockNames.CombineMatrix, FlowGraphCombineMatrixBlock);\n RegisterClass(FlowGraphBlockNames.CombineMatrix2D, FlowGraphCombineMatrix2DBlock);\n RegisterClass(FlowGraphBlockNames.CombineMatrix3D, FlowGraphCombineMatrix3DBlock);\n RegisterClass(FlowGraphBlockNames.ExtractVector2, FlowGraphExtractVector2Block);\n RegisterClass(FlowGraphBlockNames.ExtractVector3, FlowGraphExtractVector3Block);\n RegisterClass(FlowGraphBlockNames.ExtractVector4, FlowGraphExtractVector4Block);\n RegisterClass(FlowGraphBlockNames.ExtractMatrix, FlowGraphExtractMatrixBlock);\n RegisterClass(FlowGraphBlockNames.ExtractMatrix2D, FlowGraphExtractMatrix2DBlock);\n RegisterClass(FlowGraphBlockNames.ExtractMatrix3D, FlowGraphExtractMatrix3DBlock);\n}\n"]}
@@ -5,6 +5,7 @@ import { type FlowGraphDataConnection } from "../../../flowGraphDataConnection.p
5
5
  import { FlowGraphTypes } from "../../../flowGraphRichTypes.pure.js";
6
6
  import { Matrix, Quaternion, Vector3 } from "../../../../Maths/math.vector.pure.js";
7
7
  import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
8
+ import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js";
8
9
  import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
9
10
  import { type FlowGraphMatrix } from "../../../utils.js";
10
11
  /**
@@ -16,6 +17,20 @@ export interface IFlowGraphMatrixBlockConfiguration extends IFlowGraphBlockConfi
16
17
  */
17
18
  matrixType: FlowGraphTypes;
18
19
  }
20
+ /**
21
+ * Configuration for the matrix decompose block.
22
+ */
23
+ export interface IFlowGraphMatrixDecomposeBlockConfiguration extends IFlowGraphBlockConfiguration {
24
+ /**
25
+ * When a matrix cannot be decomposed, output the translation and the raw column lengths that were
26
+ * extracted from the matrix instead of the type-default translation and scale. `isValid` is reported
27
+ * as `false` either way. Defaults to `false`.
28
+ *
29
+ * A host whose specification requires those components to be preserved can turn this on; it is
30
+ * opt-in so that the default block behaviour stays unchanged.
31
+ */
32
+ keepDegenerateComponents?: boolean;
33
+ }
19
34
  /**
20
35
  * Transposes a matrix.
21
36
  */
@@ -39,12 +54,25 @@ export declare class FlowGraphDeterminantBlock extends FlowGraphUnaryOperationBl
39
54
  /**
40
55
  * Inverts a matrix.
41
56
  */
42
- export declare class FlowGraphInvertMatrixBlock extends FlowGraphUnaryOperationBlock<FlowGraphMatrix, FlowGraphMatrix> {
57
+ export declare class FlowGraphInvertMatrixBlock extends FlowGraphCachedOperationBlock<FlowGraphMatrix> {
58
+ /**
59
+ * The matrix to invert.
60
+ */
61
+ readonly a: FlowGraphDataConnection<FlowGraphMatrix>;
62
+ private readonly _matrixType;
43
63
  /**
44
64
  * Creates a new instance of the inverse block.
45
65
  * @param config the configuration of the block
46
66
  */
47
67
  constructor(config?: IFlowGraphMatrixBlockConfiguration);
68
+ _doOperation(context: FlowGraphContext): FlowGraphMatrix | undefined;
69
+ /**
70
+ * A matrix with no inverse reports an all-zero matrix rather than the identity default of the
71
+ * matrix type, so the output is not mistaken for a meaningful transform.
72
+ * @returns a matrix of the block's type with every element set to zero
73
+ */
74
+ protected _getInvalidOutputValue(): FlowGraphMatrix;
75
+ getClassName(): string;
48
76
  }
49
77
  /**
50
78
  * Multiplies two matrices.
@@ -81,7 +109,7 @@ export declare class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {
81
109
  * Is the matrix valid
82
110
  */
83
111
  readonly isValid: FlowGraphDataConnection<boolean>;
84
- constructor(config?: IFlowGraphBlockConfiguration);
112
+ constructor(config?: IFlowGraphMatrixDecomposeBlockConfiguration);
85
113
  _updateOutputs(context: FlowGraphContext): void;
86
114
  getClassName(): string;
87
115
  }
@@ -3,8 +3,29 @@ import { FlowGraphBlock } from "../../../flowGraphBlock.js";
3
3
  import { getRichTypeByFlowGraphType, RichTypeBoolean, RichTypeMatrix, RichTypeNumber, RichTypeQuaternion, RichTypeVector3, } from "../../../flowGraphRichTypes.pure.js";
4
4
  import { Matrix, Quaternion, Vector3 } from "../../../../Maths/math.vector.pure.js";
5
5
  import { FlowGraphUnaryOperationBlock } from "../flowGraphUnaryOperationBlock.js";
6
+ import { FlowGraphCachedOperationBlock } from "../flowGraphCachedOperationBlock.js";
7
+ import { FlowGraphMatrix2D, FlowGraphMatrix3D } from "../../../CustomTypes/flowGraphMatrix.js";
6
8
  import { FlowGraphBinaryOperationBlock } from "../flowGraphBinaryOperationBlock.js";
7
9
  import { RegisterClass } from "../../../../Misc/typeStore.js";
10
+ /**
11
+ * Threshold below which the determinant of the normalized 3x3 of a matrix is treated as zero, indicating a
12
+ * degenerate (non-decomposable) matrix whose columns are linearly dependent.
13
+ */
14
+ const MatrixDecomposeDegenerateEpsilon = 1e-6;
15
+ /**
16
+ * Builds a matrix of the given flow graph matrix type with every element set to zero.
17
+ * @param matrixType the matrix type to build
18
+ * @returns the zero matrix
19
+ */
20
+ function CreateZeroMatrix(matrixType) {
21
+ if (matrixType === "Matrix2D" /* FlowGraphTypes.Matrix2D */) {
22
+ return new FlowGraphMatrix2D([0, 0, 0, 0]);
23
+ }
24
+ if (matrixType === "Matrix3D" /* FlowGraphTypes.Matrix3D */) {
25
+ return new FlowGraphMatrix3D([0, 0, 0, 0, 0, 0, 0, 0, 0]);
26
+ }
27
+ return Matrix.FromArray(new Array(16).fill(0));
28
+ }
8
29
  /**
9
30
  * Transposes a matrix.
10
31
  */
@@ -32,13 +53,36 @@ export class FlowGraphDeterminantBlock extends FlowGraphUnaryOperationBlock {
32
53
  /**
33
54
  * Inverts a matrix.
34
55
  */
35
- export class FlowGraphInvertMatrixBlock extends FlowGraphUnaryOperationBlock {
56
+ export class FlowGraphInvertMatrixBlock extends FlowGraphCachedOperationBlock {
36
57
  /**
37
58
  * Creates a new instance of the inverse block.
38
59
  * @param config the configuration of the block
39
60
  */
40
61
  constructor(config) {
41
- super(getRichTypeByFlowGraphType(config?.matrixType || "Matrix" /* FlowGraphTypes.Matrix */), getRichTypeByFlowGraphType(config?.matrixType || "Matrix" /* FlowGraphTypes.Matrix */), (a) => (a.inverse ? a.inverse() : Matrix.Invert(a)), "FlowGraphInvertMatrixBlock" /* FlowGraphBlockNames.InvertMatrix */, config);
62
+ super(getRichTypeByFlowGraphType(config?.matrixType || "Matrix" /* FlowGraphTypes.Matrix */), config);
63
+ this._matrixType = config?.matrixType || "Matrix" /* FlowGraphTypes.Matrix */;
64
+ this.a = this.registerDataInput("a", getRichTypeByFlowGraphType(config?.matrixType || "Matrix" /* FlowGraphTypes.Matrix */));
65
+ }
66
+ _doOperation(context) {
67
+ const a = this.a.getValue(context);
68
+ // A matrix is only invertible when its determinant is a finite, non-zero number. For a zero, NaN, or
69
+ // infinite determinant, returning undefined makes the cached base report isValid = false.
70
+ const determinant = a.determinant();
71
+ if (determinant === 0 || !Number.isFinite(determinant)) {
72
+ return undefined;
73
+ }
74
+ return a.inverse ? a.inverse() : Matrix.Invert(a);
75
+ }
76
+ /**
77
+ * A matrix with no inverse reports an all-zero matrix rather than the identity default of the
78
+ * matrix type, so the output is not mistaken for a meaningful transform.
79
+ * @returns a matrix of the block's type with every element set to zero
80
+ */
81
+ _getInvalidOutputValue() {
82
+ return CreateZeroMatrix(this._matrixType);
83
+ }
84
+ getClassName() {
85
+ return "FlowGraphInvertMatrixBlock" /* FlowGraphBlockNames.InvertMatrix */;
42
86
  }
43
87
  }
44
88
  /**
@@ -67,44 +111,82 @@ export class FlowGraphMatrixDecomposeBlock extends FlowGraphBlock {
67
111
  this.isValid = this.registerDataOutput("isValid", RichTypeBoolean, false);
68
112
  }
69
113
  _updateOutputs(context) {
114
+ // _updateOutputs runs on every read of any of this block's four outputs. Cache the decomposition
115
+ // per executionId (matching FlowGraphMatrixComposeBlock below) so reading all four outputs in one
116
+ // frame does the work once instead of four times.
70
117
  const cachedExecutionId = context._getExecutionVariable(this, "executionId", -1);
71
118
  const cachedPosition = context._getExecutionVariable(this, "cachedPosition", null);
72
119
  const cachedRotation = context._getExecutionVariable(this, "cachedRotation", null);
73
120
  const cachedScaling = context._getExecutionVariable(this, "cachedScaling", null);
74
- if (cachedExecutionId === context.executionId && cachedPosition && cachedRotation && cachedScaling) {
121
+ const cachedIsValid = context._getExecutionVariable(this, "cachedIsValid", null);
122
+ if (cachedExecutionId === context.executionId && cachedPosition && cachedRotation && cachedScaling && cachedIsValid !== null) {
123
+ this.isValid.setValue(cachedIsValid, context);
75
124
  this.position.setValue(cachedPosition, context);
76
125
  this.rotationQuaternion.setValue(cachedRotation, context);
77
126
  this.scaling.setValue(cachedScaling, context);
127
+ return;
128
+ }
129
+ const matrix = this.input.getValue(context);
130
+ const m = matrix.m;
131
+ const keepDegenerateComponents = !!this.config?.keepDegenerateComponents;
132
+ // The fourth row of the matrix is ignored: the translation comes from the first three elements of the
133
+ // fourth column, the scale from the lengths of the first three columns of the upper-left 3x3, and the
134
+ // rotation from that 3x3 once normalized.
135
+ const translation = new Vector3(m[12], m[13], m[14]);
136
+ const scaleX = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);
137
+ const scaleY = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);
138
+ const scaleZ = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);
139
+ // The matrix cannot be decomposed: the rotation is undefined, so report an identity rotation and either the
140
+ // components that were extracted from the matrix or the type defaults.
141
+ const degenerateOutputs = (keepComponents) => ({
142
+ isValid: false,
143
+ rotationQuaternion: Quaternion.Identity(),
144
+ position: keepComponents ? translation : Vector3.Zero(),
145
+ scaling: keepComponents ? new Vector3(scaleX, scaleY, scaleZ) : Vector3.One(),
146
+ });
147
+ let result;
148
+ const areScalesFinite = Number.isFinite(scaleX) && Number.isFinite(scaleY) && Number.isFinite(scaleZ);
149
+ const isTranslationFinite = Number.isFinite(m[12]) && Number.isFinite(m[13]) && Number.isFinite(m[14]);
150
+ if (!areScalesFinite || (!keepDegenerateComponents && !isTranslationFinite)) {
151
+ result = degenerateOutputs(keepDegenerateComponents);
152
+ }
153
+ else if (scaleX === 0 || scaleY === 0 || scaleZ === 0) {
154
+ // A zero scale component leaves the rotation undefined, but the translation and the (degenerate) scale
155
+ // are still well-defined, so they are reported as-is.
156
+ result = degenerateOutputs(true);
78
157
  }
79
158
  else {
80
- const matrix = this.input.getValue(context);
81
- const position = cachedPosition || new Vector3();
82
- const rotation = cachedRotation || new Quaternion();
83
- const scaling = cachedScaling || new Vector3();
84
- // check matrix last column components should be 0,0,0,1
85
- // round them to 4 decimal places
86
- const m3 = Math.round(matrix.m[3] * 10000) / 10000;
87
- const m7 = Math.round(matrix.m[7] * 10000) / 10000;
88
- const m11 = Math.round(matrix.m[11] * 10000) / 10000;
89
- const m15 = Math.round(matrix.m[15] * 10000) / 10000;
90
- if (m3 !== 0 || m7 !== 0 || m11 !== 0 || m15 !== 1) {
91
- this.isValid.setValue(false, context);
92
- this.position.setValue(Vector3.Zero(), context);
93
- this.rotationQuaternion.setValue(Quaternion.Identity(), context);
94
- this.scaling.setValue(Vector3.One(), context);
95
- return;
159
+ // The determinant of the upper-left 3x3 (the fourth row is ignored) gives the handedness; dividing by the
160
+ // product of the scales yields the determinant of the normalized 3x3, which is (close to) zero only when the
161
+ // columns are linearly dependent — a degenerate matrix that cannot represent a rotation.
162
+ 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]);
163
+ const normalizedDeterminant = determinant / (scaleX * scaleY * scaleZ);
164
+ if (Math.abs(normalizedDeterminant) < MatrixDecomposeDegenerateEpsilon) {
165
+ result = degenerateOutputs(keepDegenerateComponents);
166
+ }
167
+ else {
168
+ // The remaining matrix is well-formed, so the actual translation/rotation/scale extraction is delegated
169
+ // to the shared Matrix.decompose. That keeps the rotation and the handedness-sign convention identical to
170
+ // the rest of Babylon (a left-handed matrix negates the same scale component everywhere). The fourth row is
171
+ // reset to (0, 0, 0, 1) first because this operation ignores it, whereas Matrix.decompose's internal
172
+ // determinant would otherwise let a non-standard fourth row flip the handedness.
173
+ 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);
174
+ const outScaling = new Vector3();
175
+ const outRotation = new Quaternion();
176
+ const outPosition = new Vector3();
177
+ normalized.decompose(outScaling, outRotation, outPosition);
178
+ result = { isValid: true, position: outPosition, rotationQuaternion: outRotation, scaling: outScaling };
96
179
  }
97
- // make the checks for validity
98
- const valid = matrix.decompose(scaling, rotation, position);
99
- this.isValid.setValue(valid, context);
100
- this.position.setValue(position, context);
101
- this.rotationQuaternion.setValue(rotation, context);
102
- this.scaling.setValue(scaling, context);
103
- context._setExecutionVariable(this, "cachedPosition", position);
104
- context._setExecutionVariable(this, "cachedRotation", rotation);
105
- context._setExecutionVariable(this, "cachedScaling", scaling);
106
- context._setExecutionVariable(this, "executionId", context.executionId);
107
180
  }
181
+ this.isValid.setValue(result.isValid, context);
182
+ this.position.setValue(result.position, context);
183
+ this.rotationQuaternion.setValue(result.rotationQuaternion, context);
184
+ this.scaling.setValue(result.scaling, context);
185
+ context._setExecutionVariable(this, "cachedIsValid", result.isValid);
186
+ context._setExecutionVariable(this, "cachedPosition", result.position);
187
+ context._setExecutionVariable(this, "cachedRotation", result.rotationQuaternion);
188
+ context._setExecutionVariable(this, "cachedScaling", result.scaling);
189
+ context._setExecutionVariable(this, "executionId", context.executionId);
108
190
  }
109
191
  getClassName() {
110
192
  return "FlowGraphMatrixDecompose" /* FlowGraphBlockNames.MatrixDecompose */;