@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,52 @@
1
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
+ /**
4
+ * Locks supported by the random block
5
+ */
6
+ export declare enum ParticleRandomBlockLocks {
7
+ /** None */
8
+ None = 0,
9
+ /** PerParticle */
10
+ PerParticle = 1,
11
+ /** PerSystem */
12
+ PerSystem = 2
13
+ }
14
+ /**
15
+ * Block used to get a random number
16
+ */
17
+ export declare class ParticleRandomBlock extends NodeParticleBlock {
18
+ private _currentLockId;
19
+ /**
20
+ * Gets or sets a value indicating if that block will lock its value for a specific event
21
+ */
22
+ lockMode: ParticleRandomBlockLocks;
23
+ /**
24
+ * Create a new ParticleRandomBlock
25
+ * @param name defines the block name
26
+ */
27
+ constructor(name: string);
28
+ /**
29
+ * Gets the current class name
30
+ * @returns the class name
31
+ */
32
+ getClassName(): string;
33
+ /**
34
+ * Gets the min input component
35
+ */
36
+ get min(): NodeParticleConnectionPoint;
37
+ /**
38
+ * Gets the max input component
39
+ */
40
+ get max(): NodeParticleConnectionPoint;
41
+ /**
42
+ * Gets the geometry output component
43
+ */
44
+ get output(): NodeParticleConnectionPoint;
45
+ _build(): void;
46
+ /**
47
+ * Serializes this block in a JSON representation
48
+ * @returns the serialized block object
49
+ */
50
+ serialize(): any;
51
+ _deserialize(serializationObject: any): void;
52
+ }
@@ -0,0 +1,161 @@
1
+ import { __decorate } from "../../../tslib.es6.js";
2
+ import { RegisterClass } from "../../../Misc/typeStore.js";
3
+ import { Vector2, Vector3 } from "../../../Maths/math.vector.js";
4
+ import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
5
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
6
+ import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
7
+ import { Color4 } from "../../../Maths/math.color.js";
8
+ /**
9
+ * Locks supported by the random block
10
+ */
11
+ export var ParticleRandomBlockLocks;
12
+ (function (ParticleRandomBlockLocks) {
13
+ /** None */
14
+ ParticleRandomBlockLocks[ParticleRandomBlockLocks["None"] = 0] = "None";
15
+ /** PerParticle */
16
+ ParticleRandomBlockLocks[ParticleRandomBlockLocks["PerParticle"] = 1] = "PerParticle";
17
+ /** PerSystem */
18
+ ParticleRandomBlockLocks[ParticleRandomBlockLocks["PerSystem"] = 2] = "PerSystem";
19
+ })(ParticleRandomBlockLocks || (ParticleRandomBlockLocks = {}));
20
+ /**
21
+ * Block used to get a random number
22
+ */
23
+ export class ParticleRandomBlock extends NodeParticleBlock {
24
+ /**
25
+ * Create a new ParticleRandomBlock
26
+ * @param name defines the block name
27
+ */
28
+ constructor(name) {
29
+ super(name);
30
+ this._currentLockId = -2;
31
+ /**
32
+ * Gets or sets a value indicating if that block will lock its value for a specific event
33
+ */
34
+ this.lockMode = ParticleRandomBlockLocks.PerParticle;
35
+ this.registerInput("min", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 0);
36
+ this.registerInput("max", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 1);
37
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
38
+ this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeParticleBlockConnectionPointTypes.Float |
39
+ NodeParticleBlockConnectionPointTypes.Int |
40
+ NodeParticleBlockConnectionPointTypes.Vector2 |
41
+ NodeParticleBlockConnectionPointTypes.Vector3 |
42
+ NodeParticleBlockConnectionPointTypes.Color4);
43
+ this._inputs[1].addExcludedConnectionPointFromAllowedTypes(NodeParticleBlockConnectionPointTypes.Float |
44
+ NodeParticleBlockConnectionPointTypes.Int |
45
+ NodeParticleBlockConnectionPointTypes.Vector2 |
46
+ NodeParticleBlockConnectionPointTypes.Vector3 |
47
+ NodeParticleBlockConnectionPointTypes.Color4);
48
+ this._outputs[0]._typeConnectionSource = this._inputs[0];
49
+ this._outputs[0]._defaultConnectionPointType = NodeParticleBlockConnectionPointTypes.Float;
50
+ this._linkConnectionTypes(0, 1);
51
+ }
52
+ /**
53
+ * Gets the current class name
54
+ * @returns the class name
55
+ */
56
+ getClassName() {
57
+ return "ParticleRandomBlock";
58
+ }
59
+ /**
60
+ * Gets the min input component
61
+ */
62
+ get min() {
63
+ return this._inputs[0];
64
+ }
65
+ /**
66
+ * Gets the max input component
67
+ */
68
+ get max() {
69
+ return this._inputs[1];
70
+ }
71
+ /**
72
+ * Gets the geometry output component
73
+ */
74
+ get output() {
75
+ return this._outputs[0];
76
+ }
77
+ _build() {
78
+ let func = null;
79
+ this._currentLockId = -2;
80
+ switch (this.min.type) {
81
+ case NodeParticleBlockConnectionPointTypes.AutoDetect:
82
+ case NodeParticleBlockConnectionPointTypes.Int:
83
+ case NodeParticleBlockConnectionPointTypes.Float: {
84
+ func = (state) => {
85
+ const min = this.min.getConnectedValue(state) || 0;
86
+ const max = this.max.getConnectedValue(state) || 1;
87
+ return min + Math.random() * (max - min);
88
+ };
89
+ break;
90
+ }
91
+ case NodeParticleBlockConnectionPointTypes.Vector2: {
92
+ func = (state) => {
93
+ const min = this.min.getConnectedValue(state) || Vector2.Zero();
94
+ const max = this.max.getConnectedValue(state) || Vector2.One();
95
+ return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));
96
+ };
97
+ break;
98
+ }
99
+ case NodeParticleBlockConnectionPointTypes.Vector3: {
100
+ func = (state) => {
101
+ const min = this.min.getConnectedValue(state) || Vector3.Zero();
102
+ const max = this.max.getConnectedValue(state) || Vector3.One();
103
+ return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));
104
+ };
105
+ break;
106
+ }
107
+ case NodeParticleBlockConnectionPointTypes.Color4: {
108
+ func = (state) => {
109
+ const min = this.min.getConnectedValue(state) || new Color4(0, 0, 0, 0);
110
+ const max = this.max.getConnectedValue(state) || new Color4(1, 1, 1, 1);
111
+ return new Color4(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z), min.w + Math.random() * (max.w - min.w));
112
+ };
113
+ break;
114
+ }
115
+ }
116
+ this.output._storedFunction = (state) => {
117
+ let lockId = 0;
118
+ switch (this.lockMode) {
119
+ case ParticleRandomBlockLocks.PerParticle:
120
+ lockId = state.particleContext?.id || -1;
121
+ break;
122
+ case ParticleRandomBlockLocks.PerSystem:
123
+ lockId = state.buildId || 0;
124
+ break;
125
+ }
126
+ if (this._currentLockId !== lockId) {
127
+ if (this.lockMode !== ParticleRandomBlockLocks.None) {
128
+ this._currentLockId = lockId;
129
+ }
130
+ this.output._storedValue = func(state);
131
+ }
132
+ return this.output._storedValue;
133
+ };
134
+ }
135
+ /**
136
+ * Serializes this block in a JSON representation
137
+ * @returns the serialized block object
138
+ */
139
+ serialize() {
140
+ const serializationObject = super.serialize();
141
+ serializationObject.lockMode = this.lockMode;
142
+ return serializationObject;
143
+ }
144
+ _deserialize(serializationObject) {
145
+ super._deserialize(serializationObject);
146
+ this.lockMode = serializationObject.lockMode;
147
+ }
148
+ }
149
+ __decorate([
150
+ editableInPropertyPage("LockMode", 4 /* PropertyTypeForEdition.List */, "ADVANCED", {
151
+ notifiers: { rebuild: true },
152
+ embedded: true,
153
+ options: [
154
+ { label: "None", value: ParticleRandomBlockLocks.None },
155
+ { label: "Per particle", value: ParticleRandomBlockLocks.PerParticle },
156
+ { label: "Per system", value: ParticleRandomBlockLocks.PerSystem },
157
+ ],
158
+ })
159
+ ], ParticleRandomBlock.prototype, "lockMode", void 0);
160
+ RegisterClass("BABYLON.ParticleRandomBlock", ParticleRandomBlock);
161
+ //# sourceMappingURL=particleRandomBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleRandomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleRandomBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAE/C;;GAEG;AACH,MAAM,CAAN,IAAY,wBAOX;AAPD,WAAY,wBAAwB;IAChC,WAAW;IACX,uEAAQ,CAAA;IACR,kBAAkB;IAClB,qFAAe,CAAA;IACf,gBAAgB;IAChB,iFAAa,CAAA;AACjB,CAAC,EAPW,wBAAwB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E,CAAC;gBACjC,IAAI,IAAI,CAAC,QAAQ,KAAK,wBAAwB,CAAC,IAAI,EAAE,CAAC;oBAClD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;gBACjC,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAK,CAAC,KAAK,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACpC,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AApJU;IATN,sBAAsB,CAAC,UAAU,uCAA+B,UAAU,EAAE;QACzE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE;YACvD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,CAAC,WAAW,EAAE;YACtE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,wBAAwB,CAAC,SAAS,EAAE;SACrE;KACJ,CAAC;qDACqD;AAsJ3D,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum ParticleRandomBlockLocks {\r\n /** None */\r\n None = 0,\r\n /** PerParticle */\r\n PerParticle = 1,\r\n /** PerSystem */\r\n PerSystem = 2,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class ParticleRandomBlock extends NodeParticleBlock {\r\n private _currentLockId = -2;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific event\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"None\", value: ParticleRandomBlockLocks.None },\r\n { label: \"Per particle\", value: ParticleRandomBlockLocks.PerParticle },\r\n { label: \"Per system\", value: ParticleRandomBlockLocks.PerSystem },\r\n ],\r\n })\r\n public lockMode = ParticleRandomBlockLocks.PerParticle;\r\n\r\n /**\r\n * Create a new ParticleRandomBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"min\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 0);\r\n this.registerInput(\"max\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._outputs[0]._defaultConnectionPointType = NodeParticleBlockConnectionPointTypes.Float;\r\n this._linkConnectionTypes(0, 1);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleRandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build() {\r\n let func: Nullable<(state: NodeParticleBuildState) => any> = null;\r\n this._currentLockId = -2;\r\n\r\n switch (this.min.type) {\r\n case NodeParticleBlockConnectionPointTypes.AutoDetect:\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 1;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.One();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.One();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || new Color4(0, 0, 0, 0);\r\n const max = this.max.getConnectedValue(state) || new Color4(1, 1, 1, 1);\r\n return new Color4(\r\n min.x + Math.random() * (max.x - min.x),\r\n min.y + Math.random() * (max.y - min.y),\r\n min.z + Math.random() * (max.z - min.z),\r\n min.w + Math.random() * (max.w - min.w)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case ParticleRandomBlockLocks.PerParticle:\r\n lockId = state.particleContext?.id || -1;\r\n break;\r\n case ParticleRandomBlockLocks.PerSystem:\r\n lockId = state.buildId || 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId) {\r\n if (this.lockMode !== ParticleRandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n }\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\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 override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleRandomBlock\", ParticleRandomBlock);\r\n"]}
@@ -0,0 +1,65 @@
1
+ import { Texture } from "../../../Materials/Textures/texture.js";
2
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
3
+ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
4
+ import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
5
+ import type { Nullable } from "../../../types.js";
6
+ /**
7
+ * Block used to provide a texture for particles in a particle system
8
+ */
9
+ export declare class ParticleTextureSourceBlock extends NodeParticleBlock {
10
+ private _url;
11
+ private _textureDataUrl;
12
+ private _sourceTexture;
13
+ private _cachedData;
14
+ /**
15
+ * Indicates if the texture data should be serialized as a base64 string.
16
+ */
17
+ serializedCachedData: boolean;
18
+ /**
19
+ * Gets or sets the URL of the texture to be used by this block.
20
+ */
21
+ get url(): string;
22
+ set url(value: string);
23
+ /**
24
+ * Gets or sets the data URL of the texture to be used by this block.
25
+ * This is a base64 encoded string representing the texture data.
26
+ */
27
+ get textureDataUrl(): string;
28
+ set textureDataUrl(value: string);
29
+ /**
30
+ * Directly sets the texture to be used by this block.
31
+ * This value will not be serialized.
32
+ */
33
+ set sourceTexture(value: Nullable<Texture>);
34
+ /**
35
+ * Create a new ParticleTextureSourceBlock
36
+ * @param name defines the block name
37
+ */
38
+ constructor(name: string);
39
+ /**
40
+ * Gets the current class name
41
+ * @returns the class name
42
+ */
43
+ getClassName(): string;
44
+ /**
45
+ * Gets the texture output component
46
+ */
47
+ get texture(): NodeParticleConnectionPoint;
48
+ /**
49
+ * Gets the texture content as a promise
50
+ * @returns a promise that resolves to the texture content, including width, height, and pixel data
51
+ */
52
+ extractTextureContentAsync(): Promise<{
53
+ width: number;
54
+ height: number;
55
+ data: Uint8ClampedArray;
56
+ } | null>;
57
+ /**
58
+ * Builds the block
59
+ * @param state defines the current build state
60
+ */
61
+ _build(state: NodeParticleBuildState): void;
62
+ serialize(): any;
63
+ _deserialize(serializationObject: any): void;
64
+ dispose(): void;
65
+ }
@@ -0,0 +1,173 @@
1
+ import { Texture } from "../../../Materials/Textures/texture.js";
2
+ import { RegisterClass } from "../../../Misc/typeStore.js";
3
+ import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
4
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
5
+ import { TextureTools } from "../../../Misc/textureTools.js";
6
+ /**
7
+ * Block used to provide a texture for particles in a particle system
8
+ */
9
+ export class ParticleTextureSourceBlock extends NodeParticleBlock {
10
+ /**
11
+ * Gets or sets the URL of the texture to be used by this block.
12
+ */
13
+ get url() {
14
+ return this._url;
15
+ }
16
+ set url(value) {
17
+ if (this._url === value) {
18
+ return;
19
+ }
20
+ this._cachedData = null;
21
+ this._url = value;
22
+ this._textureDataUrl = "";
23
+ this._sourceTexture = null;
24
+ }
25
+ /**
26
+ * Gets or sets the data URL of the texture to be used by this block.
27
+ * This is a base64 encoded string representing the texture data.
28
+ */
29
+ get textureDataUrl() {
30
+ return this._textureDataUrl;
31
+ }
32
+ set textureDataUrl(value) {
33
+ if (this._textureDataUrl === value) {
34
+ return;
35
+ }
36
+ this._cachedData = null;
37
+ this._textureDataUrl = value;
38
+ this._url = "";
39
+ this._sourceTexture = null;
40
+ }
41
+ /**
42
+ * Directly sets the texture to be used by this block.
43
+ * This value will not be serialized.
44
+ */
45
+ set sourceTexture(value) {
46
+ if (this._sourceTexture === value) {
47
+ return;
48
+ }
49
+ this._cachedData = null;
50
+ this._sourceTexture = value;
51
+ this._url = "";
52
+ this._textureDataUrl = "";
53
+ }
54
+ /**
55
+ * Create a new ParticleTextureSourceBlock
56
+ * @param name defines the block name
57
+ */
58
+ constructor(name) {
59
+ super(name);
60
+ this._url = "";
61
+ this._textureDataUrl = "";
62
+ this._sourceTexture = null;
63
+ this._cachedData = null;
64
+ /**
65
+ * Indicates if the texture data should be serialized as a base64 string.
66
+ */
67
+ this.serializedCachedData = false;
68
+ this.registerOutput("texture", NodeParticleBlockConnectionPointTypes.Texture);
69
+ }
70
+ /**
71
+ * Gets the current class name
72
+ * @returns the class name
73
+ */
74
+ getClassName() {
75
+ return "ParticleTextureSourceBlock";
76
+ }
77
+ /**
78
+ * Gets the texture output component
79
+ */
80
+ get texture() {
81
+ return this._outputs[0];
82
+ }
83
+ /**
84
+ * Gets the texture content as a promise
85
+ * @returns a promise that resolves to the texture content, including width, height, and pixel data
86
+ */
87
+ async extractTextureContentAsync() {
88
+ if (!this.texture._storedValue) {
89
+ return null;
90
+ }
91
+ if (this._cachedData) {
92
+ return this._cachedData;
93
+ }
94
+ const texture = this.texture._storedValue;
95
+ return await new Promise((resolve, reject) => {
96
+ if (!texture.isReady()) {
97
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
98
+ texture.onLoadObservable.addOnce(async () => {
99
+ try {
100
+ this._cachedData = await this.extractTextureContentAsync();
101
+ resolve(this._cachedData);
102
+ }
103
+ catch (e) {
104
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
105
+ reject(e);
106
+ }
107
+ });
108
+ return;
109
+ }
110
+ const size = texture.getSize();
111
+ TextureTools.GetTextureDataAsync(texture, size.width, size.height)
112
+ // eslint-disable-next-line github/no-then
113
+ .then((data) => {
114
+ this._cachedData = {
115
+ width: size.width,
116
+ height: size.height,
117
+ data: new Uint8ClampedArray(data),
118
+ };
119
+ texture.dispose();
120
+ resolve(this._cachedData);
121
+ })
122
+ // eslint-disable-next-line github/no-then
123
+ .catch(reject);
124
+ });
125
+ }
126
+ /**
127
+ * Builds the block
128
+ * @param state defines the current build state
129
+ */
130
+ _build(state) {
131
+ if (this._sourceTexture) {
132
+ this.texture._storedValue = this._sourceTexture;
133
+ return;
134
+ }
135
+ if (!this._textureDataUrl && !this._url) {
136
+ this.texture._storedValue = null;
137
+ return;
138
+ }
139
+ if (this._textureDataUrl) {
140
+ this.texture._storedValue = new Texture(this._textureDataUrl, state.scene);
141
+ return;
142
+ }
143
+ this.texture._storedValue = new Texture(this._url, state.scene);
144
+ }
145
+ serialize() {
146
+ const serializationObject = super.serialize();
147
+ serializationObject.url = this.url;
148
+ serializationObject.serializedCachedData = this.serializedCachedData;
149
+ if (this.serializedCachedData) {
150
+ serializationObject.textureDataUrl = this.textureDataUrl;
151
+ }
152
+ return serializationObject;
153
+ }
154
+ _deserialize(serializationObject) {
155
+ super._deserialize(serializationObject);
156
+ this.url = serializationObject.url;
157
+ this.serializedCachedData = !!serializationObject.serializedCachedData;
158
+ if (serializationObject.textureDataUrl) {
159
+ this.textureDataUrl = serializationObject.textureDataUrl;
160
+ }
161
+ }
162
+ dispose() {
163
+ if (!this._sourceTexture) {
164
+ if (this.texture._storedValue) {
165
+ this.texture._storedValue.dispose();
166
+ this.texture._storedValue = null;
167
+ }
168
+ }
169
+ super.dispose();
170
+ }
171
+ }
172
+ RegisterClass("BABYLON.ParticleTextureSourceBlock", ParticleTextureSourceBlock);
173
+ //# sourceMappingURL=particleSourceTextureBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AAEtD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAe7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,GAAG,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IA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AoB,CAAC;QAEvE,IAAI,mBAAmB,CAAC,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QAC7D,CAAC;IACL,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<Texture> = null;\r\n private _cachedData: Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }> = null;\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<Texture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n this.texture._storedValue = new Texture(this._textureDataUrl, state.scene);\r\n return;\r\n }\r\n\r\n this.texture._storedValue = new Texture(this._url, state.scene);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n public override dispose(): void {\r\n if (!this._sourceTexture) {\r\n if (this.texture._storedValue) {\r\n this.texture._storedValue.dispose();\r\n this.texture._storedValue = null;\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
@@ -0,0 +1,80 @@
1
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
+ import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
4
+ /**
5
+ * Operations supported by the Trigonometry block
6
+ */
7
+ export declare enum ParticleTrigonometryBlockOperations {
8
+ /** Cos */
9
+ Cos = 0,
10
+ /** Sin */
11
+ Sin = 1,
12
+ /** Abs */
13
+ Abs = 2,
14
+ /** Exp */
15
+ Exp = 3,
16
+ /** Exp2 */
17
+ Exp2 = 4,
18
+ /** Round */
19
+ Round = 5,
20
+ /** Floor */
21
+ Floor = 6,
22
+ /** Ceiling */
23
+ Ceiling = 7,
24
+ /** Square root */
25
+ Sqrt = 8,
26
+ /** Log */
27
+ Log = 9,
28
+ /** Tangent */
29
+ Tan = 10,
30
+ /** Arc tangent */
31
+ ArcTan = 11,
32
+ /** Arc cosinus */
33
+ ArcCos = 12,
34
+ /** Arc sinus */
35
+ ArcSin = 13,
36
+ /** Sign */
37
+ Sign = 14,
38
+ /** Negate */
39
+ Negate = 15,
40
+ /** OneMinus */
41
+ OneMinus = 16,
42
+ /** Reciprocal */
43
+ Reciprocal = 17,
44
+ /** ToDegrees */
45
+ ToDegrees = 18,
46
+ /** ToRadians */
47
+ ToRadians = 19,
48
+ /** Fract */
49
+ Fract = 20
50
+ }
51
+ /**
52
+ * Block used to apply trigonometry operation to floats
53
+ */
54
+ export declare class ParticleTrigonometryBlock extends NodeParticleBlock {
55
+ /**
56
+ * Gets or sets the operation applied by the block
57
+ */
58
+ operation: ParticleTrigonometryBlockOperations;
59
+ /**
60
+ * Creates a new GeometryTrigonometryBlock
61
+ * @param name defines the block name
62
+ */
63
+ constructor(name: string);
64
+ /**
65
+ * Gets the current class name
66
+ * @returns the class name
67
+ */
68
+ getClassName(): string;
69
+ /**
70
+ * Gets the input component
71
+ */
72
+ get input(): NodeParticleConnectionPoint;
73
+ /**
74
+ * Gets the output component
75
+ */
76
+ get output(): NodeParticleConnectionPoint;
77
+ _build(state: NodeParticleBuildState): this | undefined;
78
+ serialize(): any;
79
+ _deserialize(serializationObject: any): void;
80
+ }