@onerjs/loaders 8.23.1

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 (280) hide show
  1. package/OBJ/index.d.ts +4 -0
  2. package/OBJ/index.js +5 -0
  3. package/OBJ/index.js.map +1 -0
  4. package/OBJ/mtlFileLoader.d.ts +41 -0
  5. package/OBJ/mtlFileLoader.js +231 -0
  6. package/OBJ/mtlFileLoader.js.map +1 -0
  7. package/OBJ/objFileLoader.d.ts +136 -0
  8. package/OBJ/objFileLoader.js +318 -0
  9. package/OBJ/objFileLoader.js.map +1 -0
  10. package/OBJ/objFileLoader.metadata.d.ts +4 -0
  11. package/OBJ/objFileLoader.metadata.js +5 -0
  12. package/OBJ/objFileLoader.metadata.js.map +1 -0
  13. package/OBJ/objLoadingOptions.d.ts +47 -0
  14. package/OBJ/objLoadingOptions.js +2 -0
  15. package/OBJ/objLoadingOptions.js.map +1 -0
  16. package/OBJ/solidParser.d.ts +174 -0
  17. package/OBJ/solidParser.js +862 -0
  18. package/OBJ/solidParser.js.map +1 -0
  19. package/SPLAT/index.d.ts +2 -0
  20. package/SPLAT/index.js +4 -0
  21. package/SPLAT/index.js.map +1 -0
  22. package/SPLAT/splatFileLoader.d.ts +88 -0
  23. package/SPLAT/splatFileLoader.js +562 -0
  24. package/SPLAT/splatFileLoader.js.map +1 -0
  25. package/SPLAT/splatFileLoader.metadata.d.ts +14 -0
  26. package/SPLAT/splatFileLoader.metadata.js +12 -0
  27. package/SPLAT/splatFileLoader.metadata.js.map +1 -0
  28. package/SPLAT/splatLoadingOptions.d.ts +13 -0
  29. package/SPLAT/splatLoadingOptions.js +2 -0
  30. package/SPLAT/splatLoadingOptions.js.map +1 -0
  31. package/STL/index.d.ts +1 -0
  32. package/STL/index.js +2 -0
  33. package/STL/index.js.map +1 -0
  34. package/STL/stlFileLoader.d.ts +78 -0
  35. package/STL/stlFileLoader.js +239 -0
  36. package/STL/stlFileLoader.js.map +1 -0
  37. package/STL/stlFileLoader.metadata.d.ts +8 -0
  38. package/STL/stlFileLoader.metadata.js +8 -0
  39. package/STL/stlFileLoader.metadata.js.map +1 -0
  40. package/bvh/bvhFileLoader.d.ts +69 -0
  41. package/bvh/bvhFileLoader.js +133 -0
  42. package/bvh/bvhFileLoader.js.map +1 -0
  43. package/bvh/bvhFileLoader.metadata.d.ts +8 -0
  44. package/bvh/bvhFileLoader.metadata.js +8 -0
  45. package/bvh/bvhFileLoader.metadata.js.map +1 -0
  46. package/bvh/bvhLoader.d.ts +14 -0
  47. package/bvh/bvhLoader.js +329 -0
  48. package/bvh/bvhLoader.js.map +1 -0
  49. package/bvh/bvhLoadingOptions.d.ts +9 -0
  50. package/bvh/bvhLoadingOptions.js +2 -0
  51. package/bvh/bvhLoadingOptions.js.map +1 -0
  52. package/bvh/index.d.ts +2 -0
  53. package/bvh/index.js +4 -0
  54. package/bvh/index.js.map +1 -0
  55. package/bvh/license.md +21 -0
  56. package/dynamic.d.ts +5 -0
  57. package/dynamic.js +57 -0
  58. package/dynamic.js.map +1 -0
  59. package/glTF/1.0/glTFBinaryExtension.d.ts +16 -0
  60. package/glTF/1.0/glTFBinaryExtension.js +65 -0
  61. package/glTF/1.0/glTFBinaryExtension.js.map +1 -0
  62. package/glTF/1.0/glTFLoader.d.ts +144 -0
  63. package/glTF/1.0/glTFLoader.js +1841 -0
  64. package/glTF/1.0/glTFLoader.js.map +1 -0
  65. package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -0
  66. package/glTF/1.0/glTFLoaderInterfaces.js +96 -0
  67. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -0
  68. package/glTF/1.0/glTFLoaderUtils.d.ts +71 -0
  69. package/glTF/1.0/glTFLoaderUtils.js +255 -0
  70. package/glTF/1.0/glTFLoaderUtils.js.map +1 -0
  71. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +13 -0
  72. package/glTF/1.0/glTFMaterialsCommonExtension.js +131 -0
  73. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -0
  74. package/glTF/1.0/index.d.ts +5 -0
  75. package/glTF/1.0/index.js +6 -0
  76. package/glTF/1.0/index.js.map +1 -0
  77. package/glTF/2.0/Extensions/EXT_lights_ies.d.ts +41 -0
  78. package/glTF/2.0/Extensions/EXT_lights_ies.js +84 -0
  79. package/glTF/2.0/Extensions/EXT_lights_ies.js.map +1 -0
  80. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +48 -0
  81. package/glTF/2.0/Extensions/EXT_lights_image_based.js +116 -0
  82. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -0
  83. package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.d.ts +43 -0
  84. package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js +69 -0
  85. package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js.map +1 -0
  86. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +39 -0
  87. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +82 -0
  88. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -0
  89. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +39 -0
  90. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +51 -0
  91. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -0
  92. package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +34 -0
  93. package/glTF/2.0/Extensions/EXT_texture_avif.js +39 -0
  94. package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -0
  95. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +33 -0
  96. package/glTF/2.0/Extensions/EXT_texture_webp.js +38 -0
  97. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -0
  98. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +48 -0
  99. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +63 -0
  100. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -0
  101. package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +47 -0
  102. package/glTF/2.0/Extensions/KHR_animation_pointer.data.d.ts +1 -0
  103. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js +239 -0
  104. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -0
  105. package/glTF/2.0/Extensions/KHR_animation_pointer.js +78 -0
  106. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -0
  107. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +47 -0
  108. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +93 -0
  109. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -0
  110. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +352 -0
  111. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +1700 -0
  112. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -0
  113. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +33 -0
  114. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +20 -0
  115. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -0
  116. package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +3 -0
  117. package/glTF/2.0/Extensions/KHR_interactivity/index.js +4 -0
  118. package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -0
  119. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +70 -0
  120. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +450 -0
  121. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -0
  122. package/glTF/2.0/Extensions/KHR_interactivity.d.ts +38 -0
  123. package/glTF/2.0/Extensions/KHR_interactivity.js +151 -0
  124. package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -0
  125. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -0
  126. package/glTF/2.0/Extensions/KHR_lights_punctual.js +92 -0
  127. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -0
  128. package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +42 -0
  129. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +61 -0
  130. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -0
  131. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +43 -0
  132. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -0
  133. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -0
  134. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +43 -0
  135. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +95 -0
  136. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -0
  137. package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +43 -0
  138. package/glTF/2.0/Extensions/KHR_materials_dispersion.js +60 -0
  139. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -0
  140. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +42 -0
  141. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +52 -0
  142. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
  143. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +46 -0
  144. package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -0
  145. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -0
  146. package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +42 -0
  147. package/glTF/2.0/Extensions/KHR_materials_iridescence.js +71 -0
  148. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -0
  149. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +42 -0
  150. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +81 -0
  151. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -0
  152. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +43 -0
  153. package/glTF/2.0/Extensions/KHR_materials_sheen.js +85 -0
  154. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -0
  155. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +42 -0
  156. package/glTF/2.0/Extensions/KHR_materials_specular.js +85 -0
  157. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -0
  158. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +42 -0
  159. package/glTF/2.0/Extensions/KHR_materials_transmission.js +306 -0
  160. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -0
  161. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +42 -0
  162. package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -0
  163. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -0
  164. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +112 -0
  165. package/glTF/2.0/Extensions/KHR_materials_variants.js +263 -0
  166. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -0
  167. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +43 -0
  168. package/glTF/2.0/Extensions/KHR_materials_volume.js +86 -0
  169. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
  170. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +29 -0
  171. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -0
  172. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -0
  173. package/glTF/2.0/Extensions/KHR_node_hoverability.d.ts +31 -0
  174. package/glTF/2.0/Extensions/KHR_node_hoverability.js +190 -0
  175. package/glTF/2.0/Extensions/KHR_node_hoverability.js.map +1 -0
  176. package/glTF/2.0/Extensions/KHR_node_selectability.d.ts +30 -0
  177. package/glTF/2.0/Extensions/KHR_node_selectability.js +124 -0
  178. package/glTF/2.0/Extensions/KHR_node_selectability.js.map +1 -0
  179. package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +30 -0
  180. package/glTF/2.0/Extensions/KHR_node_visibility.js +69 -0
  181. package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -0
  182. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +33 -0
  183. package/glTF/2.0/Extensions/KHR_texture_basisu.js +38 -0
  184. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -0
  185. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +37 -0
  186. package/glTF/2.0/Extensions/KHR_texture_transform.js +59 -0
  187. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -0
  188. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +39 -0
  189. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +48 -0
  190. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -0
  191. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +56 -0
  192. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +227 -0
  193. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -0
  194. package/glTF/2.0/Extensions/MSFT_lod.d.ts +104 -0
  195. package/glTF/2.0/Extensions/MSFT_lod.js +338 -0
  196. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -0
  197. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +27 -0
  198. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +41 -0
  199. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -0
  200. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +27 -0
  201. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +42 -0
  202. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -0
  203. package/glTF/2.0/Extensions/dynamic.d.ts +4 -0
  204. package/glTF/2.0/Extensions/dynamic.js +156 -0
  205. package/glTF/2.0/Extensions/dynamic.js.map +1 -0
  206. package/glTF/2.0/Extensions/gltfPathToObjectConverter.d.ts +45 -0
  207. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js +101 -0
  208. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -0
  209. package/glTF/2.0/Extensions/index.d.ts +39 -0
  210. package/glTF/2.0/Extensions/index.js +41 -0
  211. package/glTF/2.0/Extensions/index.js.map +1 -0
  212. package/glTF/2.0/Extensions/objectModelMapping.d.ts +289 -0
  213. package/glTF/2.0/Extensions/objectModelMapping.js +828 -0
  214. package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -0
  215. package/glTF/2.0/glTFLoader.d.ts +429 -0
  216. package/glTF/2.0/glTFLoader.js +2408 -0
  217. package/glTF/2.0/glTFLoader.js.map +1 -0
  218. package/glTF/2.0/glTFLoaderAnimation.d.ts +42 -0
  219. package/glTF/2.0/glTFLoaderAnimation.js +80 -0
  220. package/glTF/2.0/glTFLoaderAnimation.js.map +1 -0
  221. package/glTF/2.0/glTFLoaderExtension.d.ts +165 -0
  222. package/glTF/2.0/glTFLoaderExtension.js +2 -0
  223. package/glTF/2.0/glTFLoaderExtension.js.map +1 -0
  224. package/glTF/2.0/glTFLoaderExtensionRegistry.d.ts +25 -0
  225. package/glTF/2.0/glTFLoaderExtensionRegistry.js +33 -0
  226. package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -0
  227. package/glTF/2.0/glTFLoaderInterfaces.d.ts +257 -0
  228. package/glTF/2.0/glTFLoaderInterfaces.js +2 -0
  229. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -0
  230. package/glTF/2.0/index.d.ts +6 -0
  231. package/glTF/2.0/index.js +8 -0
  232. package/glTF/2.0/index.js.map +1 -0
  233. package/glTF/glTFFileLoader.d.ts +516 -0
  234. package/glTF/glTFFileLoader.js +968 -0
  235. package/glTF/glTFFileLoader.js.map +1 -0
  236. package/glTF/glTFFileLoader.metadata.d.ts +15 -0
  237. package/glTF/glTFFileLoader.metadata.js +18 -0
  238. package/glTF/glTFFileLoader.metadata.js.map +1 -0
  239. package/glTF/glTFValidation.d.ts +29 -0
  240. package/glTF/glTFValidation.js +126 -0
  241. package/glTF/glTFValidation.js.map +1 -0
  242. package/glTF/index.d.ts +5 -0
  243. package/glTF/index.js +7 -0
  244. package/glTF/index.js.map +1 -0
  245. package/index.d.ts +5 -0
  246. package/index.js +7 -0
  247. package/index.js.map +1 -0
  248. package/legacy/legacy-bvhFileLoader.d.ts +1 -0
  249. package/legacy/legacy-bvhFileLoader.js +16 -0
  250. package/legacy/legacy-bvhFileLoader.js.map +1 -0
  251. package/legacy/legacy-glTF.d.ts +2 -0
  252. package/legacy/legacy-glTF.js +19 -0
  253. package/legacy/legacy-glTF.js.map +1 -0
  254. package/legacy/legacy-glTF1.d.ts +2 -0
  255. package/legacy/legacy-glTF1.js +16 -0
  256. package/legacy/legacy-glTF1.js.map +1 -0
  257. package/legacy/legacy-glTF1FileLoader.d.ts +2 -0
  258. package/legacy/legacy-glTF1FileLoader.js +4 -0
  259. package/legacy/legacy-glTF1FileLoader.js.map +1 -0
  260. package/legacy/legacy-glTF2.d.ts +2 -0
  261. package/legacy/legacy-glTF2.js +35 -0
  262. package/legacy/legacy-glTF2.js.map +1 -0
  263. package/legacy/legacy-glTF2FileLoader.d.ts +2 -0
  264. package/legacy/legacy-glTF2FileLoader.js +4 -0
  265. package/legacy/legacy-glTF2FileLoader.js.map +1 -0
  266. package/legacy/legacy-glTFFileLoader.d.ts +3 -0
  267. package/legacy/legacy-glTFFileLoader.js +5 -0
  268. package/legacy/legacy-glTFFileLoader.js.map +1 -0
  269. package/legacy/legacy-objFileLoader.d.ts +1 -0
  270. package/legacy/legacy-objFileLoader.js +16 -0
  271. package/legacy/legacy-objFileLoader.js.map +1 -0
  272. package/legacy/legacy-stlFileLoader.d.ts +1 -0
  273. package/legacy/legacy-stlFileLoader.js +16 -0
  274. package/legacy/legacy-stlFileLoader.js.map +1 -0
  275. package/legacy/legacy.d.ts +7 -0
  276. package/legacy/legacy.js +10 -0
  277. package/legacy/legacy.js.map +1 -0
  278. package/license.md +71 -0
  279. package/package.json +49 -0
  280. package/readme.md +23 -0
@@ -0,0 +1,1700 @@
1
+ import { Logger } from "@babylonjs/core/Misc/logger.js";
2
+ import { getAnimationTypeByFlowGraphType } from "@babylonjs/core/FlowGraph/flowGraphRichTypes.js";
3
+ export function getMappingForFullOperationName(fullOperationName) {
4
+ const [op, extension] = fullOperationName.split(":");
5
+ return getMappingForDeclaration({ op, extension });
6
+ }
7
+ export function getMappingForDeclaration(declaration, returnNoOpIfNotAvailable = true) {
8
+ const mapping = declaration.extension ? gltfExtensionsToFlowGraphMapping[declaration.extension]?.[declaration.op] : gltfToFlowGraphMapping[declaration.op];
9
+ if (!mapping) {
10
+ Logger.Warn(`No mapping found for operation ${declaration.op} and extension ${declaration.extension || "KHR_interactivity"}`);
11
+ if (returnNoOpIfNotAvailable) {
12
+ const inputs = {};
13
+ const outputs = {
14
+ flows: {},
15
+ };
16
+ if (declaration.inputValueSockets) {
17
+ inputs.values = {};
18
+ for (const key in declaration.inputValueSockets) {
19
+ inputs.values[key] = {
20
+ name: key,
21
+ };
22
+ }
23
+ }
24
+ if (declaration.outputValueSockets) {
25
+ outputs.values = {};
26
+ Object.keys(declaration.outputValueSockets).forEach((key) => {
27
+ outputs.values[key] = {
28
+ name: key,
29
+ };
30
+ });
31
+ }
32
+ return {
33
+ blocks: [], // no blocks, just mapping
34
+ inputs,
35
+ outputs,
36
+ };
37
+ }
38
+ }
39
+ return mapping;
40
+ }
41
+ /**
42
+ * This function will add new mapping to glTF interactivity.
43
+ * Other extensions can define new types of blocks, this is the way to let interactivity know how to parse them.
44
+ * @param key the type of node, i.e. "variable/get"
45
+ * @param extension the extension of the interactivity operation, i.e. "KHR_selectability"
46
+ * @param mapping The mapping object. See documentation or examples below.
47
+ */
48
+ export function addNewInteractivityFlowGraphMapping(key, extension, mapping) {
49
+ gltfExtensionsToFlowGraphMapping[extension] || (gltfExtensionsToFlowGraphMapping[extension] = {});
50
+ gltfExtensionsToFlowGraphMapping[extension][key] = mapping;
51
+ }
52
+ const gltfExtensionsToFlowGraphMapping = {
53
+ /**
54
+ * This is the BABYLON extension for glTF interactivity.
55
+ * It defines babylon-specific blocks and operations.
56
+ */
57
+ BABYLON: {
58
+ /**
59
+ * flow/log is a flow node that logs input to the console.
60
+ * It has "in" and "out" flows, and takes a message as input.
61
+ * The message can be any type of value.
62
+ * The message is logged to the console when the "in" flow is triggered.
63
+ * The "out" flow is triggered when the message is logged.
64
+ */
65
+ "flow/log": {
66
+ blocks: ["FlowGraphConsoleLogBlock" /* FlowGraphBlockNames.ConsoleLog */],
67
+ inputs: {
68
+ values: {
69
+ message: { name: "message" },
70
+ },
71
+ },
72
+ },
73
+ },
74
+ };
75
+ // this mapper is just a way to convert the glTF nodes to FlowGraph nodes in terms of input/output connection names and values.
76
+ const gltfToFlowGraphMapping = {
77
+ "event/onStart": {
78
+ blocks: ["FlowGraphSceneReadyEventBlock" /* FlowGraphBlockNames.SceneReadyEvent */],
79
+ outputs: {
80
+ flows: {
81
+ out: { name: "done" },
82
+ },
83
+ },
84
+ },
85
+ "event/onTick": {
86
+ blocks: ["FlowGraphSceneTickEventBlock" /* FlowGraphBlockNames.SceneTickEvent */],
87
+ inputs: {},
88
+ outputs: {
89
+ values: {
90
+ timeSinceLastTick: { name: "deltaTime", gltfType: "number" /*, dataTransformer: (time: number) => time / 1000*/ },
91
+ },
92
+ flows: {
93
+ out: { name: "done" },
94
+ },
95
+ },
96
+ },
97
+ "event/send": {
98
+ blocks: ["FlowGraphSendCustomEventBlock" /* FlowGraphBlockNames.SendCustomEvent */],
99
+ extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
100
+ // set eventId and eventData. The configuration object of the glTF should have a single object.
101
+ // validate that we are running it on the right block.
102
+ if (declaration.op !== "event/send" || !gltfBlock.configuration || Object.keys(gltfBlock.configuration).length !== 1) {
103
+ throw new Error("Receive event should have a single configuration object, the event itself");
104
+ }
105
+ const eventConfiguration = gltfBlock.configuration["event"];
106
+ const eventId = eventConfiguration.value[0];
107
+ if (typeof eventId !== "number") {
108
+ throw new Error("Event id should be a number");
109
+ }
110
+ const event = parser.arrays.events[eventId];
111
+ const serializedObject = serializedObjects[0];
112
+ serializedObject.config || (serializedObject.config = {});
113
+ serializedObject.config.eventId = event.eventId;
114
+ serializedObject.config.eventData = event.eventData;
115
+ return serializedObjects;
116
+ },
117
+ },
118
+ "event/receive": {
119
+ blocks: ["FlowGraphReceiveCustomEventBlock" /* FlowGraphBlockNames.ReceiveCustomEvent */],
120
+ outputs: {
121
+ flows: {
122
+ out: { name: "done" },
123
+ },
124
+ },
125
+ validation(gltfBlock, interactivityGraph) {
126
+ if (!gltfBlock.configuration) {
127
+ Logger.Error("Receive event should have a configuration object");
128
+ return { valid: false, error: "Receive event should have a configuration object" };
129
+ }
130
+ const eventConfiguration = gltfBlock.configuration["event"];
131
+ if (!eventConfiguration) {
132
+ Logger.Error("Receive event should have a single configuration object, the event itself");
133
+ return { valid: false, error: "Receive event should have a single configuration object, the event itself" };
134
+ }
135
+ const eventId = eventConfiguration.value[0];
136
+ if (typeof eventId !== "number") {
137
+ Logger.Error("Event id should be a number");
138
+ return { valid: false, error: "Event id should be a number" };
139
+ }
140
+ const event = interactivityGraph.events?.[eventId];
141
+ if (!event) {
142
+ Logger.Error(`Event with id ${eventId} not found`);
143
+ return { valid: false, error: `Event with id ${eventId} not found` };
144
+ }
145
+ return { valid: true };
146
+ },
147
+ extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
148
+ // set eventId and eventData. The configuration object of the glTF should have a single object.
149
+ // validate that we are running it on the right block.
150
+ if (declaration.op !== "event/receive" || !gltfBlock.configuration || Object.keys(gltfBlock.configuration).length !== 1) {
151
+ throw new Error("Receive event should have a single configuration object, the event itself");
152
+ }
153
+ const eventConfiguration = gltfBlock.configuration["event"];
154
+ const eventId = eventConfiguration.value[0];
155
+ if (typeof eventId !== "number") {
156
+ throw new Error("Event id should be a number");
157
+ }
158
+ const event = parser.arrays.events[eventId];
159
+ const serializedObject = serializedObjects[0];
160
+ serializedObject.config || (serializedObject.config = {});
161
+ serializedObject.config.eventId = event.eventId;
162
+ serializedObject.config.eventData = event.eventData;
163
+ return serializedObjects;
164
+ },
165
+ },
166
+ "math/E": getSimpleInputMapping("FlowGraphEBlock" /* FlowGraphBlockNames.E */),
167
+ "math/Pi": getSimpleInputMapping("FlowGraphPIBlock" /* FlowGraphBlockNames.PI */),
168
+ "math/Inf": getSimpleInputMapping("FlowGraphInfBlock" /* FlowGraphBlockNames.Inf */),
169
+ "math/NaN": getSimpleInputMapping("FlowGraphNaNBlock" /* FlowGraphBlockNames.NaN */),
170
+ "math/abs": getSimpleInputMapping("FlowGraphAbsBlock" /* FlowGraphBlockNames.Abs */),
171
+ "math/sign": getSimpleInputMapping("FlowGraphSignBlock" /* FlowGraphBlockNames.Sign */),
172
+ "math/trunc": getSimpleInputMapping("FlowGraphTruncBlock" /* FlowGraphBlockNames.Trunc */),
173
+ "math/floor": getSimpleInputMapping("FlowGraphFloorBlock" /* FlowGraphBlockNames.Floor */),
174
+ "math/ceil": getSimpleInputMapping("FlowGraphCeilBlock" /* FlowGraphBlockNames.Ceil */),
175
+ "math/round": {
176
+ blocks: ["FlowGraphRoundBlock" /* FlowGraphBlockNames.Round */],
177
+ configuration: {},
178
+ inputs: {
179
+ values: {
180
+ a: { name: "a" },
181
+ },
182
+ },
183
+ outputs: {
184
+ values: {
185
+ value: { name: "value" },
186
+ },
187
+ },
188
+ extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {
189
+ var _a;
190
+ // configure it to work the way glTF specifies
191
+ (_a = serializedObjects[0]).config || (_a.config = {});
192
+ serializedObjects[0].config.roundHalfAwayFromZero = true;
193
+ return serializedObjects;
194
+ },
195
+ },
196
+ "math/fract": getSimpleInputMapping("FlowGraphFractBlock" /* FlowGraphBlockNames.Fraction */),
197
+ "math/neg": getSimpleInputMapping("FlowGraphNegationBlock" /* FlowGraphBlockNames.Negation */),
198
+ "math/add": getSimpleInputMapping("FlowGraphAddBlock" /* FlowGraphBlockNames.Add */, ["a", "b"], true),
199
+ "math/sub": getSimpleInputMapping("FlowGraphSubtractBlock" /* FlowGraphBlockNames.Subtract */, ["a", "b"], true),
200
+ "math/mul": {
201
+ blocks: ["FlowGraphMultiplyBlock" /* FlowGraphBlockNames.Multiply */],
202
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
203
+ var _a;
204
+ // configure it to work the way glTF specifies
205
+ (_a = serializedObjects[0]).config || (_a.config = {});
206
+ serializedObjects[0].config.useMatrixPerComponent = true;
207
+ serializedObjects[0].config.preventIntegerFloatArithmetic = true;
208
+ // try to infer the type or fallback to Integer
209
+ // check the gltf block for the inputs, see if they have a type
210
+ let type = -1;
211
+ Object.keys(_gltfBlock.values || {}).find((value) => {
212
+ if (_gltfBlock.values?.[value].type !== undefined) {
213
+ type = _gltfBlock.values[value].type;
214
+ return true;
215
+ }
216
+ return false;
217
+ });
218
+ if (type !== -1) {
219
+ serializedObjects[0].config.type = _parser.arrays.types[type].flowGraphType;
220
+ }
221
+ return serializedObjects;
222
+ },
223
+ validation(gltfBlock) {
224
+ if (gltfBlock.values) {
225
+ // make sure types are the same
226
+ return ValidateTypes(gltfBlock);
227
+ }
228
+ return { valid: true };
229
+ },
230
+ },
231
+ "math/div": getSimpleInputMapping("FlowGraphDivideBlock" /* FlowGraphBlockNames.Divide */, ["a", "b"], true),
232
+ "math/rem": getSimpleInputMapping("FlowGraphModuloBlock" /* FlowGraphBlockNames.Modulo */, ["a", "b"]),
233
+ "math/min": getSimpleInputMapping("FlowGraphMinBlock" /* FlowGraphBlockNames.Min */, ["a", "b"]),
234
+ "math/max": getSimpleInputMapping("FlowGraphMaxBlock" /* FlowGraphBlockNames.Max */, ["a", "b"]),
235
+ "math/clamp": getSimpleInputMapping("FlowGraphClampBlock" /* FlowGraphBlockNames.Clamp */, ["a", "b", "c"]),
236
+ "math/saturate": getSimpleInputMapping("FlowGraphSaturateBlock" /* FlowGraphBlockNames.Saturate */),
237
+ "math/mix": getSimpleInputMapping("FlowGraphMathInterpolationBlock" /* FlowGraphBlockNames.MathInterpolation */, ["a", "b", "c"]),
238
+ "math/eq": getSimpleInputMapping("FlowGraphEqualityBlock" /* FlowGraphBlockNames.Equality */, ["a", "b"]),
239
+ "math/lt": getSimpleInputMapping("FlowGraphLessThanBlock" /* FlowGraphBlockNames.LessThan */, ["a", "b"]),
240
+ "math/le": getSimpleInputMapping("FlowGraphLessThanOrEqualBlock" /* FlowGraphBlockNames.LessThanOrEqual */, ["a", "b"]),
241
+ "math/gt": getSimpleInputMapping("FlowGraphGreaterThanBlock" /* FlowGraphBlockNames.GreaterThan */, ["a", "b"]),
242
+ "math/ge": getSimpleInputMapping("FlowGraphGreaterThanOrEqualBlock" /* FlowGraphBlockNames.GreaterThanOrEqual */, ["a", "b"]),
243
+ "math/isNaN": getSimpleInputMapping("FlowGraphIsNaNBlock" /* FlowGraphBlockNames.IsNaN */),
244
+ "math/isInf": getSimpleInputMapping("FlowGraphIsInfBlock" /* FlowGraphBlockNames.IsInfinity */),
245
+ "math/select": {
246
+ blocks: ["FlowGraphConditionalBlock" /* FlowGraphBlockNames.Conditional */],
247
+ inputs: {
248
+ values: {
249
+ condition: { name: "condition" },
250
+ // Should we validate those have the same type here, or assume it is already validated?
251
+ a: { name: "onTrue" },
252
+ b: { name: "onFalse" },
253
+ },
254
+ },
255
+ outputs: {
256
+ values: {
257
+ value: { name: "output" },
258
+ },
259
+ },
260
+ },
261
+ "math/random": {
262
+ blocks: ["FlowGraphRandomBlock" /* FlowGraphBlockNames.Random */],
263
+ outputs: {
264
+ values: {
265
+ value: { name: "value" },
266
+ },
267
+ },
268
+ },
269
+ "math/sin": getSimpleInputMapping("FlowGraphSinBlock" /* FlowGraphBlockNames.Sin */),
270
+ "math/cos": getSimpleInputMapping("FlowGraphCosBlock" /* FlowGraphBlockNames.Cos */),
271
+ "math/tan": getSimpleInputMapping("FlowGraphTanBlock" /* FlowGraphBlockNames.Tan */),
272
+ "math/asin": getSimpleInputMapping("FlowGraphASinBlock" /* FlowGraphBlockNames.Asin */),
273
+ "math/acos": getSimpleInputMapping("FlowGraphACosBlock" /* FlowGraphBlockNames.Acos */),
274
+ "math/atan": getSimpleInputMapping("FlowGraphATanBlock" /* FlowGraphBlockNames.Atan */),
275
+ "math/atan2": getSimpleInputMapping("FlowGraphATan2Block" /* FlowGraphBlockNames.Atan2 */, ["a", "b"]),
276
+ "math/sinh": getSimpleInputMapping("FlowGraphSinhBlock" /* FlowGraphBlockNames.Sinh */),
277
+ "math/cosh": getSimpleInputMapping("FlowGraphCoshBlock" /* FlowGraphBlockNames.Cosh */),
278
+ "math/tanh": getSimpleInputMapping("FlowGraphTanhBlock" /* FlowGraphBlockNames.Tanh */),
279
+ "math/asinh": getSimpleInputMapping("FlowGraphASinhBlock" /* FlowGraphBlockNames.Asinh */),
280
+ "math/acosh": getSimpleInputMapping("FlowGraphACoshBlock" /* FlowGraphBlockNames.Acosh */),
281
+ "math/atanh": getSimpleInputMapping("FlowGraphATanhBlock" /* FlowGraphBlockNames.Atanh */),
282
+ "math/exp": getSimpleInputMapping("FlowGraphExponentialBlock" /* FlowGraphBlockNames.Exponential */),
283
+ "math/log": getSimpleInputMapping("FlowGraphLogBlock" /* FlowGraphBlockNames.Log */),
284
+ "math/log2": getSimpleInputMapping("FlowGraphLog2Block" /* FlowGraphBlockNames.Log2 */),
285
+ "math/log10": getSimpleInputMapping("FlowGraphLog10Block" /* FlowGraphBlockNames.Log10 */),
286
+ "math/sqrt": getSimpleInputMapping("FlowGraphSquareRootBlock" /* FlowGraphBlockNames.SquareRoot */),
287
+ "math/cbrt": getSimpleInputMapping("FlowGraphCubeRootBlock" /* FlowGraphBlockNames.CubeRoot */),
288
+ "math/pow": getSimpleInputMapping("FlowGraphPowerBlock" /* FlowGraphBlockNames.Power */, ["a", "b"]),
289
+ "math/length": getSimpleInputMapping("FlowGraphLengthBlock" /* FlowGraphBlockNames.Length */),
290
+ "math/normalize": getSimpleInputMapping("FlowGraphNormalizeBlock" /* FlowGraphBlockNames.Normalize */),
291
+ "math/dot": getSimpleInputMapping("FlowGraphDotBlock" /* FlowGraphBlockNames.Dot */, ["a", "b"]),
292
+ "math/cross": getSimpleInputMapping("FlowGraphCrossBlock" /* FlowGraphBlockNames.Cross */, ["a", "b"]),
293
+ "math/rotate2D": {
294
+ blocks: ["FlowGraphRotate2DBlock" /* FlowGraphBlockNames.Rotate2D */],
295
+ inputs: {
296
+ values: {
297
+ a: { name: "a" },
298
+ angle: { name: "b" },
299
+ },
300
+ },
301
+ outputs: {
302
+ values: {
303
+ value: { name: "value" },
304
+ },
305
+ },
306
+ },
307
+ "math/rotate3D": {
308
+ blocks: ["FlowGraphRotate3DBlock" /* FlowGraphBlockNames.Rotate3D */],
309
+ inputs: {
310
+ values: {
311
+ a: { name: "a" },
312
+ rotation: { name: "b" },
313
+ },
314
+ },
315
+ outputs: {
316
+ values: {
317
+ value: { name: "value" },
318
+ },
319
+ },
320
+ },
321
+ "math/transform": {
322
+ // glTF transform is vectorN with matrixN
323
+ blocks: ["FlowGraphTransformVectorBlock" /* FlowGraphBlockNames.TransformVector */],
324
+ inputs: {
325
+ values: {
326
+ a: { name: "a" },
327
+ b: { name: "b" },
328
+ },
329
+ },
330
+ outputs: {
331
+ values: {
332
+ value: { name: "value" },
333
+ },
334
+ },
335
+ },
336
+ "math/combine2": {
337
+ blocks: ["FlowGraphCombineVector2Block" /* FlowGraphBlockNames.CombineVector2 */],
338
+ inputs: {
339
+ values: {
340
+ a: { name: "input_0", gltfType: "number" },
341
+ b: { name: "input_1", gltfType: "number" },
342
+ },
343
+ },
344
+ outputs: {
345
+ values: {
346
+ value: { name: "value" },
347
+ },
348
+ },
349
+ },
350
+ "math/combine3": {
351
+ blocks: ["FlowGraphCombineVector3Block" /* FlowGraphBlockNames.CombineVector3 */],
352
+ inputs: {
353
+ values: {
354
+ a: { name: "input_0", gltfType: "number" },
355
+ b: { name: "input_1", gltfType: "number" },
356
+ c: { name: "input_2", gltfType: "number" },
357
+ },
358
+ },
359
+ outputs: {
360
+ values: {
361
+ value: { name: "value" },
362
+ },
363
+ },
364
+ },
365
+ "math/combine4": {
366
+ blocks: ["FlowGraphCombineVector4Block" /* FlowGraphBlockNames.CombineVector4 */],
367
+ inputs: {
368
+ values: {
369
+ a: { name: "input_0", gltfType: "number" },
370
+ b: { name: "input_1", gltfType: "number" },
371
+ c: { name: "input_2", gltfType: "number" },
372
+ d: { name: "input_3", gltfType: "number" },
373
+ },
374
+ },
375
+ outputs: {
376
+ values: {
377
+ value: { name: "value" },
378
+ },
379
+ },
380
+ },
381
+ // one input, N outputs! outputs named using numbers.
382
+ "math/extract2": {
383
+ blocks: ["FlowGraphExtractVector2Block" /* FlowGraphBlockNames.ExtractVector2 */],
384
+ inputs: {
385
+ values: {
386
+ a: { name: "input", gltfType: "number" },
387
+ },
388
+ },
389
+ outputs: {
390
+ values: {
391
+ "0": { name: "output_0" },
392
+ "1": { name: "output_1" },
393
+ },
394
+ },
395
+ },
396
+ "math/extract3": {
397
+ blocks: ["FlowGraphExtractVector3Block" /* FlowGraphBlockNames.ExtractVector3 */],
398
+ inputs: {
399
+ values: {
400
+ a: { name: "input", gltfType: "number" },
401
+ },
402
+ },
403
+ outputs: {
404
+ values: {
405
+ "0": { name: "output_0" },
406
+ "1": { name: "output_1" },
407
+ "2": { name: "output_2" },
408
+ },
409
+ },
410
+ },
411
+ "math/extract4": {
412
+ blocks: ["FlowGraphExtractVector4Block" /* FlowGraphBlockNames.ExtractVector4 */],
413
+ inputs: {
414
+ values: {
415
+ a: { name: "input", gltfType: "number" },
416
+ },
417
+ },
418
+ outputs: {
419
+ values: {
420
+ "0": { name: "output_0" },
421
+ "1": { name: "output_1" },
422
+ "2": { name: "output_2" },
423
+ "3": { name: "output_3" },
424
+ },
425
+ },
426
+ },
427
+ "math/transpose": getSimpleInputMapping("FlowGraphTransposeBlock" /* FlowGraphBlockNames.Transpose */),
428
+ "math/determinant": getSimpleInputMapping("FlowGraphDeterminantBlock" /* FlowGraphBlockNames.Determinant */),
429
+ "math/inverse": getSimpleInputMapping("FlowGraphInvertMatrixBlock" /* FlowGraphBlockNames.InvertMatrix */),
430
+ "math/matMul": getSimpleInputMapping("FlowGraphMatrixMultiplicationBlock" /* FlowGraphBlockNames.MatrixMultiplication */, ["a", "b"]),
431
+ "math/matCompose": {
432
+ blocks: ["FlowGraphMatrixCompose" /* FlowGraphBlockNames.MatrixCompose */],
433
+ inputs: {
434
+ values: {
435
+ translation: { name: "position", gltfType: "float3" },
436
+ rotation: { name: "rotationQuaternion", gltfType: "float4" },
437
+ scale: { name: "scaling", gltfType: "float3" },
438
+ },
439
+ },
440
+ outputs: {
441
+ values: {
442
+ value: { name: "value" },
443
+ },
444
+ },
445
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
446
+ // configure it to work the way glTF specifies
447
+ const d = serializedObjects[0].dataInputs.find((input) => input.name === "rotationQuaternion");
448
+ if (!d) {
449
+ throw new Error("Rotation quaternion input not found");
450
+ }
451
+ // if value is defined, set the type to quaternion
452
+ if (context._connectionValues[d.uniqueId]) {
453
+ context._connectionValues[d.uniqueId].type = "Quaternion" /* FlowGraphTypes.Quaternion */;
454
+ }
455
+ return serializedObjects;
456
+ },
457
+ },
458
+ "math/matDecompose": {
459
+ blocks: ["FlowGraphMatrixDecompose" /* FlowGraphBlockNames.MatrixDecompose */],
460
+ inputs: {
461
+ values: {
462
+ a: { name: "input", gltfType: "number" },
463
+ },
464
+ },
465
+ outputs: {
466
+ values: {
467
+ translation: { name: "position" },
468
+ rotation: { name: "rotationQuaternion" },
469
+ scale: { name: "scaling" },
470
+ },
471
+ },
472
+ },
473
+ "math/quatConjugate": getSimpleInputMapping("FlowGraphConjugateBlock" /* FlowGraphBlockNames.Conjugate */, ["a"]),
474
+ "math/quatMul": {
475
+ blocks: ["FlowGraphMultiplyBlock" /* FlowGraphBlockNames.Multiply */],
476
+ inputs: {
477
+ values: {
478
+ a: { name: "a", gltfType: "vector4" },
479
+ b: { name: "b", gltfType: "vector4" },
480
+ },
481
+ },
482
+ outputs: {
483
+ values: {
484
+ value: { name: "value" },
485
+ },
486
+ },
487
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
488
+ var _a;
489
+ (_a = serializedObjects[0]).config || (_a.config = {});
490
+ serializedObjects[0].config.type = "Quaternion" /* FlowGraphTypes.Quaternion */;
491
+ return serializedObjects;
492
+ },
493
+ },
494
+ "math/quatAngleBetween": getSimpleInputMapping("FlowGraphAngleBetweenBlock" /* FlowGraphBlockNames.AngleBetween */, ["a", "b"]),
495
+ "math/quatFromAxisAngle": {
496
+ blocks: ["FlowGraphQuaternionFromAxisAngleBlock" /* FlowGraphBlockNames.QuaternionFromAxisAngle */],
497
+ inputs: {
498
+ values: {
499
+ axis: { name: "a", gltfType: "float3" },
500
+ angle: { name: "b", gltfType: "number" },
501
+ },
502
+ },
503
+ outputs: {
504
+ values: {
505
+ value: { name: "value" },
506
+ },
507
+ },
508
+ },
509
+ "math/quatToAxisAngle": getSimpleInputMapping("FlowGraphAxisAngleFromQuaternionBlock" /* FlowGraphBlockNames.AxisAngleFromQuaternion */, ["a"]),
510
+ "math/quatFromDirections": getSimpleInputMapping("FlowGraphQuaternionFromDirectionsBlock" /* FlowGraphBlockNames.QuaternionFromDirections */, ["a", "b"]),
511
+ "math/combine2x2": {
512
+ blocks: ["FlowGraphCombineMatrix2DBlock" /* FlowGraphBlockNames.CombineMatrix2D */],
513
+ inputs: {
514
+ values: {
515
+ a: { name: "input_0", gltfType: "number" },
516
+ b: { name: "input_1", gltfType: "number" },
517
+ c: { name: "input_2", gltfType: "number" },
518
+ d: { name: "input_3", gltfType: "number" },
519
+ },
520
+ },
521
+ outputs: {
522
+ values: {
523
+ value: { name: "value" },
524
+ },
525
+ },
526
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
527
+ var _a;
528
+ // configure it to work the way glTF specifies
529
+ (_a = serializedObjects[0]).config || (_a.config = {});
530
+ serializedObjects[0].config.inputIsColumnMajor = true;
531
+ return serializedObjects;
532
+ },
533
+ },
534
+ "math/extract2x2": {
535
+ blocks: ["FlowGraphExtractMatrix2DBlock" /* FlowGraphBlockNames.ExtractMatrix2D */],
536
+ inputs: {
537
+ values: {
538
+ a: { name: "input", gltfType: "float2x2" },
539
+ },
540
+ },
541
+ outputs: {
542
+ values: {
543
+ "0": { name: "output_0" },
544
+ "1": { name: "output_1" },
545
+ "2": { name: "output_2" },
546
+ "3": { name: "output_3" },
547
+ },
548
+ },
549
+ },
550
+ "math/combine3x3": {
551
+ blocks: ["FlowGraphCombineMatrix3DBlock" /* FlowGraphBlockNames.CombineMatrix3D */],
552
+ inputs: {
553
+ values: {
554
+ a: { name: "input_0", gltfType: "number" },
555
+ b: { name: "input_1", gltfType: "number" },
556
+ c: { name: "input_2", gltfType: "number" },
557
+ d: { name: "input_3", gltfType: "number" },
558
+ e: { name: "input_4", gltfType: "number" },
559
+ f: { name: "input_5", gltfType: "number" },
560
+ g: { name: "input_6", gltfType: "number" },
561
+ h: { name: "input_7", gltfType: "number" },
562
+ i: { name: "input_8", gltfType: "number" },
563
+ },
564
+ },
565
+ outputs: {
566
+ values: {
567
+ value: { name: "value" },
568
+ },
569
+ },
570
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
571
+ var _a;
572
+ // configure it to work the way glTF specifies
573
+ (_a = serializedObjects[0]).config || (_a.config = {});
574
+ serializedObjects[0].config.inputIsColumnMajor = true;
575
+ return serializedObjects;
576
+ },
577
+ },
578
+ "math/extract3x3": {
579
+ blocks: ["FlowGraphExtractMatrix3DBlock" /* FlowGraphBlockNames.ExtractMatrix3D */],
580
+ inputs: {
581
+ values: {
582
+ a: { name: "input", gltfType: "float3x3" },
583
+ },
584
+ },
585
+ outputs: {
586
+ values: {
587
+ "0": { name: "output_0" },
588
+ "1": { name: "output_1" },
589
+ "2": { name: "output_2" },
590
+ "3": { name: "output_3" },
591
+ "4": { name: "output_4" },
592
+ "5": { name: "output_5" },
593
+ "6": { name: "output_6" },
594
+ "7": { name: "output_7" },
595
+ "8": { name: "output_8" },
596
+ },
597
+ },
598
+ },
599
+ "math/combine4x4": {
600
+ blocks: ["FlowGraphCombineMatrixBlock" /* FlowGraphBlockNames.CombineMatrix */],
601
+ inputs: {
602
+ values: {
603
+ a: { name: "input_0", gltfType: "number" },
604
+ b: { name: "input_1", gltfType: "number" },
605
+ c: { name: "input_2", gltfType: "number" },
606
+ d: { name: "input_3", gltfType: "number" },
607
+ e: { name: "input_4", gltfType: "number" },
608
+ f: { name: "input_5", gltfType: "number" },
609
+ g: { name: "input_6", gltfType: "number" },
610
+ h: { name: "input_7", gltfType: "number" },
611
+ i: { name: "input_8", gltfType: "number" },
612
+ j: { name: "input_9", gltfType: "number" },
613
+ k: { name: "input_10", gltfType: "number" },
614
+ l: { name: "input_11", gltfType: "number" },
615
+ m: { name: "input_12", gltfType: "number" },
616
+ n: { name: "input_13", gltfType: "number" },
617
+ o: { name: "input_14", gltfType: "number" },
618
+ p: { name: "input_15", gltfType: "number" },
619
+ },
620
+ },
621
+ outputs: {
622
+ values: {
623
+ value: { name: "value" },
624
+ },
625
+ },
626
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
627
+ var _a;
628
+ // configure it to work the way glTF specifies
629
+ (_a = serializedObjects[0]).config || (_a.config = {});
630
+ serializedObjects[0].config.inputIsColumnMajor = true;
631
+ return serializedObjects;
632
+ },
633
+ },
634
+ "math/extract4x4": {
635
+ blocks: ["FlowGraphExtractMatrixBlock" /* FlowGraphBlockNames.ExtractMatrix */],
636
+ configuration: {},
637
+ inputs: {
638
+ values: {
639
+ a: { name: "input", gltfType: "number" },
640
+ },
641
+ },
642
+ outputs: {
643
+ values: {
644
+ "0": { name: "output_0" },
645
+ "1": { name: "output_1" },
646
+ "2": { name: "output_2" },
647
+ "3": { name: "output_3" },
648
+ "4": { name: "output_4" },
649
+ "5": { name: "output_5" },
650
+ "6": { name: "output_6" },
651
+ "7": { name: "output_7" },
652
+ "8": { name: "output_8" },
653
+ "9": { name: "output_9" },
654
+ "10": { name: "output_10" },
655
+ "11": { name: "output_11" },
656
+ "12": { name: "output_12" },
657
+ "13": { name: "output_13" },
658
+ "14": { name: "output_14" },
659
+ "15": { name: "output_15" },
660
+ },
661
+ },
662
+ },
663
+ "math/not": {
664
+ blocks: ["FlowGraphBitwiseNotBlock" /* FlowGraphBlockNames.BitwiseNot */],
665
+ inputs: {
666
+ values: {
667
+ a: { name: "a" },
668
+ },
669
+ },
670
+ outputs: {
671
+ values: {
672
+ value: { name: "value" },
673
+ },
674
+ },
675
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
676
+ var _a;
677
+ // configure it to work the way glTF specifies
678
+ (_a = serializedObjects[0]).config || (_a.config = {});
679
+ // try to infer the type or fallback to Integer
680
+ const socketIn = serializedObjects[0].dataInputs[0];
681
+ serializedObjects[0].config.valueType = context._connectionValues[socketIn.uniqueId]?.type ?? "FlowGraphInteger" /* FlowGraphTypes.Integer */;
682
+ return serializedObjects;
683
+ },
684
+ },
685
+ "math/and": {
686
+ blocks: ["FlowGraphBitwiseAndBlock" /* FlowGraphBlockNames.BitwiseAnd */],
687
+ inputs: {
688
+ values: {
689
+ a: { name: "a" },
690
+ b: { name: "b" },
691
+ },
692
+ },
693
+ outputs: {
694
+ values: {
695
+ value: { name: "value" },
696
+ },
697
+ },
698
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
699
+ var _a;
700
+ // configure it to work the way glTF specifies
701
+ (_a = serializedObjects[0]).config || (_a.config = {});
702
+ // try to infer the type or fallback to Integer
703
+ const socketInA = serializedObjects[0].dataInputs[0];
704
+ const socketInB = serializedObjects[0].dataInputs[1];
705
+ serializedObjects[0].config.valueType =
706
+ context._connectionValues[socketInA.uniqueId]?.type ?? context._connectionValues[socketInB.uniqueId]?.type ?? "FlowGraphInteger" /* FlowGraphTypes.Integer */;
707
+ return serializedObjects;
708
+ },
709
+ },
710
+ "math/or": {
711
+ blocks: ["FlowGraphBitwiseOrBlock" /* FlowGraphBlockNames.BitwiseOr */],
712
+ inputs: {
713
+ values: {
714
+ a: { name: "a" },
715
+ b: { name: "b" },
716
+ },
717
+ },
718
+ outputs: {
719
+ values: {
720
+ value: { name: "value" },
721
+ },
722
+ },
723
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
724
+ var _a;
725
+ // configure it to work the way glTF specifies
726
+ (_a = serializedObjects[0]).config || (_a.config = {});
727
+ // try to infer the type or fallback to Integer
728
+ const socketInA = serializedObjects[0].dataInputs[0];
729
+ const socketInB = serializedObjects[0].dataInputs[1];
730
+ serializedObjects[0].config.valueType =
731
+ context._connectionValues[socketInA.uniqueId]?.type ?? context._connectionValues[socketInB.uniqueId]?.type ?? "FlowGraphInteger" /* FlowGraphTypes.Integer */;
732
+ return serializedObjects;
733
+ },
734
+ },
735
+ "math/xor": {
736
+ blocks: ["FlowGraphBitwiseXorBlock" /* FlowGraphBlockNames.BitwiseXor */],
737
+ inputs: {
738
+ values: {
739
+ a: { name: "a" },
740
+ b: { name: "b" },
741
+ },
742
+ },
743
+ outputs: {
744
+ values: {
745
+ value: { name: "value" },
746
+ },
747
+ },
748
+ extraProcessor(_gltfBlock, _declaration, _mapping, _parser, serializedObjects, context) {
749
+ var _a;
750
+ // configure it to work the way glTF specifies
751
+ (_a = serializedObjects[0]).config || (_a.config = {});
752
+ // try to infer the type or fallback to Integer
753
+ const socketInA = serializedObjects[0].dataInputs[0];
754
+ const socketInB = serializedObjects[0].dataInputs[1];
755
+ serializedObjects[0].config.valueType =
756
+ context._connectionValues[socketInA.uniqueId]?.type ?? context._connectionValues[socketInB.uniqueId]?.type ?? "FlowGraphInteger" /* FlowGraphTypes.Integer */;
757
+ return serializedObjects;
758
+ },
759
+ },
760
+ "math/asr": getSimpleInputMapping("FlowGraphBitwiseRightShiftBlock" /* FlowGraphBlockNames.BitwiseRightShift */, ["a", "b"]),
761
+ "math/lsl": getSimpleInputMapping("FlowGraphBitwiseLeftShiftBlock" /* FlowGraphBlockNames.BitwiseLeftShift */, ["a", "b"]),
762
+ "math/clz": getSimpleInputMapping("FlowGraphLeadingZerosBlock" /* FlowGraphBlockNames.LeadingZeros */),
763
+ "math/ctz": getSimpleInputMapping("FlowGraphTrailingZerosBlock" /* FlowGraphBlockNames.TrailingZeros */),
764
+ "math/popcnt": getSimpleInputMapping("FlowGraphOneBitsCounterBlock" /* FlowGraphBlockNames.OneBitsCounter */),
765
+ "math/rad": getSimpleInputMapping("FlowGraphDegToRadBlock" /* FlowGraphBlockNames.DegToRad */),
766
+ "math/deg": getSimpleInputMapping("FlowGraphRadToDegBlock" /* FlowGraphBlockNames.RadToDeg */),
767
+ "type/boolToInt": getSimpleInputMapping("FlowGraphBooleanToInt" /* FlowGraphBlockNames.BooleanToInt */),
768
+ "type/boolToFloat": getSimpleInputMapping("FlowGraphBooleanToFloat" /* FlowGraphBlockNames.BooleanToFloat */),
769
+ "type/intToBool": getSimpleInputMapping("FlowGraphIntToBoolean" /* FlowGraphBlockNames.IntToBoolean */),
770
+ "type/intToFloat": getSimpleInputMapping("FlowGraphIntToFloat" /* FlowGraphBlockNames.IntToFloat */),
771
+ "type/floatToInt": getSimpleInputMapping("FlowGraphFloatToInt" /* FlowGraphBlockNames.FloatToInt */),
772
+ "type/floatToBool": getSimpleInputMapping("FlowGraphFloatToBoolean" /* FlowGraphBlockNames.FloatToBoolean */),
773
+ // flows
774
+ "flow/sequence": {
775
+ blocks: ["FlowGraphSequenceBlock" /* FlowGraphBlockNames.Sequence */],
776
+ extraProcessor(gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
777
+ const serializedObject = serializedObjects[0];
778
+ serializedObject.config || (serializedObject.config = {});
779
+ serializedObject.config.outputSignalCount = Object.keys(gltfBlock.flows || []).length;
780
+ serializedObject.signalOutputs.forEach((output, index) => {
781
+ output.name = "out_" + index;
782
+ });
783
+ return serializedObjects;
784
+ },
785
+ },
786
+ "flow/branch": {
787
+ blocks: ["FlowGraphBranchBlock" /* FlowGraphBlockNames.Branch */],
788
+ outputs: {
789
+ flows: {
790
+ true: { name: "onTrue" },
791
+ false: { name: "onFalse" },
792
+ },
793
+ },
794
+ },
795
+ "flow/switch": {
796
+ blocks: ["FlowGraphSwitchBlock" /* FlowGraphBlockNames.Switch */],
797
+ configuration: {
798
+ cases: { name: "cases", inOptions: true, defaultValue: [] },
799
+ },
800
+ inputs: {
801
+ values: {
802
+ selection: { name: "case" },
803
+ default: { name: "default" },
804
+ },
805
+ },
806
+ validation(gltfBlock) {
807
+ if (gltfBlock.configuration && gltfBlock.configuration.cases) {
808
+ const cases = gltfBlock.configuration.cases.value;
809
+ const onlyIntegers = cases.every((caseValue) => {
810
+ // case value should be an integer. Since Number.isInteger(1.0) is true, we need to check if toString has only digits.
811
+ return typeof caseValue === "number" && /^-?\d+$/.test(caseValue.toString());
812
+ });
813
+ if (!onlyIntegers) {
814
+ Logger.Warn("Switch cases should be integers. Using empty array instead.");
815
+ gltfBlock.configuration.cases.value = [];
816
+ return { valid: true };
817
+ }
818
+ // check for duplicates
819
+ const uniqueCases = new Set(cases);
820
+ gltfBlock.configuration.cases.value = Array.from(uniqueCases);
821
+ }
822
+ return { valid: true };
823
+ },
824
+ extraProcessor(gltfBlock, declaration, _mapping, _arrays, serializedObjects) {
825
+ // convert all names of output flow to out_$1 apart from "default"
826
+ if (declaration.op !== "flow/switch" || !gltfBlock.flows || Object.keys(gltfBlock.flows).length === 0) {
827
+ throw new Error("Switch should have a single configuration object, the cases array");
828
+ }
829
+ const serializedObject = serializedObjects[0];
830
+ serializedObject.signalOutputs.forEach((output) => {
831
+ if (output.name !== "default") {
832
+ output.name = "out_" + output.name;
833
+ }
834
+ });
835
+ return serializedObjects;
836
+ },
837
+ },
838
+ "flow/while": {
839
+ blocks: ["FlowGraphWhileLoopBlock" /* FlowGraphBlockNames.WhileLoop */],
840
+ outputs: {
841
+ flows: {
842
+ loopBody: { name: "executionFlow" },
843
+ },
844
+ },
845
+ },
846
+ "flow/for": {
847
+ blocks: ["FlowGraphForLoopBlock" /* FlowGraphBlockNames.ForLoop */],
848
+ configuration: {
849
+ initialIndex: { name: "initialIndex", gltfType: "number", inOptions: true, defaultValue: 0 },
850
+ },
851
+ inputs: {
852
+ values: {
853
+ startIndex: { name: "startIndex", gltfType: "number" },
854
+ endIndex: { name: "endIndex", gltfType: "number" },
855
+ },
856
+ },
857
+ outputs: {
858
+ values: {
859
+ index: { name: "index" },
860
+ },
861
+ flows: {
862
+ loopBody: { name: "executionFlow" },
863
+ },
864
+ },
865
+ extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
866
+ const serializedObject = serializedObjects[0];
867
+ serializedObject.config || (serializedObject.config = {});
868
+ serializedObject.config.incrementIndexWhenLoopDone = true;
869
+ return serializedObjects;
870
+ },
871
+ },
872
+ "flow/doN": {
873
+ blocks: ["FlowGraphDoNBlock" /* FlowGraphBlockNames.DoN */],
874
+ configuration: {},
875
+ inputs: {
876
+ values: {
877
+ n: { name: "maxExecutions", gltfType: "number" },
878
+ },
879
+ },
880
+ outputs: {
881
+ values: {
882
+ currentCount: { name: "executionCount" },
883
+ },
884
+ },
885
+ },
886
+ "flow/multiGate": {
887
+ blocks: ["FlowGraphMultiGateBlock" /* FlowGraphBlockNames.MultiGate */],
888
+ configuration: {
889
+ isRandom: { name: "isRandom", gltfType: "boolean", inOptions: true, defaultValue: false },
890
+ isLoop: { name: "isLoop", gltfType: "boolean", inOptions: true, defaultValue: false },
891
+ },
892
+ extraProcessor(gltfBlock, declaration, _mapping, _arrays, serializedObjects) {
893
+ if (declaration.op !== "flow/multiGate" || !gltfBlock.flows || Object.keys(gltfBlock.flows).length === 0) {
894
+ throw new Error("MultiGate should have a single configuration object, the number of output flows");
895
+ }
896
+ const serializedObject = serializedObjects[0];
897
+ serializedObject.config || (serializedObject.config = {});
898
+ serializedObject.config.outputSignalCount = Object.keys(gltfBlock.flows).length;
899
+ serializedObject.signalOutputs.forEach((output, index) => {
900
+ output.name = "out_" + index;
901
+ });
902
+ return serializedObjects;
903
+ },
904
+ },
905
+ "flow/waitAll": {
906
+ blocks: ["FlowGraphWaitAllBlock" /* FlowGraphBlockNames.WaitAll */],
907
+ configuration: {
908
+ inputFlows: { name: "inputSignalCount", gltfType: "number", inOptions: true, defaultValue: 0 },
909
+ },
910
+ inputs: {
911
+ flows: {
912
+ reset: { name: "reset" },
913
+ "[segment]": { name: "in_$1" },
914
+ },
915
+ },
916
+ validation(gltfBlock) {
917
+ // check that the configuration value is an integer
918
+ if (typeof gltfBlock.configuration?.inputFlows?.value[0] !== "number") {
919
+ gltfBlock.configuration = gltfBlock.configuration || {
920
+ inputFlows: { value: [0] },
921
+ };
922
+ gltfBlock.configuration.inputFlows.value = [0];
923
+ }
924
+ return { valid: true };
925
+ },
926
+ },
927
+ "flow/throttle": {
928
+ blocks: ["FlowGraphThrottleBlock" /* FlowGraphBlockNames.Throttle */],
929
+ outputs: {
930
+ flows: {
931
+ err: { name: "error" },
932
+ },
933
+ },
934
+ },
935
+ "flow/setDelay": {
936
+ blocks: ["FlowGraphSetDelayBlock" /* FlowGraphBlockNames.SetDelay */],
937
+ outputs: {
938
+ flows: {
939
+ err: { name: "error" },
940
+ },
941
+ },
942
+ },
943
+ "flow/cancelDelay": {
944
+ blocks: ["FlowGraphCancelDelayBlock" /* FlowGraphBlockNames.CancelDelay */],
945
+ },
946
+ "variable/get": {
947
+ blocks: ["FlowGraphGetVariableBlock" /* FlowGraphBlockNames.GetVariable */],
948
+ validation(gltfBlock) {
949
+ if (!gltfBlock.configuration?.variable?.value) {
950
+ Logger.Error("Variable get block should have a variable configuration");
951
+ return { valid: false, error: "Variable get block should have a variable configuration" };
952
+ }
953
+ return { valid: true };
954
+ },
955
+ configuration: {
956
+ variable: {
957
+ name: "variable",
958
+ gltfType: "number",
959
+ flowGraphType: "string",
960
+ inOptions: true,
961
+ isVariable: true,
962
+ dataTransformer(index, parser) {
963
+ return [parser.getVariableName(index[0])];
964
+ },
965
+ },
966
+ },
967
+ },
968
+ "variable/set": {
969
+ blocks: ["FlowGraphSetVariableBlock" /* FlowGraphBlockNames.SetVariable */],
970
+ configuration: {
971
+ variable: {
972
+ name: "variable",
973
+ gltfType: "number",
974
+ flowGraphType: "string",
975
+ inOptions: true,
976
+ isVariable: true,
977
+ dataTransformer(index, parser) {
978
+ return [parser.getVariableName(index[0])];
979
+ },
980
+ },
981
+ },
982
+ },
983
+ "variable/setMultiple": {
984
+ blocks: ["FlowGraphSetVariableBlock" /* FlowGraphBlockNames.SetVariable */],
985
+ configuration: {
986
+ variables: {
987
+ name: "variables",
988
+ gltfType: "number",
989
+ flowGraphType: "string",
990
+ inOptions: true,
991
+ dataTransformer(index, parser) {
992
+ return [index[0].map((i) => parser.getVariableName(i))];
993
+ },
994
+ },
995
+ },
996
+ extraProcessor(_gltfBlock, _declaration, _mapping, parser, serializedObjects) {
997
+ // variable/get configuration
998
+ const serializedGetVariable = serializedObjects[0];
999
+ serializedGetVariable.dataInputs.forEach((input) => {
1000
+ input.name = parser.getVariableName(+input.name);
1001
+ });
1002
+ return serializedObjects;
1003
+ },
1004
+ },
1005
+ "variable/interpolate": {
1006
+ blocks: [
1007
+ "FlowGraphInterpolationBlock" /* FlowGraphBlockNames.ValueInterpolation */,
1008
+ "FlowGraphContextBlock" /* FlowGraphBlockNames.Context */,
1009
+ "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */,
1010
+ "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */,
1011
+ "FlowGraphGetVariableBlock" /* FlowGraphBlockNames.GetVariable */,
1012
+ ],
1013
+ configuration: {
1014
+ variable: {
1015
+ name: "propertyName",
1016
+ inOptions: true,
1017
+ isVariable: true,
1018
+ dataTransformer(index, parser) {
1019
+ return [parser.getVariableName(index[0])];
1020
+ },
1021
+ },
1022
+ useSlerp: {
1023
+ name: "animationType",
1024
+ inOptions: true,
1025
+ defaultValue: false,
1026
+ dataTransformer: (value) => {
1027
+ if (value[0] === true) {
1028
+ return ["Quaternion" /* FlowGraphTypes.Quaternion */];
1029
+ }
1030
+ else {
1031
+ return [undefined];
1032
+ }
1033
+ },
1034
+ },
1035
+ },
1036
+ inputs: {
1037
+ values: {
1038
+ value: { name: "value_1" },
1039
+ duration: { name: "duration_1", gltfType: "number" },
1040
+ p1: { name: "controlPoint1", toBlock: "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */ },
1041
+ p2: { name: "controlPoint2", toBlock: "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */ },
1042
+ },
1043
+ flows: {
1044
+ in: { name: "in", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1045
+ },
1046
+ },
1047
+ outputs: {
1048
+ flows: {
1049
+ err: { name: "error", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1050
+ out: { name: "out", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1051
+ done: { name: "done", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1052
+ },
1053
+ },
1054
+ interBlockConnectors: [
1055
+ {
1056
+ input: "object",
1057
+ output: "userVariables",
1058
+ inputBlockIndex: 2,
1059
+ outputBlockIndex: 1,
1060
+ isVariable: true,
1061
+ },
1062
+ {
1063
+ input: "animation",
1064
+ output: "animation",
1065
+ inputBlockIndex: 2,
1066
+ outputBlockIndex: 0,
1067
+ isVariable: true,
1068
+ },
1069
+ {
1070
+ input: "easingFunction",
1071
+ output: "easingFunction",
1072
+ inputBlockIndex: 0,
1073
+ outputBlockIndex: 3,
1074
+ isVariable: true,
1075
+ },
1076
+ {
1077
+ input: "value_0",
1078
+ output: "value",
1079
+ inputBlockIndex: 0,
1080
+ outputBlockIndex: 4,
1081
+ isVariable: true,
1082
+ },
1083
+ ],
1084
+ extraProcessor(gltfBlock, _declaration, _mapping, parser, serializedObjects) {
1085
+ var _a, _b;
1086
+ // is useSlerp is used, animationType should be set to be quaternion!
1087
+ const serializedValueInterpolation = serializedObjects[0];
1088
+ const propertyIndex = gltfBlock.configuration?.variable.value[0];
1089
+ if (typeof propertyIndex !== "number") {
1090
+ Logger.Error("Variable index is not defined for variable interpolation block");
1091
+ throw new Error("Variable index is not defined for variable interpolation block");
1092
+ }
1093
+ const variable = parser.arrays.staticVariables[propertyIndex];
1094
+ // if not set by useSlerp
1095
+ if (typeof serializedValueInterpolation.config.animationType.value === "undefined") {
1096
+ // get the value type
1097
+ parser.arrays.staticVariables;
1098
+ serializedValueInterpolation.config.animationType.value = getAnimationTypeByFlowGraphType(variable.type);
1099
+ }
1100
+ // variable/get configuration
1101
+ const serializedGetVariable = serializedObjects[4];
1102
+ serializedGetVariable.config || (serializedGetVariable.config = {});
1103
+ (_a = serializedGetVariable.config).variable || (_a.variable = {});
1104
+ serializedGetVariable.config.variable.value = parser.getVariableName(propertyIndex);
1105
+ // get the control points from the easing block
1106
+ (_b = serializedObjects[3]).config || (_b.config = {});
1107
+ return serializedObjects;
1108
+ },
1109
+ },
1110
+ "pointer/get": {
1111
+ blocks: ["FlowGraphGetPropertyBlock" /* FlowGraphBlockNames.GetProperty */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */],
1112
+ configuration: {
1113
+ pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1114
+ },
1115
+ inputs: {
1116
+ values: {
1117
+ "[segment]": { name: "$1", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1118
+ },
1119
+ },
1120
+ interBlockConnectors: [
1121
+ {
1122
+ input: "object",
1123
+ output: "object",
1124
+ inputBlockIndex: 0,
1125
+ outputBlockIndex: 1,
1126
+ isVariable: true,
1127
+ },
1128
+ {
1129
+ input: "propertyName",
1130
+ output: "propertyName",
1131
+ inputBlockIndex: 0,
1132
+ outputBlockIndex: 1,
1133
+ isVariable: true,
1134
+ },
1135
+ {
1136
+ input: "customGetFunction",
1137
+ output: "getFunction",
1138
+ inputBlockIndex: 0,
1139
+ outputBlockIndex: 1,
1140
+ isVariable: true,
1141
+ },
1142
+ ],
1143
+ extraProcessor(gltfBlock, _declaration, _mapping, parser, serializedObjects) {
1144
+ serializedObjects.forEach((serializedObject) => {
1145
+ // check if it is the json pointer block
1146
+ if (serializedObject.className === "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */) {
1147
+ serializedObject.config || (serializedObject.config = {});
1148
+ serializedObject.config.outputValue = true;
1149
+ }
1150
+ });
1151
+ return serializedObjects;
1152
+ },
1153
+ },
1154
+ "pointer/set": {
1155
+ blocks: ["FlowGraphSetPropertyBlock" /* FlowGraphBlockNames.SetProperty */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */],
1156
+ configuration: {
1157
+ pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1158
+ },
1159
+ inputs: {
1160
+ values: {
1161
+ // must be defined due to the array taking over
1162
+ value: { name: "value" },
1163
+ "[segment]": { name: "$1", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1164
+ },
1165
+ },
1166
+ outputs: {
1167
+ flows: {
1168
+ err: { name: "error" },
1169
+ },
1170
+ },
1171
+ interBlockConnectors: [
1172
+ {
1173
+ input: "object",
1174
+ output: "object",
1175
+ inputBlockIndex: 0,
1176
+ outputBlockIndex: 1,
1177
+ isVariable: true,
1178
+ },
1179
+ {
1180
+ input: "propertyName",
1181
+ output: "propertyName",
1182
+ inputBlockIndex: 0,
1183
+ outputBlockIndex: 1,
1184
+ isVariable: true,
1185
+ },
1186
+ {
1187
+ input: "customSetFunction",
1188
+ output: "setFunction",
1189
+ inputBlockIndex: 0,
1190
+ outputBlockIndex: 1,
1191
+ isVariable: true,
1192
+ },
1193
+ ],
1194
+ extraProcessor(gltfBlock, _declaration, _mapping, parser, serializedObjects) {
1195
+ serializedObjects.forEach((serializedObject) => {
1196
+ // check if it is the json pointer block
1197
+ if (serializedObject.className === "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */) {
1198
+ serializedObject.config || (serializedObject.config = {});
1199
+ serializedObject.config.outputValue = true;
1200
+ }
1201
+ });
1202
+ return serializedObjects;
1203
+ },
1204
+ },
1205
+ "pointer/interpolate": {
1206
+ // interpolate, parse the pointer and play the animation generated. 3 blocks!
1207
+ blocks: ["FlowGraphInterpolationBlock" /* FlowGraphBlockNames.ValueInterpolation */, "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */, "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */],
1208
+ configuration: {
1209
+ pointer: { name: "jsonPointer", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1210
+ },
1211
+ inputs: {
1212
+ values: {
1213
+ value: { name: "value_1" },
1214
+ "[segment]": { name: "$1", toBlock: "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */ },
1215
+ duration: { name: "duration_1", gltfType: "number" /*, inOptions: true */ },
1216
+ p1: { name: "controlPoint1", toBlock: "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */ },
1217
+ p2: { name: "controlPoint2", toBlock: "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */ },
1218
+ },
1219
+ flows: {
1220
+ in: { name: "in", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1221
+ },
1222
+ },
1223
+ outputs: {
1224
+ flows: {
1225
+ err: { name: "error", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1226
+ out: { name: "out", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1227
+ done: { name: "done", toBlock: "FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */ },
1228
+ },
1229
+ },
1230
+ interBlockConnectors: [
1231
+ {
1232
+ input: "object",
1233
+ output: "object",
1234
+ inputBlockIndex: 2,
1235
+ outputBlockIndex: 1,
1236
+ isVariable: true,
1237
+ },
1238
+ {
1239
+ input: "propertyName",
1240
+ output: "propertyName",
1241
+ inputBlockIndex: 0,
1242
+ outputBlockIndex: 1,
1243
+ isVariable: true,
1244
+ },
1245
+ {
1246
+ input: "customBuildAnimation",
1247
+ output: "generateAnimationsFunction",
1248
+ inputBlockIndex: 0,
1249
+ outputBlockIndex: 1,
1250
+ isVariable: true,
1251
+ },
1252
+ {
1253
+ input: "animation",
1254
+ output: "animation",
1255
+ inputBlockIndex: 2,
1256
+ outputBlockIndex: 0,
1257
+ isVariable: true,
1258
+ },
1259
+ {
1260
+ input: "easingFunction",
1261
+ output: "easingFunction",
1262
+ inputBlockIndex: 0,
1263
+ outputBlockIndex: 3,
1264
+ isVariable: true,
1265
+ },
1266
+ {
1267
+ input: "value_0",
1268
+ output: "value",
1269
+ inputBlockIndex: 0,
1270
+ outputBlockIndex: 1,
1271
+ isVariable: true,
1272
+ },
1273
+ ],
1274
+ extraProcessor(gltfBlock, _declaration, _mapping, parser, serializedObjects) {
1275
+ serializedObjects.forEach((serializedObject) => {
1276
+ // check if it is the json pointer block
1277
+ if (serializedObject.className === "FlowGraphJsonPointerParserBlock" /* FlowGraphBlockNames.JsonPointerParser */) {
1278
+ serializedObject.config || (serializedObject.config = {});
1279
+ serializedObject.config.outputValue = true;
1280
+ }
1281
+ else if (serializedObject.className === "FlowGraphInterpolationBlock" /* FlowGraphBlockNames.ValueInterpolation */) {
1282
+ serializedObject.config || (serializedObject.config = {});
1283
+ Object.keys(gltfBlock.values || []).forEach((key) => {
1284
+ const value = gltfBlock.values?.[key];
1285
+ if (key === "value" && value) {
1286
+ // get the type of the value
1287
+ const type = value.type;
1288
+ if (type !== undefined) {
1289
+ serializedObject.config.animationType = parser.arrays.types[type].flowGraphType;
1290
+ }
1291
+ }
1292
+ });
1293
+ }
1294
+ });
1295
+ return serializedObjects;
1296
+ },
1297
+ },
1298
+ "animation/start": {
1299
+ blocks: ["FlowGraphPlayAnimationBlock" /* FlowGraphBlockNames.PlayAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
1300
+ inputs: {
1301
+ values: {
1302
+ animation: { name: "index", gltfType: "number", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1303
+ speed: { name: "speed", gltfType: "number" },
1304
+ startTime: { name: "from", gltfType: "number", dataTransformer: (time, parser) => [time[0] * parser._animationTargetFps] },
1305
+ endTime: { name: "to", gltfType: "number", dataTransformer: (time, parser) => [time[0] * parser._animationTargetFps] },
1306
+ },
1307
+ },
1308
+ outputs: {
1309
+ flows: {
1310
+ err: { name: "error" },
1311
+ },
1312
+ },
1313
+ interBlockConnectors: [
1314
+ {
1315
+ input: "animationGroup",
1316
+ output: "value",
1317
+ inputBlockIndex: 0,
1318
+ outputBlockIndex: 1,
1319
+ isVariable: true,
1320
+ },
1321
+ {
1322
+ input: "array",
1323
+ output: "animationGroups",
1324
+ inputBlockIndex: 1,
1325
+ outputBlockIndex: 2,
1326
+ isVariable: true,
1327
+ },
1328
+ ],
1329
+ extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
1330
+ // add the glTF to the configuration of the last serialized object
1331
+ const serializedObject = serializedObjects[serializedObjects.length - 1];
1332
+ serializedObject.config || (serializedObject.config = {});
1333
+ serializedObject.config.glTF = globalGLTF;
1334
+ return serializedObjects;
1335
+ },
1336
+ },
1337
+ "animation/stop": {
1338
+ blocks: ["FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
1339
+ inputs: {
1340
+ values: {
1341
+ animation: { name: "index", gltfType: "number", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1342
+ },
1343
+ },
1344
+ outputs: {
1345
+ flows: {
1346
+ err: { name: "error" },
1347
+ },
1348
+ },
1349
+ interBlockConnectors: [
1350
+ {
1351
+ input: "animationGroup",
1352
+ output: "value",
1353
+ inputBlockIndex: 0,
1354
+ outputBlockIndex: 1,
1355
+ isVariable: true,
1356
+ },
1357
+ {
1358
+ input: "array",
1359
+ output: "animationGroups",
1360
+ inputBlockIndex: 1,
1361
+ outputBlockIndex: 2,
1362
+ isVariable: true,
1363
+ },
1364
+ ],
1365
+ extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
1366
+ // add the glTF to the configuration of the last serialized object
1367
+ const serializedObject = serializedObjects[serializedObjects.length - 1];
1368
+ serializedObject.config || (serializedObject.config = {});
1369
+ serializedObject.config.glTF = globalGLTF;
1370
+ return serializedObjects;
1371
+ },
1372
+ },
1373
+ "animation/stopAt": {
1374
+ blocks: ["FlowGraphStopAnimationBlock" /* FlowGraphBlockNames.StopAnimation */, "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */, "KHR_interactivity/FlowGraphGLTFDataProvider"],
1375
+ configuration: {},
1376
+ inputs: {
1377
+ values: {
1378
+ animation: { name: "index", gltfType: "number", toBlock: "FlowGraphArrayIndexBlock" /* FlowGraphBlockNames.ArrayIndex */ },
1379
+ stopTime: { name: "stopAtFrame", gltfType: "number", dataTransformer: (time, parser) => [time[0] * parser._animationTargetFps] },
1380
+ },
1381
+ },
1382
+ outputs: {
1383
+ flows: {
1384
+ err: { name: "error" },
1385
+ },
1386
+ },
1387
+ interBlockConnectors: [
1388
+ {
1389
+ input: "animationGroup",
1390
+ output: "value",
1391
+ inputBlockIndex: 0,
1392
+ outputBlockIndex: 1,
1393
+ isVariable: true,
1394
+ },
1395
+ {
1396
+ input: "array",
1397
+ output: "animationGroups",
1398
+ inputBlockIndex: 1,
1399
+ outputBlockIndex: 2,
1400
+ isVariable: true,
1401
+ },
1402
+ ],
1403
+ extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects, _context, globalGLTF) {
1404
+ // add the glTF to the configuration of the last serialized object
1405
+ const serializedObject = serializedObjects[serializedObjects.length - 1];
1406
+ serializedObject.config || (serializedObject.config = {});
1407
+ serializedObject.config.glTF = globalGLTF;
1408
+ return serializedObjects;
1409
+ },
1410
+ },
1411
+ "math/switch": {
1412
+ blocks: ["FlowGraphDataSwitchBlock" /* FlowGraphBlockNames.DataSwitch */],
1413
+ configuration: {
1414
+ cases: { name: "cases", inOptions: true, defaultValue: [] },
1415
+ },
1416
+ inputs: {
1417
+ values: {
1418
+ selection: { name: "case" },
1419
+ },
1420
+ },
1421
+ validation(gltfBlock) {
1422
+ if (gltfBlock.configuration && gltfBlock.configuration.cases) {
1423
+ const cases = gltfBlock.configuration.cases.value;
1424
+ const onlyIntegers = cases.every((caseValue) => {
1425
+ // case value should be an integer. Since Number.isInteger(1.0) is true, we need to check if toString has only digits.
1426
+ return typeof caseValue === "number" && /^-?\d+$/.test(caseValue.toString());
1427
+ });
1428
+ if (!onlyIntegers) {
1429
+ Logger.Warn("Switch cases should be integers. Using empty array instead.");
1430
+ gltfBlock.configuration.cases.value = [];
1431
+ return { valid: true };
1432
+ }
1433
+ // check for duplicates
1434
+ const uniqueCases = new Set(cases);
1435
+ gltfBlock.configuration.cases.value = Array.from(uniqueCases);
1436
+ }
1437
+ return { valid: true };
1438
+ },
1439
+ extraProcessor(_gltfBlock, _declaration, _mapping, _arrays, serializedObjects) {
1440
+ const serializedObject = serializedObjects[0];
1441
+ serializedObject.dataInputs.forEach((input) => {
1442
+ if (input.name !== "default" && input.name !== "case") {
1443
+ input.name = "in_" + input.name;
1444
+ }
1445
+ });
1446
+ serializedObject.config || (serializedObject.config = {});
1447
+ serializedObject.config.treatCasesAsIntegers = true;
1448
+ return serializedObjects;
1449
+ },
1450
+ },
1451
+ "debug/log": {
1452
+ blocks: ["FlowGraphConsoleLogBlock" /* FlowGraphBlockNames.ConsoleLog */],
1453
+ configuration: {
1454
+ message: { name: "messageTemplate", inOptions: true },
1455
+ },
1456
+ },
1457
+ };
1458
+ function getSimpleInputMapping(type, inputs = ["a"], inferType) {
1459
+ return {
1460
+ blocks: [type],
1461
+ inputs: {
1462
+ values: inputs.reduce((acc, input) => {
1463
+ acc[input] = { name: input };
1464
+ return acc;
1465
+ }, {}),
1466
+ },
1467
+ outputs: {
1468
+ values: {
1469
+ value: { name: "value" },
1470
+ },
1471
+ },
1472
+ extraProcessor(gltfBlock, _declaration, _mapping, _parser, serializedObjects) {
1473
+ var _a;
1474
+ if (inferType) {
1475
+ // configure it to work the way glTF specifies
1476
+ (_a = serializedObjects[0]).config || (_a.config = {});
1477
+ serializedObjects[0].config.preventIntegerFloatArithmetic = true;
1478
+ // try to infer the type or fallback to Integer
1479
+ // check the gltf block for the inputs, see if they have a type
1480
+ let type = -1;
1481
+ Object.keys(gltfBlock.values || {}).find((value) => {
1482
+ if (gltfBlock.values?.[value].type !== undefined) {
1483
+ type = gltfBlock.values[value].type;
1484
+ return true;
1485
+ }
1486
+ return false;
1487
+ });
1488
+ if (type !== -1) {
1489
+ serializedObjects[0].config.type = _parser.arrays.types[type].flowGraphType;
1490
+ }
1491
+ }
1492
+ return serializedObjects;
1493
+ },
1494
+ validation(gltfBlock) {
1495
+ if (inferType) {
1496
+ // make sure types are the same
1497
+ return ValidateTypes(gltfBlock);
1498
+ }
1499
+ return { valid: true };
1500
+ },
1501
+ };
1502
+ }
1503
+ function ValidateTypes(gltfBlock) {
1504
+ if (gltfBlock.values) {
1505
+ const types = Object.keys(gltfBlock.values)
1506
+ .map((key) => gltfBlock.values[key].type)
1507
+ .filter((type) => type !== undefined);
1508
+ const allSameType = types.every((type) => type === types[0]);
1509
+ if (!allSameType) {
1510
+ return { valid: false, error: "All inputs must be of the same type" };
1511
+ }
1512
+ }
1513
+ return { valid: true };
1514
+ }
1515
+ export function getAllSupportedNativeNodeTypes() {
1516
+ return Object.keys(gltfToFlowGraphMapping);
1517
+ }
1518
+ /**
1519
+ *
1520
+ * These are the nodes from the specs:
1521
+
1522
+ ### Math Nodes
1523
+ 1. **Constants**
1524
+ - E (`math/E`) FlowGraphBlockNames.E
1525
+ - Pi (`math/Pi`) FlowGraphBlockNames.PI
1526
+ - Infinity (`math/Inf`) FlowGraphBlockNames.Inf
1527
+ - Not a Number (`math/NaN`) FlowGraphBlockNames.NaN
1528
+ 2. **Arithmetic Nodes**
1529
+ - Absolute Value (`math/abs`) FlowGraphBlockNames.Abs
1530
+ - Sign (`math/sign`) FlowGraphBlockNames.Sign
1531
+ - Truncate (`math/trunc`) FlowGraphBlockNames.Trunc
1532
+ - Floor (`math/floor`) FlowGraphBlockNames.Floor
1533
+ - Ceil (`math/ceil`) FlowGraphBlockNames.Ceil
1534
+ - Round (`math/round`) FlowGraphBlockNames.Round
1535
+ - Fraction (`math/fract`) FlowGraphBlockNames.Fract
1536
+ - Negation (`math/neg`) FlowGraphBlockNames.Negation
1537
+ - Addition (`math/add`) FlowGraphBlockNames.Add
1538
+ - Subtraction (`math/sub`) FlowGraphBlockNames.Subtract
1539
+ - Multiplication (`math/mul`) FlowGraphBlockNames.Multiply
1540
+ - Division (`math/div`) FlowGraphBlockNames.Divide
1541
+ - Remainder (`math/rem`) FlowGraphBlockNames.Modulo
1542
+ - Minimum (`math/min`) FlowGraphBlockNames.Min
1543
+ - Maximum (`math/max`) FlowGraphBlockNames.Max
1544
+ - Clamp (`math/clamp`) FlowGraphBlockNames.Clamp
1545
+ - Saturate (`math/saturate`) FlowGraphBlockNames.Saturate
1546
+ - Interpolate (`math/mix`) FlowGraphBlockNames.MathInterpolation
1547
+ 3. **Comparison Nodes**
1548
+ - Equality (`math/eq`) FlowGraphBlockNames.Equality
1549
+ - Less Than (`math/lt`) FlowGraphBlockNames.LessThan
1550
+ - Less Than Or Equal To (`math/le`) FlowGraphBlockNames.LessThanOrEqual
1551
+ - Greater Than (`math/gt`) FlowGraphBlockNames.GreaterThan
1552
+ - Greater Than Or Equal To (`math/ge`) FlowGraphBlockNames.GreaterThanOrEqual
1553
+ 4. **Special Nodes**
1554
+ - Is Not a Number (`math/isNaN`) FlowGraphBlockNames.IsNaN
1555
+ - Is Infinity (`math/isInf`) FlowGraphBlockNames.IsInfinity
1556
+ - Select (`math/select`) FlowGraphBlockNames.Conditional
1557
+ - Switch (`math/switch`) FlowGraphBlockNames.DataSwitch
1558
+ - Random (`math/random`) FlowGraphBlockNames.Random
1559
+ 5. **Angle and Trigonometry Nodes**
1560
+ - Degrees-To-Radians (`math/rad`) FlowGraphBlockNames.DegToRad
1561
+ - Radians-To-Degrees (`math/deg`) FlowGraphBlockNames.RadToDeg
1562
+ - Sine (`math/sin`) FlowGraphBlockNames.Sin
1563
+ - Cosine (`math/cos`) FlowGraphBlockNames.Cos
1564
+ - Tangent (`math/tan`) FlowGraphBlockNames.Tan
1565
+ - Arcsine (`math/asin`) FlowGraphBlockNames.Asin
1566
+ - Arccosine (`math/acos`) FlowGraphBlockNames.Acos
1567
+ - Arctangent (`math/atan`) FlowGraphBlockNames.Atan
1568
+ - Arctangent 2 (`math/atan2`) FlowGraphBlockNames.Atan2
1569
+ 6. **Hyperbolic Nodes**
1570
+ - Hyperbolic Sine (`math/sinh`) FlowGraphBlockNames.Sinh
1571
+ - Hyperbolic Cosine (`math/cosh`) FlowGraphBlockNames.Cosh
1572
+ - Hyperbolic Tangent (`math/tanh`) FlowGraphBlockNames.Tanh
1573
+ - Inverse Hyperbolic Sine (`math/asinh`) FlowGraphBlockNames.Asinh
1574
+ - Inverse Hyperbolic Cosine (`math/acosh`) FlowGraphBlockNames.Acosh
1575
+ - Inverse Hyperbolic Tangent (`math/atanh`) FlowGraphBlockNames.Atanh
1576
+ 7. **Exponential Nodes**
1577
+ - Exponent (`math/exp`) FlowGraphBlockNames.Exponential
1578
+ - Natural Logarithm (`math/log`) FlowGraphBlockNames.Log
1579
+ - Base-2 Logarithm (`math/log2`) FlowGraphBlockNames.Log2
1580
+ - Base-10 Logarithm (`math/log10`) FlowGraphBlockNames.Log10
1581
+ - Square Root (`math/sqrt`) FlowGraphBlockNames.SquareRoot
1582
+ - Cube Root (`math/cbrt`) FlowGraphBlockNames.CubeRoot
1583
+ - Power (`math/pow`) FlowGraphBlockNames.Power
1584
+ 8. **Vector Nodes**
1585
+ - Length (`math/length`) FlowGraphBlockNames.Length
1586
+ - Normalize (`math/normalize`) FlowGraphBlockNames.Normalize
1587
+ - Dot Product (`math/dot`) FlowGraphBlockNames.Dot
1588
+ - Cross Product (`math/cross`) FlowGraphBlockNames.Cross
1589
+ - Rotate 2D (`math/rotate2D`) FlowGraphBlockNames.Rotate2D
1590
+ - Rotate 3D (`math/rotate3D`) FlowGraphBlockNames.Rotate3D
1591
+ - Transform (`math/transform`) FlowGraphBlockNames.TransformVector
1592
+ 9. **Matrix Nodes**
1593
+ - Transpose (`math/transpose`) FlowGraphBlockNames.Transpose
1594
+ - Determinant (`math/determinant`) FlowGraphBlockNames.Determinant
1595
+ - Inverse (`math/inverse`) FlowGraphBlockNames.InvertMatrix
1596
+ - Multiplication (`math/matMul`) FlowGraphBlockNames.MatrixMultiplication
1597
+ - Compose (`math/matCompose`) FlowGraphBlockNames.MatrixCompose
1598
+ - Decompose (`math/matDecompose`) FlowGraphBlockNames.MatrixDecompose
1599
+ 10. **Quaternion Nodes**
1600
+ - Conjugate (`math/quatConjugate`) FlowGraphBlockNames.Conjugate
1601
+ - Multiplication (`math/quatMul`) FlowGraphBlockNames.Multiply
1602
+ - Angle Between Quaternions (`math/quatAngleBetween`) FlowGraphBlockNames.AngleBetween
1603
+ - Quaternion From Axis Angle (`math/quatFromAxisAngle`) FlowGraphBlockNames.QuaternionFromAxisAngle
1604
+ - Quaternion To Axis Angle (`math/quatToAxisAngle`) FlowGraphBlockNames.QuaternionToAxisAngle
1605
+ - Quaternion From Two Directional Vectors (`math/quatFromDirections`) FlowGraphBlockNames.QuaternionFromDirections
1606
+ 11. **Swizzle Nodes**
1607
+ - Combine (`math/combine2`, `math/combine3`, `math/combine4`, `math/combine2x2`, `math/combine3x3`, `math/combine4x4`)
1608
+ FlowGraphBlockNames.CombineVector2, FlowGraphBlockNames.CombineVector3, FlowGraphBlockNames.CombineVector4
1609
+ FlowGraphBlockNames.CombineMatrix2D, FlowGraphBlockNames.CombineMatrix3D, FlowGraphBlockNames.CombineMatrix
1610
+ - Extract (`math/extract2`, `math/extract3`, `math/extract4`, `math/extract2x2`, `math/extract3x3`, `math/extract4x4`)
1611
+ FlowGraphBlockNames.ExtractVector2, FlowGraphBlockNames.ExtractVector3, FlowGraphBlockNames.ExtractVector4
1612
+ FlowGraphBlockNames.ExtractMatrix2D, FlowGraphBlockNames.ExtractMatrix3D, FlowGraphBlockNames.ExtractMatrix
1613
+ 12. **Integer Arithmetic Nodes**
1614
+ - Absolute Value (`math/abs`) FlowGraphBlockNames.Abs
1615
+ - Sign (`math/sign`) FlowGraphBlockNames.Sign
1616
+ - Negation (`math/neg`) FlowGraphBlockNames.Negation
1617
+ - Addition (`math/add`) FlowGraphBlockNames.Add
1618
+ - Subtraction (`math/sub`) FlowGraphBlockNames.Subtract
1619
+ - Multiplication (`math/mul`) FlowGraphBlockNames.Multiply
1620
+ - Division (`math/div`) FlowGraphBlockNames.Divide
1621
+ - Remainder (`math/rem`) FlowGraphBlockNames.Modulo
1622
+ - Minimum (`math/min`) FlowGraphBlockNames.Min
1623
+ - Maximum (`math/max`) FlowGraphBlockNames.Max
1624
+ - Clamp (`math/clamp`) FlowGraphBlockNames.Clamp
1625
+ 13. **Integer Comparison Nodes**
1626
+ - Equality (`math/eq`) FlowGraphBlockNames.Equality
1627
+ - Less Than (`math/lt`) FlowGraphBlockNames.LessThan
1628
+ - Less Than Or Equal To (`math/le`) FlowGraphBlockNames.LessThanOrEqual
1629
+ - Greater Than (`math/gt`) FlowGraphBlockNames.GreaterThan
1630
+ - Greater Than Or Equal To (`math/ge`) FlowGraphBlockNames.GreaterThanOrEqual
1631
+ 14. **Integer Bitwise Nodes**
1632
+ - Bitwise NOT (`math/not`) FlowGraphBlockNames.BitwiseNot
1633
+ - Bitwise AND (`math/and`) FlowGraphBlockNames.BitwiseAnd
1634
+ - Bitwise OR (`math/or`) FlowGraphBlockNames.BitwiseOr
1635
+ - Bitwise XOR (`math/xor`) FlowGraphBlockNames.BitwiseXor
1636
+ - Right Shift (`math/asr`) FlowGraphBlockNames.BitwiseRightShift
1637
+ - Left Shift (`math/lsl`) FlowGraphBlockNames.BitwiseLeftShift
1638
+ - Count Leading Zeros (`math/clz`) FlowGraphBlockNames.LeadingZeros
1639
+ - Count Trailing Zeros (`math/ctz`) FlowGraphBlockNames.TrailingZeros
1640
+ - Count One Bits (`math/popcnt`) FlowGraphBlockNames.OneBitsCounter
1641
+ 15. **Boolean Arithmetic Nodes**
1642
+ - Equality (`math/eq`) FlowGraphBlockNames.Equality
1643
+ - Boolean NOT (`math/not`) FlowGraphBlockNames.BitwiseNot
1644
+ - Boolean AND (`math/and`) FlowGraphBlockNames.BitwiseAnd
1645
+ - Boolean OR (`math/or`) FlowGraphBlockNames.BitwiseOr
1646
+ - Boolean XOR (`math/xor`) FlowGraphBlockNames.BitwiseXor
1647
+
1648
+ ### Type Conversion Nodes
1649
+ 1. **Boolean Conversion Nodes**
1650
+ - Boolean to Integer (`type/boolToInt`) FlowGraphBlockNames.BooleanToInt
1651
+ - Boolean to Float (`type/boolToFloat`) FlowGraphBlockNames.BooleanToFloat
1652
+ 2. **Integer Conversion Nodes**
1653
+ - Integer to Boolean (`type/intToBool`) FlowGraphBlockNames.IntToBoolean
1654
+ - Integer to Float (`type/intToFloat`) FlowGraphBlockNames.IntToFloat
1655
+ 3. **Float Conversion Nodes**
1656
+ - Float to Boolean (`type/floatToBool`) FlowGraphBlockNames.FloatToBoolean
1657
+ - Float to Integer (`type/floatToInt`) FlowGraphBlockNames.FloatToInt
1658
+
1659
+ ### Control Flow Nodes
1660
+ 1. **Sync Nodes**
1661
+ - Sequence (`flow/sequence`) FlowGraphBlockNames.Sequence
1662
+ - Branch (`flow/branch`) FlowGraphBlockNames.Branch
1663
+ - Switch (`flow/switch`) FlowGraphBlockNames.Switch
1664
+ - While Loop (`flow/while`) FlowGraphBlockNames.WhileLoop
1665
+ - For Loop (`flow/for`) FlowGraphBlockNames.ForLoop
1666
+ - Do N (`flow/doN`) FlowGraphBlockNames.DoN
1667
+ - Multi Gate (`flow/multiGate`) FlowGraphBlockNames.MultiGate
1668
+ - Wait All (`flow/waitAll`) FlowGraphBlockNames.WaitAll
1669
+ - Throttle (`flow/throttle`) FlowGraphBlockNames.Throttle
1670
+ 2. **Delay Nodes**
1671
+ - Set Delay (`flow/setDelay`) FlowGraphBlockNames.SetDelay
1672
+ - Cancel Delay (`flow/cancelDelay`) FlowGraphBlockNames.CancelDelay
1673
+
1674
+ ### State Manipulation Nodes
1675
+ 1. **Custom Variable Access**
1676
+ - Variable Get (`variable/get`) FlowGraphBlockNames.GetVariable
1677
+ - Variable Set (`variable/set`) FlowGraphBlockNames.SetVariable
1678
+ - Variable Interpolate (`variable/interpolate`)
1679
+ 2. **Object Model Access** // TODO fully test this!!!
1680
+ - JSON Pointer Template Parsing (`pointer/get`) [FlowGraphBlockNames.GetProperty, FlowGraphBlockNames.JsonPointerParser]
1681
+ - Effective JSON Pointer Generation (`pointer/set`) [FlowGraphBlockNames.SetProperty, FlowGraphBlockNames.JsonPointerParser]
1682
+ - Pointer Get (`pointer/get`) [FlowGraphBlockNames.GetProperty, FlowGraphBlockNames.JsonPointerParser]
1683
+ - Pointer Set (`pointer/set`) [FlowGraphBlockNames.SetProperty, FlowGraphBlockNames.JsonPointerParser]
1684
+ - Pointer Interpolate (`pointer/interpolate`) [FlowGraphBlockNames.ValueInterpolation, FlowGraphBlockNames.JsonPointerParser, FlowGraphBlockNames.PlayAnimation, FlowGraphBlockNames.Easing]
1685
+
1686
+ ### Animation Control Nodes
1687
+ 1. **Animation Play** (`animation/start`) FlowGraphBlockNames.PlayAnimation
1688
+ 2. **Animation Stop** (`animation/stop`) FlowGraphBlockNames.StopAnimation
1689
+ 3. **Animation Stop At** (`animation/stopAt`) FlowGraphBlockNames.StopAnimation
1690
+
1691
+ ### Event Nodes
1692
+ 1. **Lifecycle Event Nodes**
1693
+ - On Start (`event/onStart`) FlowGraphBlockNames.SceneReadyEvent
1694
+ - On Tick (`event/onTick`) FlowGraphBlockNames.SceneTickEvent
1695
+ 2. **Custom Event Nodes**
1696
+ - Receive (`event/receive`) FlowGraphBlockNames.ReceiveCustomEvent
1697
+ - Send (`event/send`) FlowGraphBlockNames.SendCustomEvent
1698
+
1699
+ */
1700
+ //# sourceMappingURL=declarationMapper.js.map