@babylonjs/core 8.11.0 → 8.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/Cameras/arcRotateCamera.js +8 -0
  2. package/Cameras/arcRotateCamera.js.map +1 -1
  3. package/Cameras/targetCamera.js +2 -0
  4. package/Cameras/targetCamera.js.map +1 -1
  5. package/Collisions/gpuPicker.d.ts +4 -0
  6. package/Collisions/gpuPicker.js +6 -0
  7. package/Collisions/gpuPicker.js.map +1 -1
  8. package/Engines/abstractEngine.js +2 -2
  9. package/Engines/abstractEngine.js.map +1 -1
  10. package/Engines/constants.d.ts +4 -0
  11. package/Engines/constants.js +4 -0
  12. package/Engines/constants.js.map +1 -1
  13. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.d.ts +1 -0
  14. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js +2 -0
  15. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.d.ts +6 -1
  17. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +29 -0
  18. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
  19. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
  20. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +36 -9
  21. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -0
  23. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/inputBlock.js +1 -0
  25. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  26. package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +2 -0
  27. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
  28. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
  29. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +23 -0
  30. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +126 -21
  31. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  32. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +5 -0
  33. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +4 -0
  34. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  35. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -4
  36. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +4 -17
  37. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  38. package/FrameGraph/frameGraph.js +1 -1
  39. package/FrameGraph/frameGraph.js.map +1 -1
  40. package/FrameGraph/frameGraphContext.d.ts +30 -0
  41. package/FrameGraph/frameGraphContext.js +47 -0
  42. package/FrameGraph/frameGraphContext.js.map +1 -1
  43. package/FrameGraph/frameGraphRenderContext.d.ts +1 -4
  44. package/FrameGraph/frameGraphRenderContext.js +2 -5
  45. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  46. package/Lights/Shadows/cascadedShadowGenerator.d.ts +0 -1
  47. package/Lights/Shadows/cascadedShadowGenerator.js +0 -12
  48. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  49. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
  50. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +4 -1
  51. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  52. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +2 -3
  53. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +1 -1
  54. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
  56. package/Materials/Node/Blocks/Dual/fogBlock.js +4 -1
  57. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  58. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +1 -1
  59. package/Materials/Node/Blocks/Dual/lightBlock.js +2 -2
  60. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  61. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -2
  62. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -1
  63. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  64. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +3 -4
  65. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  66. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -3
  67. package/Materials/Node/Blocks/Dual/textureBlock.js +2 -2
  68. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +1 -1
  70. package/Materials/Node/Blocks/Fragment/TBNBlock.js +4 -1
  71. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  72. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +2 -2
  73. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  74. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -2
  75. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -1
  76. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  77. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +2 -2
  78. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  79. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +1 -2
  80. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +1 -1
  82. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +1 -1
  83. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  84. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -2
  85. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +1 -1
  86. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +2 -2
  88. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +3 -3
  90. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +6 -3
  91. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  92. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -2
  93. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -4
  94. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -2
  96. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -2
  97. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  98. package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +2 -3
  99. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
  100. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  101. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
  102. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +5 -2
  103. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  104. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -2
  105. package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -2
  106. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  107. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -2
  108. package/Materials/Node/Blocks/PBR/refractionBlock.js +1 -2
  109. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  110. package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +2 -3
  111. package/Materials/Node/Blocks/PBR/sheenBlock.js +1 -2
  112. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  113. package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +2 -3
  114. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +1 -2
  115. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  116. package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -2
  117. package/Materials/Node/Blocks/Particle/particleTextureBlock.js +1 -1
  118. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  119. package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +2 -2
  120. package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
  121. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  122. package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +1 -1
  123. package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -1
  124. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  125. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -2
  126. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -1
  127. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  128. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +2 -2
  129. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +8 -2
  130. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  131. package/Materials/Node/Blocks/transformBlock.d.ts +3 -3
  132. package/Materials/Node/Blocks/transformBlock.js +4 -5
  133. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  134. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -3
  135. package/Materials/Node/Blocks/triPlanarBlock.js +1 -1
  136. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  137. package/Materials/Node/nodeMaterial.d.ts +1 -1
  138. package/Materials/Node/nodeMaterial.js +28 -42
  139. package/Materials/Node/nodeMaterial.js.map +1 -1
  140. package/Materials/Node/nodeMaterialBlock.d.ts +8 -12
  141. package/Materials/Node/nodeMaterialBlock.js +10 -12
  142. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  143. package/Materials/Node/nodeMaterialBuildState.js +3 -1
  144. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  145. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +7 -3
  146. package/Materials/Node/nodeMaterialBuildStateSharedData.js +17 -6
  147. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  148. package/Materials/PBR/pbrBaseMaterial.d.ts +2 -0
  149. package/Materials/PBR/pbrBaseMaterial.js +11 -0
  150. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  151. package/Materials/Textures/Loaders/exrTextureLoader.d.ts +10 -0
  152. package/Materials/Textures/Loaders/exrTextureLoader.js +28 -1
  153. package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
  154. package/Materials/materialHelper.functions.js +1 -1
  155. package/Materials/materialHelper.functions.js.map +1 -1
  156. package/Materials/materialHelper.geometryrendering.js +7 -0
  157. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  158. package/Materials/standardMaterial.d.ts +2 -0
  159. package/Materials/standardMaterial.js +11 -0
  160. package/Materials/standardMaterial.js.map +1 -1
  161. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +7 -0
  162. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +11 -5
  163. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  164. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +6 -0
  165. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +42 -4
  166. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  167. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +8 -0
  168. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  169. package/Misc/environmentTextureTools.js +1 -1
  170. package/Misc/environmentTextureTools.js.map +1 -1
  171. package/Misc/minMaxReducer.d.ts +8 -6
  172. package/Misc/minMaxReducer.js +57 -90
  173. package/Misc/minMaxReducer.js.map +1 -1
  174. package/Misc/thinMinMaxReducer.d.ts +47 -0
  175. package/Misc/thinMinMaxReducer.js +148 -0
  176. package/Misc/thinMinMaxReducer.js.map +1 -0
  177. package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -0
  178. package/Particles/EmitterTypes/customParticleEmitter.js +9 -1
  179. package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
  180. package/Particles/IParticleSystem.d.ts +4 -0
  181. package/Particles/IParticleSystem.js.map +1 -1
  182. package/Particles/Node/Blocks/Conditions/particleConditionBlock.d.ts +75 -0
  183. package/Particles/Node/Blocks/Conditions/particleConditionBlock.js +179 -0
  184. package/Particles/Node/Blocks/Conditions/particleConditionBlock.js.map +1 -0
  185. package/Particles/Node/Blocks/Emitters/boxShapeBlock.d.ts +47 -0
  186. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +107 -0
  187. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -0
  188. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +46 -0
  189. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +97 -0
  190. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -0
  191. package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +39 -0
  192. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +84 -0
  193. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -0
  194. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.d.ts +48 -0
  195. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +120 -0
  196. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -0
  197. package/Particles/Node/Blocks/Emitters/index.d.ts +7 -0
  198. package/Particles/Node/Blocks/Emitters/index.js +8 -0
  199. package/Particles/Node/Blocks/Emitters/index.js.map +1 -0
  200. package/Particles/Node/Blocks/Emitters/pointShapeBlock.d.ts +39 -0
  201. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +86 -0
  202. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -0
  203. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.d.ts +53 -0
  204. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js +111 -0
  205. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -0
  206. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +43 -0
  207. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +108 -0
  208. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -0
  209. package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.d.ts +48 -0
  210. package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.js +100 -0
  211. package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.js.map +1 -0
  212. package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.d.ts +47 -0
  213. package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.js +82 -0
  214. package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.js.map +1 -0
  215. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.d.ts +48 -0
  216. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.js +133 -0
  217. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.js.map +1 -0
  218. package/Particles/Node/Blocks/Triggers/triggerTools.d.ts +9 -0
  219. package/Particles/Node/Blocks/Triggers/triggerTools.js +16 -0
  220. package/Particles/Node/Blocks/Triggers/triggerTools.js.map +1 -0
  221. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +31 -0
  222. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +64 -0
  223. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -0
  224. package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.d.ts +31 -0
  225. package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.js +63 -0
  226. package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.js.map +1 -0
  227. package/Particles/Node/Blocks/Update/updateAngleBlock.d.ts +35 -0
  228. package/Particles/Node/Blocks/Update/updateAngleBlock.js +73 -0
  229. package/Particles/Node/Blocks/Update/updateAngleBlock.js.map +1 -0
  230. package/Particles/Node/Blocks/Update/updateColorBlock.d.ts +35 -0
  231. package/Particles/Node/Blocks/Update/updateColorBlock.js +73 -0
  232. package/Particles/Node/Blocks/Update/updateColorBlock.js.map +1 -0
  233. package/Particles/Node/Blocks/Update/updateDirectionBlock.d.ts +35 -0
  234. package/Particles/Node/Blocks/Update/updateDirectionBlock.js +73 -0
  235. package/Particles/Node/Blocks/Update/updateDirectionBlock.js.map +1 -0
  236. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +41 -0
  237. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +102 -0
  238. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -0
  239. package/Particles/Node/Blocks/Update/updatePositionBlock.d.ts +35 -0
  240. package/Particles/Node/Blocks/Update/updatePositionBlock.js +73 -0
  241. package/Particles/Node/Blocks/Update/updatePositionBlock.js.map +1 -0
  242. package/Particles/Node/Blocks/Update/updateScaleBlock.d.ts +35 -0
  243. package/Particles/Node/Blocks/Update/updateScaleBlock.js +73 -0
  244. package/Particles/Node/Blocks/Update/updateScaleBlock.js.map +1 -0
  245. package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.d.ts +35 -0
  246. package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.js +74 -0
  247. package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.js.map +1 -0
  248. package/Particles/Node/Blocks/index.d.ts +27 -0
  249. package/Particles/Node/Blocks/index.js +29 -0
  250. package/Particles/Node/Blocks/index.js.map +1 -0
  251. package/Particles/Node/Blocks/particleConverterBlock.d.ts +85 -0
  252. package/Particles/Node/Blocks/particleConverterBlock.js +267 -0
  253. package/Particles/Node/Blocks/particleConverterBlock.js.map +1 -0
  254. package/Particles/Node/Blocks/particleDebugBlock.d.ts +37 -0
  255. package/Particles/Node/Blocks/particleDebugBlock.js +109 -0
  256. package/Particles/Node/Blocks/particleDebugBlock.js.map +1 -0
  257. package/Particles/Node/Blocks/particleElbowBlock.d.ts +27 -0
  258. package/Particles/Node/Blocks/particleElbowBlock.js +47 -0
  259. package/Particles/Node/Blocks/particleElbowBlock.js.map +1 -0
  260. package/Particles/Node/Blocks/particleGradientBlock.d.ts +28 -0
  261. package/Particles/Node/Blocks/particleGradientBlock.js +118 -0
  262. package/Particles/Node/Blocks/particleGradientBlock.js.map +1 -0
  263. package/Particles/Node/Blocks/particleGradientValueBlock.d.ts +32 -0
  264. package/Particles/Node/Blocks/particleGradientValueBlock.js +79 -0
  265. package/Particles/Node/Blocks/particleGradientValueBlock.js.map +1 -0
  266. package/Particles/Node/Blocks/particleInputBlock.d.ts +87 -0
  267. package/Particles/Node/Blocks/particleInputBlock.js +279 -0
  268. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -0
  269. package/Particles/Node/Blocks/particleLerpBlock.d.ts +34 -0
  270. package/Particles/Node/Blocks/particleLerpBlock.js +92 -0
  271. package/Particles/Node/Blocks/particleLerpBlock.js.map +1 -0
  272. package/Particles/Node/Blocks/particleMathBlock.d.ts +64 -0
  273. package/Particles/Node/Blocks/particleMathBlock.js +321 -0
  274. package/Particles/Node/Blocks/particleMathBlock.js.map +1 -0
  275. package/Particles/Node/Blocks/particleRandomBlock.d.ts +52 -0
  276. package/Particles/Node/Blocks/particleRandomBlock.js +161 -0
  277. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -0
  278. package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +65 -0
  279. package/Particles/Node/Blocks/particleSourceTextureBlock.js +173 -0
  280. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -0
  281. package/Particles/Node/Blocks/particleTrigonometryBlock.d.ts +80 -0
  282. package/Particles/Node/Blocks/particleTrigonometryBlock.js +272 -0
  283. package/Particles/Node/Blocks/particleTrigonometryBlock.js.map +1 -0
  284. package/Particles/Node/Blocks/randomRangeBlock.d.ts +45 -0
  285. package/Particles/Node/Blocks/randomRangeBlock.js +151 -0
  286. package/Particles/Node/Blocks/randomRangeBlock.js.map +1 -0
  287. package/Particles/Node/Blocks/systemBlock.d.ts +71 -0
  288. package/Particles/Node/Blocks/systemBlock.js +193 -0
  289. package/Particles/Node/Blocks/systemBlock.js.map +1 -0
  290. package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.d.ts +39 -0
  291. package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.js +41 -0
  292. package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.js.map +1 -0
  293. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +31 -0
  294. package/Particles/Node/Enums/nodeParticleContextualSources.js +34 -0
  295. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -0
  296. package/Particles/Node/Enums/nodeParticleSystemSources.d.ts +13 -0
  297. package/Particles/Node/Enums/nodeParticleSystemSources.js +15 -0
  298. package/Particles/Node/Enums/nodeParticleSystemSources.js.map +1 -0
  299. package/Particles/Node/index.d.ts +8 -0
  300. package/Particles/Node/index.js +10 -0
  301. package/Particles/Node/index.js.map +1 -0
  302. package/Particles/Node/nodeParticleBlock.d.ts +154 -0
  303. package/Particles/Node/nodeParticleBlock.js +355 -0
  304. package/Particles/Node/nodeParticleBlock.js.map +1 -0
  305. package/Particles/Node/nodeParticleBlockConnectionPoint.d.ts +188 -0
  306. package/Particles/Node/nodeParticleBlockConnectionPoint.js +337 -0
  307. package/Particles/Node/nodeParticleBlockConnectionPoint.js.map +1 -0
  308. package/Particles/Node/nodeParticleBuildState.d.ts +89 -0
  309. package/Particles/Node/nodeParticleBuildState.js +170 -0
  310. package/Particles/Node/nodeParticleBuildState.js.map +1 -0
  311. package/Particles/Node/nodeParticleSystemSet.d.ts +120 -0
  312. package/Particles/Node/nodeParticleSystemSet.js +382 -0
  313. package/Particles/Node/nodeParticleSystemSet.js.map +1 -0
  314. package/Particles/Queue/executionQueue.d.ts +2 -0
  315. package/Particles/Queue/executionQueue.js +10 -0
  316. package/Particles/Queue/executionQueue.js.map +1 -1
  317. package/Particles/baseParticleSystem.d.ts +2 -1
  318. package/Particles/baseParticleSystem.js +1 -0
  319. package/Particles/baseParticleSystem.js.map +1 -1
  320. package/Particles/flowMap.d.ts +7 -0
  321. package/Particles/flowMap.js +32 -0
  322. package/Particles/flowMap.js.map +1 -1
  323. package/Particles/gpuParticleSystem.d.ts +4 -0
  324. package/Particles/gpuParticleSystem.js +4 -0
  325. package/Particles/gpuParticleSystem.js.map +1 -1
  326. package/Particles/index.d.ts +1 -0
  327. package/Particles/index.js +1 -0
  328. package/Particles/index.js.map +1 -1
  329. package/Particles/particleSystem.d.ts +12 -0
  330. package/Particles/particleSystem.js +22 -1
  331. package/Particles/particleSystem.js.map +1 -1
  332. package/Particles/thinParticleSystem.d.ts +32 -11
  333. package/Particles/thinParticleSystem.js +62 -36
  334. package/Particles/thinParticleSystem.js.map +1 -1
  335. package/PostProcesses/postProcessManager.d.ts +2 -1
  336. package/PostProcesses/postProcessManager.js +3 -2
  337. package/PostProcesses/postProcessManager.js.map +1 -1
  338. package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
  339. package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  340. package/Shaders/ShadersInclude/defaultVertexDeclaration.js +1 -0
  341. package/Shaders/ShadersInclude/defaultVertexDeclaration.js.map +1 -1
  342. package/Shaders/ShadersInclude/lightFragment.js +5 -2
  343. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  344. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js +3 -0
  345. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  346. package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -0
  347. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  348. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
  349. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  350. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  351. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  352. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +1 -0
  353. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  354. package/Shaders/ShadersInclude/prePassDeclaration.js +3 -0
  355. package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
  356. package/Shaders/ShadersInclude/prePassVertex.js +3 -0
  357. package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
  358. package/Shaders/ShadersInclude/prePassVertexDeclaration.js +3 -0
  359. package/Shaders/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  360. package/Shaders/default.fragment.js +3 -0
  361. package/Shaders/default.fragment.js.map +1 -1
  362. package/Shaders/minmaxRedux.fragment.js +13 -5
  363. package/Shaders/minmaxRedux.fragment.js.map +1 -1
  364. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
  365. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  366. package/ShadersWGSL/ShadersInclude/lightFragment.js +5 -2
  367. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  368. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +3 -0
  369. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  370. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -0
  371. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  372. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
  373. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  374. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  375. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  376. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +3 -0
  377. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
  378. package/ShadersWGSL/ShadersInclude/prePassVertex.js +3 -0
  379. package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
  380. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +3 -0
  381. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  382. package/ShadersWGSL/default.fragment.js +3 -0
  383. package/ShadersWGSL/default.fragment.js.map +1 -1
  384. package/ShadersWGSL/minmaxRedux.fragment.js +14 -6
  385. package/ShadersWGSL/minmaxRedux.fragment.js.map +1 -1
  386. package/package.json +1 -1
  387. package/scene.d.ts +5 -0
  388. package/scene.js +8 -0
  389. package/scene.js.map +1 -1
@@ -0,0 +1,355 @@
1
+ import { __decorate } from "../../tslib.es6.js";
2
+ import { serialize } from "../../Misc/decorators.js";
3
+ import { UniqueIdGenerator } from "../../Misc/uniqueIdGenerator.js";
4
+ import { NodeParticleConnectionPoint } from "./nodeParticleBlockConnectionPoint.js";
5
+ import { Logger } from "../../Misc/logger.js";
6
+ import { Observable } from "../../Misc/observable.js";
7
+ import { GetClass } from "../../Misc/typeStore.js";
8
+ /**
9
+ * Defines a block that can be used inside a node based particle system
10
+ */
11
+ export class NodeParticleBlock {
12
+ /**
13
+ * Gets a boolean indicating if this block is a teleport out
14
+ */
15
+ get isTeleportOut() {
16
+ return this._isTeleportOut;
17
+ }
18
+ /**
19
+ * Gets a boolean indicating if this block is a teleport in
20
+ */
21
+ get isTeleportIn() {
22
+ return this._isTeleportIn;
23
+ }
24
+ /**
25
+ * Gets a boolean indicating that this block is a system block
26
+ */
27
+ get isSystem() {
28
+ return this._isSystem;
29
+ }
30
+ /**
31
+ * Gets a boolean indicating that this block is an input block
32
+ */
33
+ get isInput() {
34
+ return this._isInput;
35
+ }
36
+ /**
37
+ * Gets a boolean indicating if this block is a debug block
38
+ */
39
+ get isDebug() {
40
+ return this._isDebug;
41
+ }
42
+ /**
43
+ * Gets or set the name of the block
44
+ */
45
+ get name() {
46
+ return this._name;
47
+ }
48
+ set name(value) {
49
+ this._name = value;
50
+ }
51
+ /**
52
+ * Gets the current class name e.g. "NodeParticleBlock"
53
+ * @returns the class name
54
+ */
55
+ getClassName() {
56
+ return "NodeParticleBlock";
57
+ }
58
+ /**
59
+ * Gets the list of input points
60
+ */
61
+ get inputs() {
62
+ return this._inputs;
63
+ }
64
+ /** Gets the list of output points */
65
+ get outputs() {
66
+ return this._outputs;
67
+ }
68
+ /**
69
+ * Creates a new NodeParticleBlock
70
+ * @param name defines the block name
71
+ */
72
+ constructor(name) {
73
+ this._name = "";
74
+ this._isInput = false;
75
+ this._isSystem = false;
76
+ this._isDebug = false;
77
+ this._isTeleportOut = false;
78
+ this._isTeleportIn = false;
79
+ /** @internal */
80
+ this._inputs = new Array();
81
+ /** @internal */
82
+ this._outputs = new Array();
83
+ /**
84
+ * Gets an observable raised when the block is built
85
+ */
86
+ this.onBuildObservable = new Observable();
87
+ /**
88
+ * Gets an observable raised when the block is disposed
89
+ */
90
+ this.onDisposeObservable = new Observable();
91
+ /**
92
+ * Gets an observable raised when the inputs of the block change
93
+ */
94
+ this.onInputChangedObservable = new Observable();
95
+ /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */
96
+ this.visibleOnFrame = false;
97
+ this._name = name;
98
+ this.uniqueId = UniqueIdGenerator.UniqueId;
99
+ }
100
+ _inputRename(name) {
101
+ return name;
102
+ }
103
+ _outputRename(name) {
104
+ return name;
105
+ }
106
+ /**
107
+ * Checks if the current block is an ancestor of a given block
108
+ * @param block defines the potential descendant block to check
109
+ * @returns true if block is a descendant
110
+ */
111
+ isAnAncestorOf(block) {
112
+ for (const output of this._outputs) {
113
+ if (!output.hasEndpoints) {
114
+ continue;
115
+ }
116
+ for (const endpoint of output.endpoints) {
117
+ if (endpoint.ownerBlock === block) {
118
+ return true;
119
+ }
120
+ if (endpoint.ownerBlock.isAnAncestorOf(block)) {
121
+ return true;
122
+ }
123
+ }
124
+ }
125
+ return false;
126
+ }
127
+ /**
128
+ * Checks if the current block is an ancestor of a given type
129
+ * @param type defines the potential type to check
130
+ * @returns true if block is a descendant
131
+ */
132
+ isAnAncestorOfType(type) {
133
+ if (this.getClassName() === type) {
134
+ return true;
135
+ }
136
+ for (const output of this._outputs) {
137
+ if (!output.hasEndpoints) {
138
+ continue;
139
+ }
140
+ for (const endpoint of output.endpoints) {
141
+ if (endpoint.ownerBlock.isAnAncestorOfType(type)) {
142
+ return true;
143
+ }
144
+ }
145
+ }
146
+ return false;
147
+ }
148
+ /**
149
+ * Find an input by its name
150
+ * @param name defines the name of the input to look for
151
+ * @returns the input or null if not found
152
+ */
153
+ getInputByName(name) {
154
+ const filter = this._inputs.filter((e) => e.name === name);
155
+ if (filter.length) {
156
+ return filter[0];
157
+ }
158
+ return null;
159
+ }
160
+ _linkConnectionTypes(inputIndex0, inputIndex1, looseCoupling = false) {
161
+ if (looseCoupling) {
162
+ this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];
163
+ }
164
+ else {
165
+ this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];
166
+ this._inputs[inputIndex0]._isMainLinkSource = true;
167
+ }
168
+ this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];
169
+ }
170
+ /**
171
+ * Register a new input. Must be called inside a block constructor
172
+ * @param name defines the connection point name
173
+ * @param type defines the connection point type
174
+ * @param isOptional defines a boolean indicating that this input can be omitted
175
+ * @param value value to return if there is no connection
176
+ * @param valueMin min value accepted for value
177
+ * @param valueMax max value accepted for value
178
+ * @returns the current block
179
+ */
180
+ registerInput(name, type, isOptional = false, value, valueMin, valueMax) {
181
+ const point = new NodeParticleConnectionPoint(name, this, 0 /* NodeParticleConnectionPointDirection.Input */);
182
+ point.type = type;
183
+ point.isOptional = isOptional;
184
+ point.defaultValue = value;
185
+ point.value = value;
186
+ point.valueMin = valueMin;
187
+ point.valueMax = valueMax;
188
+ this._inputs.push(point);
189
+ this.onInputChangedObservable.notifyObservers(point);
190
+ return this;
191
+ }
192
+ /**
193
+ * Register a new output. Must be called inside a block constructor
194
+ * @param name defines the connection point name
195
+ * @param type defines the connection point type
196
+ * @param point an already created connection point. If not provided, create a new one
197
+ * @returns the current block
198
+ */
199
+ registerOutput(name, type, point) {
200
+ point = point ?? new NodeParticleConnectionPoint(name, this, 1 /* NodeParticleConnectionPointDirection.Output */);
201
+ point.type = type;
202
+ this._outputs.push(point);
203
+ return this;
204
+ }
205
+ /**
206
+ * Builds the block. Must be implemented by derived classes.
207
+ * @param _state defines the current build state
208
+ */
209
+ _build(_state) { }
210
+ _customBuildStep(_state) {
211
+ // Must be implemented by children
212
+ }
213
+ /**
214
+ * Builds the block
215
+ * @param state defines the current build state
216
+ * @returns the built block
217
+ */
218
+ build(state) {
219
+ if (this._buildId === state.buildId) {
220
+ return true;
221
+ }
222
+ if (this._outputs.length > 0) {
223
+ if (!this._outputs.some((o) => o.hasEndpoints) && !this.isDebug && !this.isSystem) {
224
+ return false;
225
+ }
226
+ }
227
+ this._buildId = state.buildId;
228
+ // Check if "parent" blocks are compiled
229
+ for (const input of this._inputs) {
230
+ if (!input.connectedPoint) {
231
+ if (!input.isOptional) {
232
+ // Emit a warning
233
+ state.notConnectedNonOptionalInputs.push(input);
234
+ }
235
+ continue;
236
+ }
237
+ const block = input.connectedPoint.ownerBlock;
238
+ if (block && block !== this && !block.isSystem) {
239
+ block.build(state);
240
+ }
241
+ }
242
+ this._customBuildStep(state);
243
+ // Logs
244
+ if (state.verbose) {
245
+ Logger.Log(`Building ${this.name} [${this.getClassName()}]`);
246
+ }
247
+ this._build(state);
248
+ this.onBuildObservable.notifyObservers(this);
249
+ return false;
250
+ }
251
+ /**
252
+ * Serializes this block in a JSON representation
253
+ * @returns the serialized block object
254
+ */
255
+ serialize() {
256
+ const serializationObject = {};
257
+ serializationObject.customType = "BABYLON." + this.getClassName();
258
+ serializationObject.id = this.uniqueId;
259
+ serializationObject.name = this.name;
260
+ serializationObject.visibleOnFrame = this.visibleOnFrame;
261
+ serializationObject.inputs = [];
262
+ serializationObject.outputs = [];
263
+ for (const input of this.inputs) {
264
+ serializationObject.inputs.push(input.serialize());
265
+ }
266
+ for (const output of this.outputs) {
267
+ serializationObject.outputs.push(output.serialize(false));
268
+ }
269
+ return serializationObject;
270
+ }
271
+ /**
272
+ * @internal
273
+ */
274
+ _deserialize(serializationObject) {
275
+ this._name = serializationObject.name;
276
+ this.comments = serializationObject.comments;
277
+ this.visibleOnFrame = !!serializationObject.visibleOnFrame;
278
+ this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);
279
+ }
280
+ _deserializePortDisplayNamesAndExposedOnFrame(serializationObject) {
281
+ const serializedInputs = serializationObject.inputs;
282
+ const serializedOutputs = serializationObject.outputs;
283
+ if (serializedInputs) {
284
+ for (const port of serializedInputs) {
285
+ const input = this.inputs.find((i) => i.name === port.name);
286
+ if (!input) {
287
+ return;
288
+ }
289
+ if (port.displayName) {
290
+ input.displayName = port.displayName;
291
+ }
292
+ if (port.isExposedOnFrame) {
293
+ input.isExposedOnFrame = port.isExposedOnFrame;
294
+ input.exposedPortPosition = port.exposedPortPosition;
295
+ }
296
+ if (port.value !== undefined && port.value !== null) {
297
+ if (port.valueType === "number") {
298
+ input.value = port.value;
299
+ }
300
+ else {
301
+ const valueType = GetClass(port.valueType);
302
+ if (valueType) {
303
+ input.value = valueType.FromArray(port.value);
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ if (serializedOutputs) {
310
+ for (let i = 0; i < serializedOutputs.length; i++) {
311
+ const port = serializedOutputs[i];
312
+ if (port.displayName) {
313
+ this.outputs[i].displayName = port.displayName;
314
+ }
315
+ if (port.isExposedOnFrame) {
316
+ this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;
317
+ this.outputs[i].exposedPortPosition = port.exposedPortPosition;
318
+ }
319
+ }
320
+ }
321
+ }
322
+ /**
323
+ * Clone the current block to a new identical block
324
+ * @returns a copy of the current block
325
+ */
326
+ clone() {
327
+ const serializationObject = this.serialize();
328
+ const blockType = GetClass(serializationObject.customType);
329
+ if (blockType) {
330
+ const block = new blockType();
331
+ block._deserialize(serializationObject);
332
+ return block;
333
+ }
334
+ return null;
335
+ }
336
+ /**
337
+ * Release resources
338
+ */
339
+ dispose() {
340
+ this.onDisposeObservable.notifyObservers(this);
341
+ this.onDisposeObservable.clear();
342
+ for (const input of this.inputs) {
343
+ input.dispose();
344
+ }
345
+ for (const output of this.outputs) {
346
+ output.dispose();
347
+ }
348
+ this.onBuildObservable.clear();
349
+ this.onInputChangedObservable.clear();
350
+ }
351
+ }
352
+ __decorate([
353
+ serialize("comment")
354
+ ], NodeParticleBlock.prototype, "comments", void 0);
355
+ //# sourceMappingURL=nodeParticleBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeParticleBlock.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE,iBAAiB,EAAE,wCAAoC;AAChE,OAAO,EAAE,2BAA2B,EAAwC,MAAM,oCAAoC,CAAC;AAGvH,OAAO,EAAE,MAAM,EAAE,6BAAyB;AAC1C,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,gCAA4B;AAE/C;;GA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L,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAE7C,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,KAAK,GAAsB,IAAI,SAAS,EAAE,CAAC;YACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAExC,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAEjC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,KAAK,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;CACJ;AAvVU;IADN,SAAS,CAAC,SAAS,CAAC;mDACG","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\nimport { NodeParticleConnectionPoint, NodeParticleConnectionPointDirection } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleBuildState } from \"./nodeParticleBuildState\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\n\r\n/**\r\n * Defines a block that can be used inside a node based particle system\r\n */\r\nexport class NodeParticleBlock {\r\n private _name = \"\";\r\n protected _buildId: number;\r\n protected _isInput = false;\r\n protected _isSystem = false;\r\n protected _isDebug = false;\r\n protected _isTeleportOut = false;\r\n protected _isTeleportIn = false;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /** @internal */\r\n public _inputs = new Array<NodeParticleConnectionPoint>();\r\n /** @internal */\r\n public _outputs = new Array<NodeParticleConnectionPoint>();\r\n\r\n /**\r\n * Gets an observable raised when the block is built\r\n */\r\n public onBuildObservable = new Observable<NodeParticleBlock>();\r\n\r\n /**\r\n * Gets an observable raised when the block is disposed\r\n */\r\n public onDisposeObservable = new Observable<NodeParticleBlock>();\r\n\r\n /**\r\n * Gets an observable raised when the inputs of the block change\r\n */\r\n public onInputChangedObservable = new Observable<NodeParticleConnectionPoint>();\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport out\r\n */\r\n public get isTeleportOut(): boolean {\r\n return this._isTeleportOut;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport in\r\n */\r\n public get isTeleportIn(): boolean {\r\n return this._isTeleportIn;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block is a system block\r\n */\r\n public get isSystem(): boolean {\r\n return this._isSystem;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block is an input block\r\n */\r\n public get isInput(): boolean {\r\n return this._isInput;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a debug block\r\n */\r\n public get isDebug(): boolean {\r\n return this._isDebug;\r\n }\r\n\r\n /**\r\n * A free comment about the block\r\n */\r\n @serialize(\"comment\")\r\n public comments: string;\r\n\r\n /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */\r\n public visibleOnFrame = false;\r\n\r\n /**\r\n * Gets or set the name of the block\r\n */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeParticleBlock\"\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeParticleBlock\";\r\n }\r\n\r\n /**\r\n * Gets the list of input points\r\n */\r\n public get inputs(): NodeParticleConnectionPoint[] {\r\n return this._inputs;\r\n }\r\n\r\n /** Gets the list of output points */\r\n public get outputs(): NodeParticleConnectionPoint[] {\r\n return this._outputs;\r\n }\r\n\r\n /**\r\n * Creates a new NodeParticleBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n this._name = name;\r\n this.uniqueId = UniqueIdGenerator.UniqueId;\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n return name;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given block\r\n * @param block defines the potential descendant block to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOf(block: NodeParticleBlock): boolean {\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock === block) {\r\n return true;\r\n }\r\n if (endpoint.ownerBlock.isAnAncestorOf(block)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given type\r\n * @param type defines the potential type to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOfType(type: string): boolean {\r\n if (this.getClassName() === type) {\r\n return true;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock.isAnAncestorOfType(type)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n public getInputByName(name: string) {\r\n const filter = this._inputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling = false) {\r\n if (looseCoupling) {\r\n this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];\r\n } else {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n this._inputs[inputIndex0]._isMainLinkSource = true;\r\n }\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n }\r\n\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param value value to return if there is no connection\r\n * @param valueMin min value accepted for value\r\n * @param valueMax max value accepted for value\r\n * @returns the current block\r\n */\r\n public registerInput(name: string, type: NodeParticleBlockConnectionPointTypes, isOptional: boolean = false, value?: any, valueMin?: any, valueMax?: any) {\r\n const point = new NodeParticleConnectionPoint(name, this, NodeParticleConnectionPointDirection.Input);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n point.defaultValue = value;\r\n point.value = value;\r\n point.valueMin = valueMin;\r\n point.valueMax = valueMax;\r\n\r\n this._inputs.push(point);\r\n\r\n this.onInputChangedObservable.notifyObservers(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerOutput(name: string, type: NodeParticleBlockConnectionPointTypes, point?: NodeParticleConnectionPoint) {\r\n point = point ?? new NodeParticleConnectionPoint(name, this, NodeParticleConnectionPointDirection.Output);\r\n point.type = type;\r\n\r\n this._outputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Builds the block. Must be implemented by derived classes.\r\n * @param _state defines the current build state\r\n */\r\n public _build(_state: NodeParticleBuildState) {}\r\n\r\n protected _customBuildStep(_state: NodeParticleBuildState): void {\r\n // Must be implemented by children\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n * @returns the built block\r\n */\r\n public build(state: NodeParticleBuildState) {\r\n if (this._buildId === state.buildId) {\r\n return true;\r\n }\r\n\r\n if (this._outputs.length > 0) {\r\n if (!this._outputs.some((o) => o.hasEndpoints) && !this.isDebug && !this.isSystem) {\r\n return false;\r\n }\r\n }\r\n\r\n this._buildId = state.buildId;\r\n\r\n // Check if \"parent\" blocks are compiled\r\n for (const input of this._inputs) {\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) {\r\n // Emit a warning\r\n state.notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n\r\n const block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this && !block.isSystem) {\r\n block.build(state);\r\n }\r\n }\r\n\r\n this._customBuildStep(state);\r\n\r\n // Logs\r\n if (state.verbose) {\r\n Logger.Log(`Building ${this.name} [${this.getClassName()}]`);\r\n }\r\n\r\n this._build(state);\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject.visibleOnFrame = this.visibleOnFrame;\r\n\r\n serializationObject.inputs = [];\r\n serializationObject.outputs = [];\r\n\r\n for (const input of this.inputs) {\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n\r\n for (const output of this.outputs) {\r\n serializationObject.outputs.push(output.serialize(false));\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _deserialize(serializationObject: any) {\r\n this._name = serializationObject.name;\r\n this.comments = serializationObject.comments;\r\n this.visibleOnFrame = !!serializationObject.visibleOnFrame;\r\n this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);\r\n }\r\n\r\n private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {\r\n const serializedInputs = serializationObject.inputs;\r\n const serializedOutputs = serializationObject.outputs;\r\n if (serializedInputs) {\r\n for (const port of serializedInputs) {\r\n const input = this.inputs.find((i) => i.name === port.name);\r\n\r\n if (!input) {\r\n return;\r\n }\r\n\r\n if (port.displayName) {\r\n input.displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n input.isExposedOnFrame = port.isExposedOnFrame;\r\n input.exposedPortPosition = port.exposedPortPosition;\r\n }\r\n if (port.value !== undefined && port.value !== null) {\r\n if (port.valueType === \"number\") {\r\n input.value = port.value;\r\n } else {\r\n const valueType = GetClass(port.valueType);\r\n\r\n if (valueType) {\r\n input.value = valueType.FromArray(port.value);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n if (serializedOutputs) {\r\n for (let i = 0; i < serializedOutputs.length; i++) {\r\n const port = serializedOutputs[i];\r\n if (port.displayName) {\r\n this.outputs[i].displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;\r\n this.outputs[i].exposedPortPosition = port.exposedPortPosition;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current block to a new identical block\r\n * @returns a copy of the current block\r\n */\r\n public clone() {\r\n const serializationObject = this.serialize();\r\n\r\n const blockType = GetClass(serializationObject.customType);\r\n if (blockType) {\r\n const block: NodeParticleBlock = new blockType();\r\n block._deserialize(serializationObject);\r\n\r\n return block;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n for (const input of this.inputs) {\r\n input.dispose();\r\n }\r\n\r\n for (const output of this.outputs) {\r\n output.dispose();\r\n }\r\n\r\n this.onBuildObservable.clear();\r\n this.onInputChangedObservable.clear();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,188 @@
1
+ import type { Nullable } from "../../types.js";
2
+ import { Observable } from "../../Misc/observable.js";
3
+ import type { NodeParticleBlock } from "./nodeParticleBlock.js";
4
+ import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
5
+ import type { NodeParticleBuildState } from "./nodeParticleBuildState.js";
6
+ /**
7
+ * Enum used to define the compatibility state between two connection points
8
+ */
9
+ export declare enum NodeParticleConnectionPointCompatibilityStates {
10
+ /** Points are compatibles */
11
+ Compatible = 0,
12
+ /** Points are incompatible because of their types */
13
+ TypeIncompatible = 1,
14
+ /** Points are incompatible because they are in the same hierarchy **/
15
+ HierarchyIssue = 2
16
+ }
17
+ /**
18
+ * Defines the direction of a connection point
19
+ */
20
+ export declare enum NodeParticleConnectionPointDirection {
21
+ /** Input */
22
+ Input = 0,
23
+ /** Output */
24
+ Output = 1
25
+ }
26
+ /**
27
+ * Defines a connection point for a block
28
+ */
29
+ export declare class NodeParticleConnectionPoint {
30
+ /** @internal */
31
+ _ownerBlock: NodeParticleBlock;
32
+ /** @internal */
33
+ _connectedPoint: Nullable<NodeParticleConnectionPoint>;
34
+ /** @internal */
35
+ _storedValue: any;
36
+ /** @internal */
37
+ _storedFunction: Nullable<(state: NodeParticleBuildState) => any>;
38
+ /** @internal */
39
+ _acceptedConnectionPointType: Nullable<NodeParticleConnectionPoint>;
40
+ private _endpoints;
41
+ private _direction;
42
+ private _type;
43
+ /** @internal */
44
+ _linkedConnectionSource: Nullable<NodeParticleConnectionPoint>;
45
+ /** @internal */
46
+ _typeConnectionSource: Nullable<NodeParticleConnectionPoint>;
47
+ /** @internal */
48
+ _typeConnectionSourceTranslation: Nullable<(source: NodeParticleBlockConnectionPointTypes) => NodeParticleBlockConnectionPointTypes>;
49
+ /** @internal */
50
+ _defaultConnectionPointType: Nullable<NodeParticleBlockConnectionPointTypes>;
51
+ /** @internal */
52
+ _isMainLinkSource: boolean;
53
+ /** Gets the direction of the point */
54
+ get direction(): NodeParticleConnectionPointDirection;
55
+ /**
56
+ * Gets or sets the additional types supported by this connection point
57
+ */
58
+ acceptedConnectionPointTypes: NodeParticleBlockConnectionPointTypes[];
59
+ /**
60
+ * Gets or sets the additional types excluded by this connection point
61
+ */
62
+ excludedConnectionPointTypes: NodeParticleBlockConnectionPointTypes[];
63
+ /**
64
+ * Observable triggered when this point is connected
65
+ */
66
+ onConnectionObservable: Observable<NodeParticleConnectionPoint>;
67
+ /**
68
+ * Observable triggered when this point is disconnected
69
+ */
70
+ onDisconnectionObservable: Observable<NodeParticleConnectionPoint>;
71
+ /**
72
+ * Gets or sets a boolean indicating that this connection point is exposed on a frame
73
+ */
74
+ isExposedOnFrame: boolean;
75
+ /**
76
+ * Gets or sets number indicating the position that the port is exposed to on a frame
77
+ */
78
+ exposedPortPosition: number;
79
+ /**
80
+ * Gets the default value used for this point at creation time
81
+ */
82
+ defaultValue: Nullable<any>;
83
+ /**
84
+ * Gets or sets the default value used for this point if nothing is connected
85
+ */
86
+ value: Nullable<any>;
87
+ /**
88
+ * Gets or sets the min value accepted for this point if nothing is connected
89
+ */
90
+ valueMin: Nullable<any>;
91
+ /**
92
+ * Gets or sets the max value accepted for this point if nothing is connected
93
+ */
94
+ valueMax: Nullable<any>;
95
+ /**
96
+ * Gets or sets the connection point type (default is float)
97
+ */
98
+ get type(): NodeParticleBlockConnectionPointTypes;
99
+ set type(value: NodeParticleBlockConnectionPointTypes);
100
+ /**
101
+ * Gets or sets the connection point name
102
+ */
103
+ name: string;
104
+ /**
105
+ * Gets or sets the connection point display name
106
+ */
107
+ displayName: string;
108
+ /**
109
+ * Gets or sets a boolean indicating that this connection point can be omitted
110
+ */
111
+ isOptional: boolean;
112
+ /**
113
+ * Gets a boolean indicating that the current point is connected to another NodeMaterialBlock
114
+ */
115
+ get isConnected(): boolean;
116
+ /** Get the other side of the connection (if any) */
117
+ get connectedPoint(): Nullable<NodeParticleConnectionPoint>;
118
+ /** Get the block that owns this connection point */
119
+ get ownerBlock(): NodeParticleBlock;
120
+ /** Get the block connected on the other side of this connection (if any) */
121
+ get sourceBlock(): Nullable<NodeParticleBlock>;
122
+ /** Get the block connected on the endpoints of this connection (if any) */
123
+ get connectedBlocks(): Array<NodeParticleBlock>;
124
+ /** Gets the list of connected endpoints */
125
+ get endpoints(): NodeParticleConnectionPoint[];
126
+ /** Gets a boolean indicating if that output point is connected to at least one input */
127
+ get hasEndpoints(): boolean;
128
+ /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */
129
+ get innerType(): NodeParticleBlockConnectionPointTypes;
130
+ /**
131
+ * Creates a new connection point
132
+ * @param name defines the connection point name
133
+ * @param ownerBlock defines the block hosting this connection point
134
+ * @param direction defines the direction of the connection point
135
+ */
136
+ constructor(name: string, ownerBlock: NodeParticleBlock, direction: NodeParticleConnectionPointDirection);
137
+ /**
138
+ * Gets the current class name e.g. "NodeMaterialConnectionPoint"
139
+ * @returns the class name
140
+ */
141
+ getClassName(): string;
142
+ /**
143
+ * Gets the value represented by this connection point
144
+ * @param state current evaluation state
145
+ * @returns the connected value or the value if nothing is connected
146
+ */
147
+ getConnectedValue(state: NodeParticleBuildState): any;
148
+ /**
149
+ * Gets a boolean indicating if the current point can be connected to another point
150
+ * @param connectionPoint defines the other connection point
151
+ * @returns a boolean
152
+ */
153
+ canConnectTo(connectionPoint: NodeParticleConnectionPoint): boolean;
154
+ /**
155
+ * Gets a number indicating if the current point can be connected to another point
156
+ * @param connectionPoint defines the other connection point
157
+ * @returns a number defining the compatibility state
158
+ */
159
+ checkCompatibilityState(connectionPoint: NodeParticleConnectionPoint): NodeParticleConnectionPointCompatibilityStates;
160
+ /**
161
+ * Connect this point to another connection point
162
+ * @param connectionPoint defines the other connection point
163
+ * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)
164
+ * @returns the current connection point
165
+ */
166
+ connectTo(connectionPoint: NodeParticleConnectionPoint, ignoreConstraints?: boolean): NodeParticleConnectionPoint;
167
+ /**
168
+ * Disconnect this point from one of his endpoint
169
+ * @param endpoint defines the other connection point
170
+ * @returns the current connection point
171
+ */
172
+ disconnectFrom(endpoint: NodeParticleConnectionPoint): NodeParticleConnectionPoint;
173
+ /**
174
+ * Fill the list of excluded connection point types with all types other than those passed in the parameter
175
+ * @param mask Types (ORed values of NodeMaterialBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list
176
+ */
177
+ addExcludedConnectionPointFromAllowedTypes(mask: number): void;
178
+ /**
179
+ * Serializes this point in a JSON representation
180
+ * @param isInput defines if the connection point is an input (default is true)
181
+ * @returns the serialized point object
182
+ */
183
+ serialize(isInput?: boolean): any;
184
+ /**
185
+ * Release resources
186
+ */
187
+ dispose(): void;
188
+ }