@onerjs/core 8.41.5 → 8.41.7

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 (579) hide show
  1. package/Animations/animation.d.ts +6 -2
  2. package/Animations/animation.js +28 -4
  3. package/Animations/animation.js.map +1 -1
  4. package/Animations/animationGroup.d.ts +2 -1
  5. package/Animations/animationGroup.js +3 -2
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/Animations/animatorAvatar.d.ts +161 -0
  8. package/Animations/animatorAvatar.js +573 -0
  9. package/Animations/animatorAvatar.js.map +1 -0
  10. package/Animations/index.d.ts +1 -0
  11. package/Animations/index.js +1 -0
  12. package/Animations/index.js.map +1 -1
  13. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -2
  14. package/AudioV2/webAudio/webAudioSoundSource.js +12 -2
  15. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  16. package/Bones/index.d.ts +1 -0
  17. package/Bones/index.js +1 -0
  18. package/Bones/index.js.map +1 -1
  19. package/Bones/skeleton.d.ts +13 -0
  20. package/Bones/skeleton.functions.d.ts +26 -0
  21. package/Bones/skeleton.functions.js +91 -0
  22. package/Bones/skeleton.functions.js.map +1 -0
  23. package/Bones/skeleton.js +26 -0
  24. package/Bones/skeleton.js.map +1 -1
  25. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +16 -0
  26. package/Cameras/Inputs/geospatialCameraPointersInput.js +19 -3
  27. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  28. package/Cameras/Limits/geospatialLimits.d.ts +0 -6
  29. package/Cameras/Limits/geospatialLimits.js +0 -6
  30. package/Cameras/Limits/geospatialLimits.js.map +1 -1
  31. package/Cameras/geospatialCamera.d.ts +5 -0
  32. package/Cameras/geospatialCamera.js +54 -25
  33. package/Cameras/geospatialCamera.js.map +1 -1
  34. package/Cameras/geospatialCameraMovement.d.ts +8 -1
  35. package/Cameras/geospatialCameraMovement.js +29 -8
  36. package/Cameras/geospatialCameraMovement.js.map +1 -1
  37. package/Collisions/gpuPicker.d.ts +11 -0
  38. package/Collisions/gpuPicker.js +148 -19
  39. package/Collisions/gpuPicker.js.map +1 -1
  40. package/Debug/skeletonViewer.d.ts +4 -8
  41. package/Debug/skeletonViewer.js +13 -22
  42. package/Debug/skeletonViewer.js.map +1 -1
  43. package/Engines/Extensions/engine.multiview.d.ts +2 -0
  44. package/Engines/Extensions/engine.multiview.js +7 -3
  45. package/Engines/Extensions/engine.multiview.js.map +1 -1
  46. package/Engines/abstractEngine.d.ts +2 -2
  47. package/Engines/abstractEngine.js +2 -2
  48. package/Engines/abstractEngine.js.map +1 -1
  49. package/Engines/constants.d.ts +4 -0
  50. package/Engines/constants.js +4 -0
  51. package/Engines/constants.js.map +1 -1
  52. package/Engines/webgpuEngine.d.ts +1 -4
  53. package/Engines/webgpuEngine.js +8 -6
  54. package/Engines/webgpuEngine.js.map +1 -1
  55. package/FrameGraph/frameGraphContext.js +1 -1
  56. package/FrameGraph/frameGraphContext.js.map +1 -1
  57. package/FrameGraph/frameGraphRenderContext.js +2 -2
  58. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  59. package/Instrumentation/engineInstrumentation.js +2 -1
  60. package/Instrumentation/engineInstrumentation.js.map +1 -1
  61. package/Layers/effectLayer.js +1 -3
  62. package/Layers/effectLayer.js.map +1 -1
  63. package/Lights/Shadows/cascadedShadowGenerator.js +2 -2
  64. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  65. package/Lights/Shadows/shadowGenerator.js +3 -4
  66. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  67. package/Lights/lightingVolume.js +1 -1
  68. package/Lights/lightingVolume.js.map +1 -1
  69. package/Materials/Background/backgroundMaterial.js +37 -2
  70. package/Materials/Background/backgroundMaterial.js.map +1 -1
  71. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +109 -0
  72. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +210 -0
  73. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -0
  74. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +1 -0
  75. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +71 -15
  76. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  77. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +86 -0
  78. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +161 -0
  79. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -0
  80. package/Materials/GreasedLine/greasedLinePluginMaterial.js +0 -6
  81. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  82. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +0 -1
  83. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
  84. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +0 -1
  85. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
  86. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +14 -0
  87. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +14 -0
  88. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +20 -1
  90. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +20 -1
  91. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  92. package/Materials/Node/Blocks/Dual/depthSourceBlock.d.ts +13 -0
  93. package/Materials/Node/Blocks/Dual/depthSourceBlock.js +13 -0
  94. package/Materials/Node/Blocks/Dual/depthSourceBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +21 -0
  96. package/Materials/Node/Blocks/Dual/fogBlock.js +21 -0
  97. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  98. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +21 -0
  99. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +21 -0
  100. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  101. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +38 -0
  102. package/Materials/Node/Blocks/Dual/lightBlock.js +38 -0
  103. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  104. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +29 -0
  105. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +29 -0
  106. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  107. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +5 -0
  108. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +5 -0
  109. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  110. package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +16 -0
  111. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +16 -0
  112. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  113. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +16 -0
  114. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +16 -0
  115. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  116. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +34 -0
  117. package/Materials/Node/Blocks/Dual/textureBlock.js +34 -0
  118. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  119. package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +17 -0
  120. package/Materials/Node/Blocks/Fragment/TBNBlock.js +17 -2
  121. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  122. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.d.ts +7 -0
  123. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js +7 -0
  124. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js.map +1 -1
  125. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +21 -0
  126. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +21 -0
  127. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  128. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +10 -0
  129. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +10 -0
  130. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  131. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +28 -0
  132. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +28 -0
  133. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  134. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +30 -0
  135. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
  136. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  137. package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +4 -0
  138. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +4 -0
  139. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  140. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.d.ts +5 -0
  141. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +5 -0
  142. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
  143. package/Materials/Node/Blocks/Fragment/twirlBlock.d.ts +3 -0
  144. package/Materials/Node/Blocks/Fragment/twirlBlock.js +3 -0
  145. package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
  146. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +6 -0
  147. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -0
  148. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  149. package/Materials/Node/Blocks/Input/inputBlock.d.ts +16 -0
  150. package/Materials/Node/Blocks/Input/inputBlock.js +16 -1
  151. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  152. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +5 -0
  153. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +5 -0
  154. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  155. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +10 -0
  156. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +10 -1
  157. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  158. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +23 -0
  159. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +23 -1
  160. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  161. package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +17 -0
  162. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +17 -0
  163. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  164. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +41 -0
  165. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +41 -0
  166. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  167. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +21 -0
  168. package/Materials/Node/Blocks/PBR/reflectionBlock.js +21 -0
  169. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  170. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +29 -0
  171. package/Materials/Node/Blocks/PBR/refractionBlock.js +29 -0
  172. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  173. package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +14 -0
  174. package/Materials/Node/Blocks/PBR/sheenBlock.js +14 -0
  175. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  176. package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +7 -0
  177. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +7 -0
  178. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  179. package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +23 -0
  180. package/Materials/Node/Blocks/Particle/particleTextureBlock.js +23 -0
  181. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  182. package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
  183. package/Materials/Node/Blocks/Teleport/teleportInBlock.js +6 -0
  184. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  185. package/Materials/Node/Blocks/Teleport/teleportOutBlock.d.ts +17 -0
  186. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +17 -0
  187. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  188. package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +22 -0
  189. package/Materials/Node/Blocks/Vertex/bonesBlock.js +22 -0
  190. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  191. package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +13 -0
  192. package/Materials/Node/Blocks/Vertex/instancesBlock.js +13 -0
  193. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  194. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +20 -0
  195. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +20 -0
  196. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  197. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +27 -0
  198. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +27 -0
  199. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/clampBlock.d.ts +10 -0
  201. package/Materials/Node/Blocks/clampBlock.js +10 -0
  202. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  203. package/Materials/Node/Blocks/cloudBlock.d.ts +10 -0
  204. package/Materials/Node/Blocks/cloudBlock.js +10 -0
  205. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/colorMergerBlock.d.ts +10 -0
  207. package/Materials/Node/Blocks/colorMergerBlock.js +10 -0
  208. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  209. package/Materials/Node/Blocks/conditionalBlock.d.ts +14 -0
  210. package/Materials/Node/Blocks/conditionalBlock.js +14 -0
  211. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/curveBlock.d.ts +10 -0
  213. package/Materials/Node/Blocks/curveBlock.js +10 -0
  214. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  215. package/Materials/Node/Blocks/customBlock.d.ts +10 -0
  216. package/Materials/Node/Blocks/customBlock.js +10 -0
  217. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  218. package/Materials/Node/Blocks/debugBlock.d.ts +10 -0
  219. package/Materials/Node/Blocks/debugBlock.js +10 -0
  220. package/Materials/Node/Blocks/debugBlock.js.map +1 -1
  221. package/Materials/Node/Blocks/fresnelBlock.d.ts +4 -0
  222. package/Materials/Node/Blocks/fresnelBlock.js +4 -0
  223. package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
  224. package/Materials/Node/Blocks/gradientBlock.d.ts +10 -0
  225. package/Materials/Node/Blocks/gradientBlock.js +10 -0
  226. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  227. package/Materials/Node/Blocks/loopBlock.d.ts +10 -0
  228. package/Materials/Node/Blocks/loopBlock.js +10 -0
  229. package/Materials/Node/Blocks/loopBlock.js.map +1 -1
  230. package/Materials/Node/Blocks/matrixBuilderBlock.d.ts +1 -0
  231. package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -0
  232. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  233. package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +10 -0
  234. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +10 -0
  235. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  236. package/Materials/Node/Blocks/pannerBlock.d.ts +5 -0
  237. package/Materials/Node/Blocks/pannerBlock.js +5 -0
  238. package/Materials/Node/Blocks/pannerBlock.js.map +1 -1
  239. package/Materials/Node/Blocks/remapBlock.d.ts +10 -0
  240. package/Materials/Node/Blocks/remapBlock.js +10 -0
  241. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  242. package/Materials/Node/Blocks/rotate2dBlock.d.ts +1 -0
  243. package/Materials/Node/Blocks/rotate2dBlock.js +1 -0
  244. package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
  245. package/Materials/Node/Blocks/transformBlock.d.ts +10 -0
  246. package/Materials/Node/Blocks/transformBlock.js +10 -0
  247. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  248. package/Materials/Node/Blocks/triPlanarBlock.d.ts +22 -0
  249. package/Materials/Node/Blocks/triPlanarBlock.js +22 -0
  250. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  251. package/Materials/Node/Blocks/trigonometryBlock.d.ts +10 -0
  252. package/Materials/Node/Blocks/trigonometryBlock.js +10 -0
  253. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  254. package/Materials/Node/Blocks/vectorMergerBlock.d.ts +10 -0
  255. package/Materials/Node/Blocks/vectorMergerBlock.js +10 -0
  256. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  257. package/Materials/Node/Blocks/viewDirectionBlock.d.ts +5 -0
  258. package/Materials/Node/Blocks/viewDirectionBlock.js +5 -0
  259. package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
  260. package/Materials/Node/Blocks/waveBlock.d.ts +10 -0
  261. package/Materials/Node/Blocks/waveBlock.js +10 -0
  262. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  263. package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +1 -0
  264. package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -0
  265. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  266. package/Materials/Node/nodeMaterial.d.ts +13 -0
  267. package/Materials/Node/nodeMaterial.js +14 -2
  268. package/Materials/Node/nodeMaterial.js.map +1 -1
  269. package/Materials/Node/nodeMaterialBlock.d.ts +0 -3
  270. package/Materials/Node/nodeMaterialBlock.js +1 -6
  271. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  272. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -2
  273. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  274. package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
  275. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  276. package/Materials/Textures/mirrorTexture.js +1 -1
  277. package/Materials/Textures/mirrorTexture.js.map +1 -1
  278. package/Materials/index.d.ts +2 -0
  279. package/Materials/index.js +2 -0
  280. package/Materials/index.js.map +1 -1
  281. package/Maths/math.constants.d.ts +2 -1
  282. package/Maths/math.constants.js +3 -2
  283. package/Maths/math.constants.js.map +1 -1
  284. package/Meshes/Builders/capsuleBuilder.js +0 -3
  285. package/Meshes/Builders/capsuleBuilder.js.map +1 -1
  286. package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
  287. package/Meshes/Builders/cylinderBuilder.js +1 -2
  288. package/Meshes/Builders/cylinderBuilder.js.map +1 -1
  289. package/Meshes/Builders/decalBuilder.js +2 -0
  290. package/Meshes/Builders/decalBuilder.js.map +1 -1
  291. package/Meshes/Builders/discBuilder.js +0 -1
  292. package/Meshes/Builders/discBuilder.js.map +1 -1
  293. package/Meshes/Builders/groundBuilder.d.ts +50 -54
  294. package/Meshes/Builders/groundBuilder.js +50 -54
  295. package/Meshes/Builders/groundBuilder.js.map +1 -1
  296. package/Meshes/Builders/tiledBoxBuilder.d.ts +0 -26
  297. package/Meshes/Builders/tiledBoxBuilder.js +0 -26
  298. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  299. package/Meshes/Builders/tiledPlaneBuilder.d.ts +0 -25
  300. package/Meshes/Builders/tiledPlaneBuilder.js +0 -25
  301. package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
  302. package/Meshes/Builders/torusBuilder.d.ts +0 -13
  303. package/Meshes/Builders/torusBuilder.js +0 -13
  304. package/Meshes/Builders/torusBuilder.js.map +1 -1
  305. package/Meshes/Builders/torusKnotBuilder.d.ts +0 -19
  306. package/Meshes/Builders/torusKnotBuilder.js +0 -19
  307. package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
  308. package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
  309. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  310. package/Meshes/Compression/dracoDecoder.types.d.ts +11 -0
  311. package/Meshes/Compression/dracoDecoder.types.js.map +1 -1
  312. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  313. package/Meshes/Compression/meshoptCompression.js +0 -2
  314. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  315. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +17 -1
  316. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  317. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +0 -8
  318. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  319. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +1 -0
  320. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -0
  321. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  322. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +1 -0
  323. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -0
  324. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  325. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +1 -0
  326. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -0
  327. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  328. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +1 -0
  329. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -0
  330. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  331. package/Meshes/Node/Blocks/Matrices/scalingBlock.d.ts +1 -0
  332. package/Meshes/Node/Blocks/Matrices/scalingBlock.js +1 -0
  333. package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
  334. package/Meshes/Node/Blocks/Matrices/translationBlock.d.ts +1 -0
  335. package/Meshes/Node/Blocks/Matrices/translationBlock.js +1 -0
  336. package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
  337. package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +1 -0
  338. package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
  339. package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
  340. package/Meshes/Node/Blocks/Set/latticeBlock.d.ts +1 -0
  341. package/Meshes/Node/Blocks/Set/latticeBlock.js +1 -0
  342. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  343. package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +1 -0
  344. package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -0
  345. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  346. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +1 -0
  347. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -0
  348. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  349. package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -0
  350. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -0
  351. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  352. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +1 -0
  353. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -0
  354. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  355. package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +1 -0
  356. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -0
  357. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  358. package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +1 -0
  359. package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -0
  360. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  361. package/Meshes/Node/Blocks/Sources/boxBlock.d.ts +2 -0
  362. package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -0
  363. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  364. package/Meshes/Node/Blocks/Sources/capsuleBlock.d.ts +2 -0
  365. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -0
  366. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  367. package/Meshes/Node/Blocks/Sources/cylinderBlock.d.ts +2 -0
  368. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -0
  369. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  370. package/Meshes/Node/Blocks/Sources/discBlock.d.ts +2 -0
  371. package/Meshes/Node/Blocks/Sources/discBlock.js +2 -0
  372. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  373. package/Meshes/Node/Blocks/Sources/gridBlock.d.ts +2 -0
  374. package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -0
  375. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  376. package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +2 -0
  377. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -0
  378. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  379. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -0
  380. package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -0
  381. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  382. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +2 -0
  383. package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -0
  384. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  385. package/Meshes/Node/Blocks/Sources/pointListBlock.d.ts +2 -1
  386. package/Meshes/Node/Blocks/Sources/pointListBlock.js +2 -1
  387. package/Meshes/Node/Blocks/Sources/pointListBlock.js.map +1 -1
  388. package/Meshes/Node/Blocks/Sources/sphereBlock.d.ts +2 -0
  389. package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -0
  390. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  391. package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +2 -0
  392. package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -0
  393. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  394. package/Meshes/Node/Blocks/Teleport/teleportInBlock.d.ts +1 -0
  395. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
  396. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  397. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.d.ts +3 -0
  398. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +3 -0
  399. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  400. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -0
  401. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
  402. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  403. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +1 -0
  404. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -0
  405. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  406. package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +1 -0
  407. package/Meshes/Node/Blocks/booleanGeometryBlock.js +1 -1
  408. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  409. package/Meshes/Node/Blocks/cleanGeometryBlock.d.ts +1 -0
  410. package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -0
  411. package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
  412. package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
  413. package/Meshes/Node/Blocks/conditionBlock.js +2 -0
  414. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  415. package/Meshes/Node/Blocks/geometryClampBlock.d.ts +1 -0
  416. package/Meshes/Node/Blocks/geometryClampBlock.js +1 -0
  417. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  418. package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +1 -0
  419. package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -0
  420. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  421. package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +2 -0
  422. package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -0
  423. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  424. package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +2 -0
  425. package/Meshes/Node/Blocks/geometryEaseBlock.js +2 -0
  426. package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -1
  427. package/Meshes/Node/Blocks/geometryInputBlock.d.ts +3 -0
  428. package/Meshes/Node/Blocks/geometryInputBlock.js +3 -0
  429. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  430. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +1 -0
  431. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +1 -0
  432. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  433. package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +1 -0
  434. package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -0
  435. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  436. package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +2 -0
  437. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -0
  438. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  439. package/Meshes/Node/Blocks/mappingBlock.d.ts +1 -0
  440. package/Meshes/Node/Blocks/mappingBlock.js +1 -0
  441. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  442. package/Meshes/Node/Blocks/mathBlock.d.ts +1 -0
  443. package/Meshes/Node/Blocks/mathBlock.js +1 -0
  444. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  445. package/Meshes/Node/Blocks/mergeGeometryBlock.d.ts +1 -0
  446. package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -0
  447. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  448. package/Meshes/Node/Blocks/randomBlock.d.ts +2 -0
  449. package/Meshes/Node/Blocks/randomBlock.js +2 -0
  450. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  451. package/Meshes/Node/Blocks/subdivideBlock.d.ts +1 -0
  452. package/Meshes/Node/Blocks/subdivideBlock.js +1 -0
  453. package/Meshes/Node/Blocks/subdivideBlock.js.map +1 -1
  454. package/Meshes/Node/Interfaces/nodeGeometryTextureData.d.ts +3 -0
  455. package/Meshes/Node/Interfaces/nodeGeometryTextureData.js.map +1 -1
  456. package/Meshes/Node/nodeGeometry.js +0 -2
  457. package/Meshes/Node/nodeGeometry.js.map +1 -1
  458. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +0 -1
  459. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  460. package/Meshes/Node/nodeGeometryBuildState.js +0 -1
  461. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  462. package/Meshes/WebGL/webGLDataBuffer.d.ts +2 -0
  463. package/Meshes/WebGL/webGLDataBuffer.js +2 -0
  464. package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
  465. package/Meshes/WebGPU/webgpuDataBuffer.d.ts +4 -0
  466. package/Meshes/WebGPU/webgpuDataBuffer.js +4 -0
  467. package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
  468. package/Meshes/abstractMesh.d.ts +1 -0
  469. package/Meshes/abstractMesh.decalMap.d.ts +1 -0
  470. package/Meshes/abstractMesh.decalMap.js.map +1 -1
  471. package/Meshes/abstractMesh.js +1 -6
  472. package/Meshes/abstractMesh.js.map +1 -1
  473. package/Meshes/csg.js +0 -6
  474. package/Meshes/csg.js.map +1 -1
  475. package/Meshes/csg2.js +1 -2
  476. package/Meshes/csg2.js.map +1 -1
  477. package/Meshes/geodesicMesh.d.ts +26 -0
  478. package/Meshes/geodesicMesh.js +18 -3
  479. package/Meshes/geodesicMesh.js.map +1 -1
  480. package/Meshes/groundMesh.d.ts +1 -0
  481. package/Meshes/groundMesh.js +1 -0
  482. package/Meshes/groundMesh.js.map +1 -1
  483. package/Meshes/index.js +0 -2
  484. package/Meshes/index.js.map +1 -1
  485. package/Meshes/instancedMesh.d.ts +18 -3
  486. package/Meshes/instancedMesh.js +11 -3
  487. package/Meshes/instancedMesh.js.map +1 -1
  488. package/Meshes/mesh.d.ts +291 -204
  489. package/Meshes/mesh.js +290 -213
  490. package/Meshes/mesh.js.map +1 -1
  491. package/Meshes/mesh.vertexData.d.ts +15 -19
  492. package/Meshes/mesh.vertexData.js +15 -19
  493. package/Meshes/mesh.vertexData.js.map +1 -1
  494. package/Meshes/meshSimplification.d.ts +0 -1
  495. package/Meshes/meshSimplification.js +6 -1
  496. package/Meshes/meshSimplification.js.map +1 -1
  497. package/Meshes/meshSimplificationSceneComponent.d.ts +2 -0
  498. package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
  499. package/Meshes/meshUVSpaceRenderer.d.ts +1 -0
  500. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  501. package/Meshes/polygonMesh.js +4 -0
  502. package/Meshes/polygonMesh.js.map +1 -1
  503. package/Meshes/subMesh.project.d.ts +1 -0
  504. package/Meshes/subMesh.project.js.map +1 -1
  505. package/Meshes/thinInstanceMesh.d.ts +5 -0
  506. package/Meshes/thinInstanceMesh.js.map +1 -1
  507. package/Meshes/transformNode.d.ts +1 -1
  508. package/Meshes/transformNode.js +1 -1
  509. package/Meshes/transformNode.js.map +1 -1
  510. package/Misc/dataStorage.d.ts +13 -0
  511. package/Misc/dataStorage.js +25 -0
  512. package/Misc/dataStorage.js.map +1 -1
  513. package/Morph/morphTarget.d.ts +9 -5
  514. package/Morph/morphTarget.js +15 -7
  515. package/Morph/morphTarget.js.map +1 -1
  516. package/Morph/morphTargetManager.d.ts +3 -1
  517. package/Morph/morphTargetManager.js +5 -2
  518. package/Morph/morphTargetManager.js.map +1 -1
  519. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +1 -1
  520. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  521. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +1 -1
  522. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
  523. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +1 -1
  524. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  525. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +1 -1
  526. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  527. package/Particles/Node/Blocks/Emitters/emitters.functions.js +3 -3
  528. package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -1
  529. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +1 -1
  530. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  531. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +1 -1
  532. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  533. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +1 -1
  534. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  535. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +2 -2
  536. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
  537. package/Particles/Node/Blocks/Update/updateNoiseBlock.js +7 -7
  538. package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
  539. package/Particles/Node/Blocks/particleLocalVariableBlock.js +2 -2
  540. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
  541. package/Particles/Node/nodeParticleBuildState.js +7 -7
  542. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  543. package/Particles/Node/nodeParticleSystemSet.helper.js +9 -4
  544. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  545. package/Particles/particle.d.ts +73 -61
  546. package/Particles/particle.js +106 -91
  547. package/Particles/particle.js.map +1 -1
  548. package/Particles/particleSystem.js +5 -5
  549. package/Particles/particleSystem.js.map +1 -1
  550. package/Particles/thinParticleSystem.function.js +83 -83
  551. package/Particles/thinParticleSystem.function.js.map +1 -1
  552. package/Particles/thinParticleSystem.js +8 -8
  553. package/Particles/thinParticleSystem.js.map +1 -1
  554. package/Physics/v2/Plugins/havokPlugin.d.ts +89 -3
  555. package/Physics/v2/Plugins/havokPlugin.js +388 -53
  556. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  557. package/Probes/reflectionProbe.js +10 -7
  558. package/Probes/reflectionProbe.js.map +1 -1
  559. package/Rendering/depthRenderer.js +1 -1
  560. package/Rendering/depthRenderer.js.map +1 -1
  561. package/Rendering/objectRenderer.d.ts +3 -1
  562. package/Rendering/objectRenderer.js +28 -8
  563. package/Rendering/objectRenderer.js.map +1 -1
  564. package/Rendering/reflectiveShadowMap.js +1 -1
  565. package/Rendering/reflectiveShadowMap.js.map +1 -1
  566. package/Rendering/thinDepthPeelingRenderer.js +8 -0
  567. package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
  568. package/Shaders/gaussianSplatting.fragment.js +8 -2
  569. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  570. package/Shaders/gaussianSplatting.vertex.js +8 -2
  571. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  572. package/ShadersWGSL/gaussianSplatting.fragment.js +7 -1
  573. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  574. package/ShadersWGSL/gaussianSplatting.vertex.js +8 -2
  575. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  576. package/package.json +1 -1
  577. package/scene.d.ts +22 -4
  578. package/scene.js +33 -20
  579. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"geometryOptimizeBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryOptimizeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAqBxD;;;OAGG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,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mB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAAC,aAAa,CAAC;IAC3D,CAAC;CACJ;AA5NU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC3G;AAMvB;IADN,sBAAsB,CAAC,SAAS,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;sDACrG;AAMlB;IADN,sBAAsB,CAAC,gBAAgB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4DAC1G;AAkNjC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport type { FloatArray } from \"../../../types\";\r\nimport { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { WithinEpsilon } from \"../../../Maths/math.scalar.functions\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\nimport type { INodeGeometryExecutionContext } from \"../Interfaces/nodeGeometryExecutionContext\";\r\n/**\r\n * Block used to extract unique positions from a geometry\r\n */\r\nexport class GeometryOptimizeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _currentIndex: number;\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Define the epsilon used to compare similar positions\r\n */\r\n @editableInPropertyPage(\"Epsilon\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public epsilon = Epsilon;\r\n\r\n /**\r\n * Optimize faces (by removing duplicates)\r\n */\r\n @editableInPropertyPage(\"Optimize faces\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public optimizeFaces = false;\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Creates a new GeometryOptimizeBlock\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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"selector\", NodeGeometryBlockConnectionPointTypes.Int, true);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"GeometryOptimizeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the selector component\r\n */\r\n public get selector(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n const vertexData = this.geometry.getConnectedValue(state);\r\n const newPositions: FloatArray = [];\r\n const newIndicesMap: { [key: number]: number } = {};\r\n const newUVs: FloatArray = [];\r\n state.pushExecutionContext(this);\r\n state.pushGeometryContext(vertexData);\r\n\r\n // Optimize positions\r\n for (let index = 0; index < vertexData.positions.length; index += 3) {\r\n this._currentIndex = index / 3;\r\n\r\n if (this.selector.isConnected) {\r\n const selector = this.selector.getConnectedValue(state);\r\n if (!selector) {\r\n continue;\r\n }\r\n }\r\n\r\n const x = vertexData.positions[index];\r\n const y = vertexData.positions[index + 1];\r\n const z = vertexData.positions[index + 2];\r\n\r\n const uvIndex = (index / 3) * 2;\r\n const u = vertexData.uvs ? vertexData.uvs[uvIndex] : 0;\r\n const v = vertexData.uvs ? vertexData.uvs[uvIndex + 1] : 0;\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newPositions.length; checkIndex += 3) {\r\n if (\r\n WithinEpsilon(x, newPositions[checkIndex], this.epsilon) &&\r\n WithinEpsilon(y, newPositions[checkIndex + 1], this.epsilon) &&\r\n WithinEpsilon(z, newPositions[checkIndex + 2], this.epsilon)\r\n ) {\r\n newIndicesMap[index / 3] = checkIndex / 3;\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndicesMap[index / 3] = newPositions.length / 3;\r\n newPositions.push(x, y, z);\r\n newUVs.push(u, v);\r\n }\r\n }\r\n const newVertexData = new VertexData();\r\n newVertexData.positions = newPositions;\r\n if (vertexData.uvs) {\r\n newVertexData.uvs = newUVs;\r\n }\r\n const indices: number[] = vertexData.indices.map((index: number) => newIndicesMap[index]);\r\n const newIndices: number[] = [];\r\n\r\n if (this.optimizeFaces) {\r\n // Optimize indices\r\n for (let index = 0; index < indices.length; index += 3) {\r\n const a = indices[index];\r\n const b = indices[index + 1];\r\n const c = indices[index + 2];\r\n\r\n if (a === b || b == c || c === a) {\r\n continue;\r\n }\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newIndices.length; checkIndex += 3) {\r\n if (a === newIndices[checkIndex] && b === newIndices[checkIndex + 1] && c === newIndices[checkIndex + 2]) {\r\n found = true;\r\n continue;\r\n }\r\n\r\n if (a === newIndices[checkIndex + 1] && b === newIndices[checkIndex + 2] && c === newIndices[checkIndex]) {\r\n found = true;\r\n continue;\r\n }\r\n\r\n if (a === newIndices[checkIndex + 2] && b === newIndices[checkIndex] && c === newIndices[checkIndex + 1]) {\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndices.push(a, b, c);\r\n }\r\n }\r\n\r\n newVertexData.indices = newIndices;\r\n } else {\r\n newVertexData.indices = indices;\r\n }\r\n\r\n return newVertexData;\r\n };\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.epsilon = ${this.epsilon};\\n`;\r\n codeString += `${this._codeVariableName}.optimizeFaces = ${this.optimizeFaces ? \"true\" : \"false\"};\\n`;\r\n return codeString;\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.evaluateContext = this.evaluateContext;\r\n serializationObject.epsilon = this.epsilon;\r\n serializationObject.optimizeFaces = this.optimizeFaces;\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.evaluateContext = serializationObject.evaluateContext;\r\n this.epsilon = serializationObject.epsilon;\r\n this.optimizeFaces = serializationObject.optimizeFaces;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryOptimizeBlock\", GeometryOptimizeBlock);\r\n"]}
1
+ {"version":3,"file":"geometryOptimizeBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryOptimizeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAqBxD;;;OAGG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,qBAAqB;QACxB,OAAO,CAAC,CAAC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aAAa,CAAC;QAEvD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACA,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,mBAAmB,CAAC,aAAa,CAAC;IAC3D,CAAC;CACJ;AA7NU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC3G;AAMvB;IADN,sBAAsB,CAAC,SAAS,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;sDACrG;AAMlB;IADN,sBAAsB,CAAC,gBAAgB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4DAC1G;AAmNjC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport type { FloatArray } from \"../../../types\";\r\nimport { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { WithinEpsilon } from \"../../../Maths/math.scalar.functions\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\nimport type { INodeGeometryExecutionContext } from \"../Interfaces/nodeGeometryExecutionContext\";\r\n/**\r\n * Block used to extract unique positions from a geometry\r\n */\r\nexport class GeometryOptimizeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext {\r\n private _currentIndex: number;\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Define the epsilon used to compare similar positions\r\n */\r\n @editableInPropertyPage(\"Epsilon\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public epsilon = Epsilon;\r\n\r\n /**\r\n * Optimize faces (by removing duplicates)\r\n */\r\n @editableInPropertyPage(\"Optimize faces\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public optimizeFaces = false;\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentIndex;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Creates a new GeometryOptimizeBlock\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(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"selector\", NodeGeometryBlockConnectionPointTypes.Int, true);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"GeometryOptimizeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the selector component\r\n */\r\n public get selector(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n if (!this.geometry.isConnected) {\r\n return null;\r\n }\r\n const vertexData = this.geometry.getConnectedValue(state);\r\n const newPositions: FloatArray = [];\r\n const newIndicesMap: { [key: number]: number } = {};\r\n const newUVs: FloatArray = [];\r\n state.pushExecutionContext(this);\r\n state.pushGeometryContext(vertexData);\r\n\r\n // Optimize positions\r\n for (let index = 0; index < vertexData.positions.length; index += 3) {\r\n this._currentIndex = index / 3;\r\n\r\n if (this.selector.isConnected) {\r\n const selector = this.selector.getConnectedValue(state);\r\n if (!selector) {\r\n continue;\r\n }\r\n }\r\n\r\n const x = vertexData.positions[index];\r\n const y = vertexData.positions[index + 1];\r\n const z = vertexData.positions[index + 2];\r\n\r\n const uvIndex = (index / 3) * 2;\r\n const u = vertexData.uvs ? vertexData.uvs[uvIndex] : 0;\r\n const v = vertexData.uvs ? vertexData.uvs[uvIndex + 1] : 0;\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newPositions.length; checkIndex += 3) {\r\n if (\r\n WithinEpsilon(x, newPositions[checkIndex], this.epsilon) &&\r\n WithinEpsilon(y, newPositions[checkIndex + 1], this.epsilon) &&\r\n WithinEpsilon(z, newPositions[checkIndex + 2], this.epsilon)\r\n ) {\r\n newIndicesMap[index / 3] = checkIndex / 3;\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndicesMap[index / 3] = newPositions.length / 3;\r\n newPositions.push(x, y, z);\r\n newUVs.push(u, v);\r\n }\r\n }\r\n const newVertexData = new VertexData();\r\n newVertexData.positions = newPositions;\r\n if (vertexData.uvs) {\r\n newVertexData.uvs = newUVs;\r\n }\r\n const indices: number[] = vertexData.indices.map((index: number) => newIndicesMap[index]);\r\n const newIndices: number[] = [];\r\n\r\n if (this.optimizeFaces) {\r\n // Optimize indices\r\n for (let index = 0; index < indices.length; index += 3) {\r\n const a = indices[index];\r\n const b = indices[index + 1];\r\n const c = indices[index + 2];\r\n\r\n if (a === b || b == c || c === a) {\r\n continue;\r\n }\r\n\r\n // check if we already have it\r\n let found = false;\r\n for (let checkIndex = 0; checkIndex < newIndices.length; checkIndex += 3) {\r\n if (a === newIndices[checkIndex] && b === newIndices[checkIndex + 1] && c === newIndices[checkIndex + 2]) {\r\n found = true;\r\n continue;\r\n }\r\n\r\n if (a === newIndices[checkIndex + 1] && b === newIndices[checkIndex + 2] && c === newIndices[checkIndex]) {\r\n found = true;\r\n continue;\r\n }\r\n\r\n if (a === newIndices[checkIndex + 2] && b === newIndices[checkIndex] && c === newIndices[checkIndex + 1]) {\r\n found = true;\r\n continue;\r\n }\r\n }\r\n\r\n if (!found) {\r\n newIndices.push(a, b, c);\r\n }\r\n }\r\n\r\n newVertexData.indices = newIndices;\r\n } else {\r\n newVertexData.indices = indices;\r\n }\r\n\r\n return newVertexData;\r\n };\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.epsilon = ${this.epsilon};\\n`;\r\n codeString += `${this._codeVariableName}.optimizeFaces = ${this.optimizeFaces ? \"true\" : \"false\"};\\n`;\r\n return codeString;\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.evaluateContext = this.evaluateContext;\r\n serializationObject.epsilon = this.epsilon;\r\n serializationObject.optimizeFaces = this.optimizeFaces;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n this.epsilon = serializationObject.epsilon;\r\n this.optimizeFaces = serializationObject.optimizeFaces;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryOptimizeBlock\", GeometryOptimizeBlock);\r\n"]}
@@ -62,5 +62,6 @@ export declare class GeometryTransformBlock extends NodeGeometryBlock {
62
62
  * @returns the serialized block object
63
63
  */
64
64
  serialize(): any;
65
+ /** @internal */
65
66
  _deserialize(serializationObject: any): void;
66
67
  }
@@ -153,6 +153,7 @@ export class GeometryTransformBlock extends NodeGeometryBlock {
153
153
  serializationObject.evaluateContext = this.evaluateContext;
154
154
  return serializationObject;
155
155
  }
156
+ /** @internal */
156
157
  _deserialize(serializationObject) {
157
158
  super._deserialize(serializationObject);
158
159
  if (serializationObject.evaluateContext !== undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"geometryTransformBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTransformBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,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AC3G;AAwKlC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to apply a transform to a vector / geometry\r\n */\r\nexport class GeometryTransformBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n private _scalingMatrix = new Matrix();\r\n private _translationMatrix = new Matrix();\r\n private _scalingRotationMatrix = new Matrix();\r\n private _pivotMatrix = new Matrix();\r\n private _backPivotMatrix = new Matrix();\r\n private _transformMatrix = new Matrix();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new GeometryTransformBlock\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(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"translation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"pivot\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.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 \"GeometryTransformBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translation input component\r\n */\r\n public get translation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the pivot input component\r\n */\r\n public get pivot(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const value = this.value.getConnectedValue(state);\r\n\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let matrix: Matrix;\r\n\r\n if (this.matrix.isConnected) {\r\n matrix = this.matrix.getConnectedValue(state);\r\n } else {\r\n const scaling = this.scaling.getConnectedValue(state) || Vector3.OneReadOnly;\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n const translation = this.translation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n const pivot = this.pivot.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n // Transform\r\n Matrix.TranslationToRef(-pivot.x, -pivot.y, -pivot.z, this._pivotMatrix);\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);\r\n Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);\r\n Matrix.TranslationToRef(translation.x + pivot.x, translation.y + pivot.y, translation.z + pivot.z, this._translationMatrix);\r\n\r\n this._pivotMatrix.multiplyToRef(this._scalingMatrix, this._backPivotMatrix);\r\n this._backPivotMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);\r\n this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);\r\n matrix = this._transformMatrix;\r\n }\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Geometry: {\r\n const geometry = (value as VertexData).clone();\r\n geometry.transform(matrix);\r\n return geometry;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n return Vector2.Transform(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n return Vector3.TransformCoordinates(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n return Vector4.TransformCoordinates(value, matrix);\r\n }\r\n\r\n return null;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\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.evaluateContext = this.evaluateContext;\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 if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTransformBlock\", GeometryTransformBlock);\r\n"]}
1
+ {"version":3,"file":"geometryTransformBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTransformBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAgBzD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApBR,oBAAe,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,mBAAc,GAAG,IAAI,MAAM,EAAE,CAAC;QAC9B,uBAAkB,GAAG,IAAI,MAAM,EAAE,CAAC;QAClC,2BAAsB,GAAG,IAAI,MAAM,EAAE,CAAC;QACtC,iBAAY,GAAG,IA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AG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,sBAAsB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACA,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC/D,CAAC;IACL,CAAC;CACJ;AAvKU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC3G;AAyKlC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\n\r\n/**\r\n * Block used to apply a transform to a vector / geometry\r\n */\r\nexport class GeometryTransformBlock extends NodeGeometryBlock {\r\n private _rotationMatrix = new Matrix();\r\n private _scalingMatrix = new Matrix();\r\n private _translationMatrix = new Matrix();\r\n private _scalingRotationMatrix = new Matrix();\r\n private _pivotMatrix = new Matrix();\r\n private _backPivotMatrix = new Matrix();\r\n private _transformMatrix = new Matrix();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Create a new GeometryTransformBlock\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(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"translation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"pivot\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.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 \"GeometryTransformBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value input component\r\n */\r\n public get value(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translation input component\r\n */\r\n public get translation(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the pivot input component\r\n */\r\n public get pivot(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const value = this.value.getConnectedValue(state);\r\n\r\n if (!value) {\r\n return null;\r\n }\r\n\r\n let matrix: Matrix;\r\n\r\n if (this.matrix.isConnected) {\r\n matrix = this.matrix.getConnectedValue(state);\r\n } else {\r\n const scaling = this.scaling.getConnectedValue(state) || Vector3.OneReadOnly;\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n const translation = this.translation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n const pivot = this.pivot.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n // Transform\r\n Matrix.TranslationToRef(-pivot.x, -pivot.y, -pivot.z, this._pivotMatrix);\r\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, this._scalingMatrix);\r\n Matrix.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, this._rotationMatrix);\r\n Matrix.TranslationToRef(translation.x + pivot.x, translation.y + pivot.y, translation.z + pivot.z, this._translationMatrix);\r\n\r\n this._pivotMatrix.multiplyToRef(this._scalingMatrix, this._backPivotMatrix);\r\n this._backPivotMatrix.multiplyToRef(this._rotationMatrix, this._scalingRotationMatrix);\r\n this._scalingRotationMatrix.multiplyToRef(this._translationMatrix, this._transformMatrix);\r\n matrix = this._transformMatrix;\r\n }\r\n\r\n switch (this.value.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Geometry: {\r\n const geometry = (value as VertexData).clone();\r\n geometry.transform(matrix);\r\n return geometry;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2:\r\n return Vector2.Transform(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector3:\r\n return Vector3.TransformCoordinates(value, matrix);\r\n case NodeGeometryBlockConnectionPointTypes.Vector4:\r\n return Vector4.TransformCoordinates(value, matrix);\r\n }\r\n\r\n return null;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\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.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTransformBlock\", GeometryTransformBlock);\r\n"]}
@@ -75,7 +75,9 @@ export declare class GeometryTrigonometryBlock extends NodeGeometryBlock {
75
75
  */
76
76
  get output(): NodeGeometryConnectionPoint;
77
77
  protected _buildBlock(state: NodeGeometryBuildState): this | undefined;
78
+ /** @internal */
78
79
  serialize(): any;
80
+ /** @internal */
79
81
  _deserialize(serializationObject: any): void;
80
82
  protected _dumpPropertiesCode(): string;
81
83
  }
@@ -226,11 +226,13 @@ export class GeometryTrigonometryBlock extends NodeGeometryBlock {
226
226
  }
227
227
  return this;
228
228
  }
229
+ /** @internal */
229
230
  serialize() {
230
231
  const serializationObject = super.serialize();
231
232
  serializationObject.operation = this.operation;
232
233
  return serializationObject;
233
234
  }
235
+ /** @internal */
234
236
  _deserialize(serializationObject) {
235
237
  super._deserialize(serializationObject);
236
238
  this.operation = serializationObject.operation;
@@ -1 +1 @@
1
- {"version":3,"file":"geometryTrigonometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTrigonometryBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mCA2CX;AA3CD,WAAY,mCAAmC;IAC3C,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,YAAY;IACZ,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AC,GAAG,EAAE;YAChE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mCAAmC,CAAC,GAAG,EAAE;YAChE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,mCAAmC,CAAC,IAAI,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mCAAmC,CAAC,QAAQ,EAAE;YAC1E,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,mCAAmC,CAAC,UAAU,EAAE;YAC9E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,mCAAmC,CAAC,KAAK,EAAE;SACvE;KACJ,CAAC;4DACyD;AAuM/D,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nexport enum GeometryTrigonometryBlockOperations {\r\n /** Cos */\r\n Cos,\r\n /** Sin */\r\n Sin,\r\n /** Abs */\r\n Abs,\r\n /** Exp */\r\n Exp,\r\n /** Round */\r\n Round,\r\n /** Floor */\r\n Floor,\r\n /** Ceiling */\r\n Ceiling,\r\n /** Square root */\r\n Sqrt,\r\n /** Log */\r\n Log,\r\n /** Tangent */\r\n Tan,\r\n /** Arc tangent */\r\n ArcTan,\r\n /** Arc cosinus */\r\n ArcCos,\r\n /** Arc sinus */\r\n ArcSin,\r\n /** Sign */\r\n Sign,\r\n /** Negate */\r\n Negate,\r\n /** OneMinus */\r\n OneMinus,\r\n /** Reciprocal */\r\n Reciprocal,\r\n /** ToDegrees */\r\n ToDegrees,\r\n /** ToRadians */\r\n ToRadians,\r\n /** Fract */\r\n Fract,\r\n /** Exp2 */\r\n Exp2,\r\n}\r\n\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nexport class GeometryTrigonometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n embedded: true,\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Cos\", value: GeometryTrigonometryBlockOperations.Cos },\r\n { label: \"Sin\", value: GeometryTrigonometryBlockOperations.Sin },\r\n { label: \"Abs\", value: GeometryTrigonometryBlockOperations.Abs },\r\n { label: \"Exp\", value: GeometryTrigonometryBlockOperations.Exp },\r\n { label: \"Exp2\", value: GeometryTrigonometryBlockOperations.Exp2 },\r\n { label: \"Round\", value: GeometryTrigonometryBlockOperations.Round },\r\n { label: \"Floor\", value: GeometryTrigonometryBlockOperations.Floor },\r\n { label: \"Ceiling\", value: GeometryTrigonometryBlockOperations.Ceiling },\r\n { label: \"Sqrt\", value: GeometryTrigonometryBlockOperations.Sqrt },\r\n { label: \"Log\", value: GeometryTrigonometryBlockOperations.Log },\r\n { label: \"Tan\", value: GeometryTrigonometryBlockOperations.Tan },\r\n { label: \"ArcTan\", value: GeometryTrigonometryBlockOperations.ArcTan },\r\n { label: \"ArcCos\", value: GeometryTrigonometryBlockOperations.ArcCos },\r\n { label: \"ArcSin\", value: GeometryTrigonometryBlockOperations.ArcSin },\r\n { label: \"Sign\", value: GeometryTrigonometryBlockOperations.Sign },\r\n { label: \"Negate\", value: GeometryTrigonometryBlockOperations.Negate },\r\n { label: \"OneMinus\", value: GeometryTrigonometryBlockOperations.OneMinus },\r\n { label: \"Reciprocal\", value: GeometryTrigonometryBlockOperations.Reciprocal },\r\n { label: \"ToDegrees\", value: GeometryTrigonometryBlockOperations.ToDegrees },\r\n { label: \"ToRadians\", value: GeometryTrigonometryBlockOperations.ToRadians },\r\n { label: \"Fract\", value: GeometryTrigonometryBlockOperations.Fract },\r\n ],\r\n })\r\n public operation = GeometryTrigonometryBlockOperations.Cos;\r\n\r\n /**\r\n * Creates a new GeometryTrigonometryBlock\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(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.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 \"GeometryTrigonometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n let func: Nullable<(value: number) => number> = null;\r\n\r\n switch (this.operation) {\r\n case GeometryTrigonometryBlockOperations.Cos: {\r\n func = (value: number) => Math.cos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sin: {\r\n func = (value: number) => Math.sin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Abs: {\r\n func = (value: number) => Math.abs(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp: {\r\n func = (value: number) => Math.exp(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp2: {\r\n func = (value: number) => Math.pow(2, value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Round: {\r\n func = (value: number) => Math.round(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Floor: {\r\n func = (value: number) => Math.floor(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Ceiling: {\r\n func = (value: number) => Math.ceil(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sqrt: {\r\n func = (value: number) => Math.sqrt(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Log: {\r\n func = (value: number) => Math.log(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Tan: {\r\n func = (value: number) => Math.tan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcTan: {\r\n func = (value: number) => Math.atan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcCos: {\r\n func = (value: number) => Math.acos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcSin: {\r\n func = (value: number) => Math.asin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sign: {\r\n func = (value: number) => Math.sign(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Negate: {\r\n func = (value: number) => -value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.OneMinus: {\r\n func = (value: number) => 1 - value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Reciprocal: {\r\n func = (value: number) => 1 / value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToRadians: {\r\n func = (value: number) => (value * Math.PI) / 180;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToDegrees: {\r\n func = (value: number) => (value * 180) / Math.PI;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Fract: {\r\n func = (value: number) => {\r\n if (value >= 0) {\r\n return value - Math.floor(value);\r\n } else {\r\n return value - Math.ceil(value);\r\n }\r\n };\r\n break;\r\n }\r\n }\r\n if (!func) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return func(source);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector2(func(source.x), func(source.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector3(func(source.x), func(source.y), func(source.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector4(func(source.x), func(source.y), func(source.z), func(source.w));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\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.operation = serializationObject.operation;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString =\r\n super._dumpPropertiesCode() +\r\n `${this._codeVariableName}.operation = BABYLON.GeometryTrigonometryBlockOperations.${GeometryTrigonometryBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTrigonometryBlock\", GeometryTrigonometryBlock);\r\n"]}
1
+ {"version":3,"file":"geometryTrigonometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTrigonometryBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mCA2CX;AA3CD,WAAY,mCAAmC;IAC3C,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,YAAY;IACZ,+FAAK,CAAA;IACL,YAAY;IACZ,+FAAK,CAAA;IACL,cAAc;IACd,mGAAO,CAAA;IACP,kBAAkB;IAClB,6FAAI,CAAA;IACJ,UAAU;IACV,2FAAG,CAAA;IACH,cAAc;IACd,2FAAG,CAAA;IACH,kBAAkB;IAClB,kGAAM,CAAA;IACN,kBAAkB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,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,mCAAmC,CAAC,IAAI,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mCAAmC,CAAC,QAAQ,EAAE;YAC1E,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,mCAAmC,CAAC,UAAU,EAAE;YAC9E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,mCAAmC,CAAC,KAAK,EAAE;SACvE;KACJ,CAAC;4DACyD;AAyM/D,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nexport enum GeometryTrigonometryBlockOperations {\r\n /** Cos */\r\n Cos,\r\n /** Sin */\r\n Sin,\r\n /** Abs */\r\n Abs,\r\n /** Exp */\r\n Exp,\r\n /** Round */\r\n Round,\r\n /** Floor */\r\n Floor,\r\n /** Ceiling */\r\n Ceiling,\r\n /** Square root */\r\n Sqrt,\r\n /** Log */\r\n Log,\r\n /** Tangent */\r\n Tan,\r\n /** Arc tangent */\r\n ArcTan,\r\n /** Arc cosinus */\r\n ArcCos,\r\n /** Arc sinus */\r\n ArcSin,\r\n /** Sign */\r\n Sign,\r\n /** Negate */\r\n Negate,\r\n /** OneMinus */\r\n OneMinus,\r\n /** Reciprocal */\r\n Reciprocal,\r\n /** ToDegrees */\r\n ToDegrees,\r\n /** ToRadians */\r\n ToRadians,\r\n /** Fract */\r\n Fract,\r\n /** Exp2 */\r\n Exp2,\r\n}\r\n\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nexport class GeometryTrigonometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n embedded: true,\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Cos\", value: GeometryTrigonometryBlockOperations.Cos },\r\n { label: \"Sin\", value: GeometryTrigonometryBlockOperations.Sin },\r\n { label: \"Abs\", value: GeometryTrigonometryBlockOperations.Abs },\r\n { label: \"Exp\", value: GeometryTrigonometryBlockOperations.Exp },\r\n { label: \"Exp2\", value: GeometryTrigonometryBlockOperations.Exp2 },\r\n { label: \"Round\", value: GeometryTrigonometryBlockOperations.Round },\r\n { label: \"Floor\", value: GeometryTrigonometryBlockOperations.Floor },\r\n { label: \"Ceiling\", value: GeometryTrigonometryBlockOperations.Ceiling },\r\n { label: \"Sqrt\", value: GeometryTrigonometryBlockOperations.Sqrt },\r\n { label: \"Log\", value: GeometryTrigonometryBlockOperations.Log },\r\n { label: \"Tan\", value: GeometryTrigonometryBlockOperations.Tan },\r\n { label: \"ArcTan\", value: GeometryTrigonometryBlockOperations.ArcTan },\r\n { label: \"ArcCos\", value: GeometryTrigonometryBlockOperations.ArcCos },\r\n { label: \"ArcSin\", value: GeometryTrigonometryBlockOperations.ArcSin },\r\n { label: \"Sign\", value: GeometryTrigonometryBlockOperations.Sign },\r\n { label: \"Negate\", value: GeometryTrigonometryBlockOperations.Negate },\r\n { label: \"OneMinus\", value: GeometryTrigonometryBlockOperations.OneMinus },\r\n { label: \"Reciprocal\", value: GeometryTrigonometryBlockOperations.Reciprocal },\r\n { label: \"ToDegrees\", value: GeometryTrigonometryBlockOperations.ToDegrees },\r\n { label: \"ToRadians\", value: GeometryTrigonometryBlockOperations.ToRadians },\r\n { label: \"Fract\", value: GeometryTrigonometryBlockOperations.Fract },\r\n ],\r\n })\r\n public operation = GeometryTrigonometryBlockOperations.Cos;\r\n\r\n /**\r\n * Creates a new GeometryTrigonometryBlock\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(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.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 \"GeometryTrigonometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n let func: Nullable<(value: number) => number> = null;\r\n\r\n switch (this.operation) {\r\n case GeometryTrigonometryBlockOperations.Cos: {\r\n func = (value: number) => Math.cos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sin: {\r\n func = (value: number) => Math.sin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Abs: {\r\n func = (value: number) => Math.abs(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp: {\r\n func = (value: number) => Math.exp(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp2: {\r\n func = (value: number) => Math.pow(2, value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Round: {\r\n func = (value: number) => Math.round(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Floor: {\r\n func = (value: number) => Math.floor(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Ceiling: {\r\n func = (value: number) => Math.ceil(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sqrt: {\r\n func = (value: number) => Math.sqrt(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Log: {\r\n func = (value: number) => Math.log(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Tan: {\r\n func = (value: number) => Math.tan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcTan: {\r\n func = (value: number) => Math.atan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcCos: {\r\n func = (value: number) => Math.acos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcSin: {\r\n func = (value: number) => Math.asin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sign: {\r\n func = (value: number) => Math.sign(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Negate: {\r\n func = (value: number) => -value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.OneMinus: {\r\n func = (value: number) => 1 - value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Reciprocal: {\r\n func = (value: number) => 1 / value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToRadians: {\r\n func = (value: number) => (value * Math.PI) / 180;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToDegrees: {\r\n func = (value: number) => (value * 180) / Math.PI;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Fract: {\r\n func = (value: number) => {\r\n if (value >= 0) {\r\n return value - Math.floor(value);\r\n } else {\r\n return value - Math.ceil(value);\r\n }\r\n };\r\n break;\r\n }\r\n }\r\n if (!func) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return func(source);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector2(func(source.x), func(source.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector3(func(source.x), func(source.y), func(source.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector4(func(source.x), func(source.y), func(source.z), func(source.w));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString =\r\n super._dumpPropertiesCode() +\r\n `${this._codeVariableName}.operation = BABYLON.GeometryTrigonometryBlockOperations.${GeometryTrigonometryBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTrigonometryBlock\", GeometryTrigonometryBlock);\r\n"]}
@@ -52,5 +52,6 @@ export declare class MappingBlock extends NodeGeometryBlock {
52
52
  * @returns the serialized block object
53
53
  */
54
54
  serialize(): any;
55
+ /** @internal */
55
56
  _deserialize(serializationObject: any): void;
56
57
  }
@@ -141,6 +141,7 @@ export class MappingBlock extends NodeGeometryBlock {
141
141
  serializationObject.mapping = this.mapping;
142
142
  return serializationObject;
143
143
  }
144
+ /** @internal */
144
145
  _deserialize(serializationObject) {
145
146
  super._deserialize(serializationObject);
146
147
  this.mapping = serializationObject.mapping;
@@ -1 +1 @@
1
- {"version":3,"file":"mappingBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mappingBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACpB,gBAAgB;IAChB,yDAAS,CAAA;IACT,kBAAkB;IAClB,6DAAW,CAAA;IACX,YAAY;IACZ,iDAAK,CAAA;AACT,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAED;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IAe/C;;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CACJ;AA7IU;IATN,sBAAsB,CAAC,SAAS,uCAA+B,UAAU,EAAE;QACxE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE;YACrD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE;YACzD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE;SAChD;KACJ,CAAC;6CACsC;AA+I5C,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Type of mappings supported by the mapping block\r\n */\r\nexport enum MappingTypes {\r\n /** Spherical */\r\n Spherical,\r\n /** Cylindrical */\r\n Cylindrical,\r\n /** Cubic */\r\n Cubic,\r\n}\r\n\r\n/**\r\n * Block used to generate UV coordinates\r\n */\r\nexport class MappingBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the mapping type used by the block\r\n */\r\n @editableInPropertyPage(\"Mapping\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Spherical\", value: MappingTypes.Spherical },\r\n { label: \"Cylindrical\", value: MappingTypes.Cylindrical },\r\n { label: \"Cubic\", value: MappingTypes.Cubic },\r\n ],\r\n })\r\n public mapping = MappingTypes.Spherical;\r\n\r\n /**\r\n * Create a new MappingBlock\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(\"position\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"normal\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"center\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerOutput(\"uv\", NodeGeometryBlockConnectionPointTypes.Vector2);\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 \"MappingBlock\";\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get position(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the normal input component\r\n */\r\n public get normal(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the center input component\r\n */\r\n public get center(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get uv(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.position.isConnected) {\r\n this.uv._storedFunction = null;\r\n this.uv._storedValue = null;\r\n return;\r\n }\r\n const tempDirection = Vector3.Zero();\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const position = (this.position.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const normal = (this.normal.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const center = this.center.getConnectedValue(state) as Vector3;\r\n const uv = Vector2.Zero();\r\n\r\n switch (this.mapping) {\r\n case MappingTypes.Spherical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.acos(tempDirection.y / len) / Math.PI;\r\n if (tempDirection.x !== 0 || tempDirection.z !== 0) {\r\n uv.y = Math.atan2(tempDirection.x, tempDirection.z) / (Math.PI * 2);\r\n }\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cylindrical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.atan2(tempDirection.x / len, tempDirection.z / len) / (Math.PI * 2);\r\n uv.y = (tempDirection.y + 1.0) / 2.0;\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cubic: {\r\n // Find the largest component of the normal vector\r\n const absX = Math.abs(normal.x);\r\n const absY = Math.abs(normal.y);\r\n const absZ = Math.abs(normal.z);\r\n const maxDim = Math.max(Math.abs(position.x), Math.abs(position.y), Math.abs(position.z));\r\n\r\n let u = 0,\r\n v = 0;\r\n\r\n if (absX >= absY && absX >= absZ) {\r\n u = position.y / maxDim - center.y;\r\n v = position.z / maxDim - center.z;\r\n } else if (absY >= absX && absY >= absZ) {\r\n u = position.x / maxDim - center.x;\r\n v = position.z / maxDim - center.z;\r\n } else {\r\n u = position.x / maxDim - center.x;\r\n v = position.y / maxDim - center.y;\r\n }\r\n\r\n uv.x = (u + 1) / 2;\r\n uv.y = (v + 1) / 2;\r\n }\r\n }\r\n return uv;\r\n };\r\n\r\n this.uv._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.mapping = BABYLON.MappingTypes.${MappingTypes[this.mapping]};\\n`;\r\n return codeString;\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.mapping = this.mapping;\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.mapping = serializationObject.mapping;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MappingBlock\",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EF,IAAI,CAAC,EAAE,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YAChC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACN,CAAC;IAEkB,mBAAmB;QAClC,MAAM,UAAU,GAAG,KAAK,CAAC,mBAAmB,EAAE,GAAG,GAAG,IAAI,CAAC,iBAAiB,mCAAmC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7I,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE3C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACA,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;CACJ;AA9IU;IATN,sBAAsB,CAAC,SAAS,uCAA+B,UAAU,EAAE;QACxE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE;YACrD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,CAAC,WAAW,EAAE;YACzD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE;SAChD;KACJ,CAAC;6CACsC;AAgJ5C,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Type of mappings supported by the mapping block\r\n */\r\nexport enum MappingTypes {\r\n /** Spherical */\r\n Spherical,\r\n /** Cylindrical */\r\n Cylindrical,\r\n /** Cubic */\r\n Cubic,\r\n}\r\n\r\n/**\r\n * Block used to generate UV coordinates\r\n */\r\nexport class MappingBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the mapping type used by the block\r\n */\r\n @editableInPropertyPage(\"Mapping\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Spherical\", value: MappingTypes.Spherical },\r\n { label: \"Cylindrical\", value: MappingTypes.Cylindrical },\r\n { label: \"Cubic\", value: MappingTypes.Cubic },\r\n ],\r\n })\r\n public mapping = MappingTypes.Spherical;\r\n\r\n /**\r\n * Create a new MappingBlock\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(\"position\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"normal\", NodeGeometryBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"center\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerOutput(\"uv\", NodeGeometryBlockConnectionPointTypes.Vector2);\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 \"MappingBlock\";\r\n }\r\n\r\n /**\r\n * Gets the position input component\r\n */\r\n public get position(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the normal input component\r\n */\r\n public get normal(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the center input component\r\n */\r\n public get center(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get uv(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n if (!this.position.isConnected) {\r\n this.uv._storedFunction = null;\r\n this.uv._storedValue = null;\r\n return;\r\n }\r\n const tempDirection = Vector3.Zero();\r\n\r\n const func = (state: NodeGeometryBuildState) => {\r\n const position = (this.position.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const normal = (this.normal.getConnectedValue(state) as Vector3) || Vector3.Zero();\r\n const center = this.center.getConnectedValue(state) as Vector3;\r\n const uv = Vector2.Zero();\r\n\r\n switch (this.mapping) {\r\n case MappingTypes.Spherical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.acos(tempDirection.y / len) / Math.PI;\r\n if (tempDirection.x !== 0 || tempDirection.z !== 0) {\r\n uv.y = Math.atan2(tempDirection.x, tempDirection.z) / (Math.PI * 2);\r\n }\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cylindrical: {\r\n position.subtractToRef(center, tempDirection);\r\n const len = tempDirection.length();\r\n if (len > 0) {\r\n uv.x = Math.atan2(tempDirection.x / len, tempDirection.z / len) / (Math.PI * 2);\r\n uv.y = (tempDirection.y + 1.0) / 2.0;\r\n }\r\n break;\r\n }\r\n case MappingTypes.Cubic: {\r\n // Find the largest component of the normal vector\r\n const absX = Math.abs(normal.x);\r\n const absY = Math.abs(normal.y);\r\n const absZ = Math.abs(normal.z);\r\n const maxDim = Math.max(Math.abs(position.x), Math.abs(position.y), Math.abs(position.z));\r\n\r\n let u = 0,\r\n v = 0;\r\n\r\n if (absX >= absY && absX >= absZ) {\r\n u = position.y / maxDim - center.y;\r\n v = position.z / maxDim - center.z;\r\n } else if (absY >= absX && absY >= absZ) {\r\n u = position.x / maxDim - center.x;\r\n v = position.z / maxDim - center.z;\r\n } else {\r\n u = position.x / maxDim - center.x;\r\n v = position.y / maxDim - center.y;\r\n }\r\n\r\n uv.x = (u + 1) / 2;\r\n uv.y = (v + 1) / 2;\r\n }\r\n }\r\n return uv;\r\n };\r\n\r\n this.uv._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.mapping = BABYLON.MappingTypes.${MappingTypes[this.mapping]};\\n`;\r\n return codeString;\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.mapping = this.mapping;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.mapping = serializationObject.mapping;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MappingBlock\", MappingBlock);\r\n"]}
@@ -60,5 +60,6 @@ export declare class MathBlock extends NodeGeometryBlock {
60
60
  * @returns the serialized block object
61
61
  */
62
62
  serialize(): any;
63
+ /** @internal */
63
64
  _deserialize(serializationObject: any): void;
64
65
  }
@@ -292,6 +292,7 @@ export class MathBlock extends NodeGeometryBlock {
292
292
  serializationObject.operation = this.operation;
293
293
  return serializationObject;
294
294
  }
295
+ /** @internal */
295
296
  _deserialize(serializationObject) {
296
297
  super._deserialize(serializationObject);
297
298
  this.operation = serializationObject.operation;
@@ -1 +1 @@
1
- {"version":3,"file":"mathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mathBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD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G,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AAxSU;IAZN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;YAChD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;YAC1D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;YAC1D,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE;YACtD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;YAChD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE;SACnD;KACJ,CAAC;4CACyC;AA0S/C,aAAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Operations supported by the Math block\r\n */\r\nexport enum MathBlockOperations {\r\n /** Add */\r\n Add,\r\n /** Subtract */\r\n Subtract,\r\n /** Multiply */\r\n Multiply,\r\n /** Divide */\r\n Divide,\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n}\r\n\r\n/**\r\n * Block used to apply math functions\r\n */\r\nexport class MathBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Add\", value: MathBlockOperations.Add },\r\n { label: \"Subtract\", value: MathBlockOperations.Subtract },\r\n { label: \"Multiply\", value: MathBlockOperations.Multiply },\r\n { label: \"Divide\", value: MathBlockOperations.Divide },\r\n { label: \"Max\", value: MathBlockOperations.Max },\r\n { label: \"Min\", value: MathBlockOperations.Min },\r\n ],\r\n })\r\n public operation = MathBlockOperations.Add;\r\n\r\n private readonly _connectionObservers: Observer<NodeGeometryConnectionPoint>[];\r\n\r\n /**\r\n * Create a new MathBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = this.left;\r\n\r\n const excludedConnectionPointTypes = [\r\n NodeGeometryBlockConnectionPointTypes.Matrix,\r\n NodeGeometryBlockConnectionPointTypes.Geometry,\r\n NodeGeometryBlockConnectionPointTypes.Texture,\r\n ] as const;\r\n\r\n this.left.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\r\n this.right.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\r\n\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._connectionObservers = [\r\n this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n ];\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 \"MathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n let func: (state: NodeGeometryBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const leftIsScalar = left.type === NodeGeometryBlockConnectionPointTypes.Float || left.type === NodeGeometryBlockConnectionPointTypes.Int;\r\n const rightIsScalar = right.type === NodeGeometryBlockConnectionPointTypes.Float || right.type === NodeGeometryBlockConnectionPointTypes.Int;\r\n\r\n // If both input types are scalars, then this is a scalar operation.\r\n const isScalar = leftIsScalar && rightIsScalar;\r\n\r\n switch (this.operation) {\r\n case MathBlockOperations.Add: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) + right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).add(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).add(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Subtract: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) - right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).subtract(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).subtract(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Multiply: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) * right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).multiply(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).multiply(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Divide: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) / right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).divide(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).divide(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Min: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.min(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Max: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.max(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (left.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\r\n return func(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.operation = BABYLON.MathBlockOperations.${MathBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n\r\n private _updateInputOutputTypes() {\r\n // First update the output type with the initial assumption that we'll base it on the left input.\r\n this.output._typeConnectionSource = this.left;\r\n\r\n if (this.left.isConnected && this.right.isConnected) {\r\n // Both inputs are connected, so we need to determine the output type based on the input types.\r\n if (\r\n this.left.type === NodeGeometryBlockConnectionPointTypes.Int ||\r\n (this.left.type === NodeGeometryBlockConnectionPointTypes.Float && this.right.type !== NodeGeometryBlockConnectionPointTypes.Int)\r\n ) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n } else if (this.left.isConnected !== this.right.isConnected) {\r\n // Only one input is connected, so we need to determine the output type based on the connected input.\r\n this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;\r\n }\r\n\r\n // Next update the accepted connection point types for the inputs based on the current input connection state.\r\n if (this.left.isConnected || this.right.isConnected) {\r\n for (const [first, second] of [\r\n [this.left, this.right],\r\n [this.right, this.left],\r\n ]) {\r\n // Always allow Ints and Floats.\r\n first.acceptedConnectionPointTypes = [NodeGeometryBlockConnectionPointTypes.Int, NodeGeometryBlockConnectionPointTypes.Float];\r\n\r\n if (second.isConnected) {\r\n // The same types as the connected input are always allowed.\r\n first.acceptedConnectionPointTypes.push(second.type);\r\n\r\n // If the other input is a scalar, then we also allow Vector types.\r\n if (second.type === NodeGeometryBlockConnectionPointTypes.Int || second.type === NodeGeometryBlockConnectionPointTypes.Float) {\r\n first.acceptedConnectionPointTypes.push(\r\n NodeGeometryBlockConnectionPointTypes.Vector2,\r\n NodeGeometryBlockConnectionPointTypes.Vector3,\r\n NodeGeometryBlockConnectionPointTypes.Vector4\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n for (const observer of this._connectionObservers) {\r\n observer.remove();\r\n }\r\n this._connectionObservers.length = 0;\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.operation = this.operation;\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.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MathBl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AAa,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Operations supported by the Math block\r\n */\r\nexport enum MathBlockOperations {\r\n /** Add */\r\n Add,\r\n /** Subtract */\r\n Subtract,\r\n /** Multiply */\r\n Multiply,\r\n /** Divide */\r\n Divide,\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n}\r\n\r\n/**\r\n * Block used to apply math functions\r\n */\r\nexport class MathBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Add\", value: MathBlockOperations.Add },\r\n { label: \"Subtract\", value: MathBlockOperations.Subtract },\r\n { label: \"Multiply\", value: MathBlockOperations.Multiply },\r\n { label: \"Divide\", value: MathBlockOperations.Divide },\r\n { label: \"Max\", value: MathBlockOperations.Max },\r\n { label: \"Min\", value: MathBlockOperations.Min },\r\n ],\r\n })\r\n public operation = MathBlockOperations.Add;\r\n\r\n private readonly _connectionObservers: Observer<NodeGeometryConnectionPoint>[];\r\n\r\n /**\r\n * Create a new MathBlock\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(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = this.left;\r\n\r\n const excludedConnectionPointTypes = [\r\n NodeGeometryBlockConnectionPointTypes.Matrix,\r\n NodeGeometryBlockConnectionPointTypes.Geometry,\r\n NodeGeometryBlockConnectionPointTypes.Texture,\r\n ] as const;\r\n\r\n this.left.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\r\n this.right.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\r\n\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._connectionObservers = [\r\n this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n ];\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 \"MathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeGeometryConnectionPoint {\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(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock() {\r\n let func: (state: NodeGeometryBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const leftIsScalar = left.type === NodeGeometryBlockConnectionPointTypes.Float || left.type === NodeGeometryBlockConnectionPointTypes.Int;\r\n const rightIsScalar = right.type === NodeGeometryBlockConnectionPointTypes.Float || right.type === NodeGeometryBlockConnectionPointTypes.Int;\r\n\r\n // If both input types are scalars, then this is a scalar operation.\r\n const isScalar = leftIsScalar && rightIsScalar;\r\n\r\n switch (this.operation) {\r\n case MathBlockOperations.Add: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) + right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).add(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).add(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Subtract: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) - right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).subtract(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).subtract(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Multiply: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) * right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).multiply(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).multiply(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Divide: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) / right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).divide(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).divide(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Min: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.min(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n case MathBlockOperations.Max: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.max(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n func = (state) => {\r\n return Vector4.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (left.type === NodeGeometryBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\r\n return func(state);\r\n };\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.operation = BABYLON.MathBlockOperations.${MathBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n\r\n private _updateInputOutputTypes() {\r\n // First update the output type with the initial assumption that we'll base it on the left input.\r\n this.output._typeConnectionSource = this.left;\r\n\r\n if (this.left.isConnected && this.right.isConnected) {\r\n // Both inputs are connected, so we need to determine the output type based on the input types.\r\n if (\r\n this.left.type === NodeGeometryBlockConnectionPointTypes.Int ||\r\n (this.left.type === NodeGeometryBlockConnectionPointTypes.Float && this.right.type !== NodeGeometryBlockConnectionPointTypes.Int)\r\n ) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n } else if (this.left.isConnected !== this.right.isConnected) {\r\n // Only one input is connected, so we need to determine the output type based on the connected input.\r\n this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;\r\n }\r\n\r\n // Next update the accepted connection point types for the inputs based on the current input connection state.\r\n if (this.left.isConnected || this.right.isConnected) {\r\n for (const [first, second] of [\r\n [this.left, this.right],\r\n [this.right, this.left],\r\n ]) {\r\n // Always allow Ints and Floats.\r\n first.acceptedConnectionPointTypes = [NodeGeometryBlockConnectionPointTypes.Int, NodeGeometryBlockConnectionPointTypes.Float];\r\n\r\n if (second.isConnected) {\r\n // The same types as the connected input are always allowed.\r\n first.acceptedConnectionPointTypes.push(second.type);\r\n\r\n // If the other input is a scalar, then we also allow Vector types.\r\n if (second.type === NodeGeometryBlockConnectionPointTypes.Int || second.type === NodeGeometryBlockConnectionPointTypes.Float) {\r\n first.acceptedConnectionPointTypes.push(\r\n NodeGeometryBlockConnectionPointTypes.Vector2,\r\n NodeGeometryBlockConnectionPointTypes.Vector3,\r\n NodeGeometryBlockConnectionPointTypes.Vector4\r\n );\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n for (const observer of this._connectionObservers) {\r\n observer.remove();\r\n }\r\n this._connectionObservers.length = 0;\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.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MathBlock\", MathBlock);\r\n"]}
@@ -51,5 +51,6 @@ export declare class MergeGeometryBlock extends NodeGeometryBlock {
51
51
  * @returns the serialized block object
52
52
  */
53
53
  serialize(): any;
54
+ /** @internal */
54
55
  _deserialize(serializationObject: any): void;
55
56
  }
@@ -132,6 +132,7 @@ export class MergeGeometryBlock extends NodeGeometryBlock {
132
132
  serializationObject.evaluateContext = this.evaluateContext;
133
133
  return serializationObject;
134
134
  }
135
+ /** @internal */
135
136
  _deserialize(serializationObject) {
136
137
  super._deserialize(serializationObject);
137
138
  this.evaluateContext = serializationObject.evaluateContext;
@@ -1 +1 @@
1
- {"version":3,"file":"mergeGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mergeGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAGlG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAQrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAAC;QAS3B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CA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sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;2DAC1G;AAoJnC,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to merge several geometries\r\n */\r\nexport class MergeGeometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new MergeGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"MergeGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry2 input component\r\n */\r\n public get geometry2(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry3 input component\r\n */\r\n public get geometry3(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the geometry4 input component\r\n */\r\n public get geometry4(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexDataSource: VertexData[] = [];\r\n\r\n if (this.geometry0.isConnected) {\r\n const data = this.geometry0.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry1.isConnected) {\r\n const data = this.geometry1.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry2.isConnected) {\r\n const data = this.geometry2.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry3.isConnected) {\r\n const data = this.geometry3.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry4.isConnected) {\r\n const data = this.geometry4.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n\r\n if (vertexDataSource.length === 0) {\r\n return null;\r\n }\r\n\r\n let vertexData = vertexDataSource[0].clone(); // Preserve source data\r\n const additionalVertexData: VertexData[] = vertexDataSource.slice(1);\r\n\r\n if (additionalVertexData.length && vertexData) {\r\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\r\n }\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\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.evaluateContext = this.evaluateContext;\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.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MergeGeometryBlock\", MergeGeometryBlock);\r\n"]}
1
+ {"version":3,"file":"mergeGeometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/mergeGeometryBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAGlG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAQrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB;;;WAGG;QAEI,oBAAe,GAAG,KAAK,CAA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AY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAC/D,CAAC;CACJ;AAnJU;IADN,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;2DAC1G;AAqJnC,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { VertexData } from \"../../../Meshes/mesh.vertexData\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to merge several geometries\r\n */\r\nexport class MergeGeometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public evaluateContext = false;\r\n\r\n /**\r\n * Create a new MergeGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\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 \"MergeGeometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry0 input component\r\n */\r\n public get geometry0(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the geometry1 input component\r\n */\r\n public get geometry1(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry2 input component\r\n */\r\n public get geometry2(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the geometry3 input component\r\n */\r\n public get geometry3(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the geometry4 input component\r\n */\r\n public get geometry4(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n const vertexDataSource: VertexData[] = [];\r\n\r\n if (this.geometry0.isConnected) {\r\n const data = this.geometry0.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry1.isConnected) {\r\n const data = this.geometry1.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry2.isConnected) {\r\n const data = this.geometry2.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry3.isConnected) {\r\n const data = this.geometry3.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n if (this.geometry4.isConnected) {\r\n const data = this.geometry4.getConnectedValue(state);\r\n if (data) {\r\n vertexDataSource.push(data);\r\n }\r\n }\r\n\r\n if (vertexDataSource.length === 0) {\r\n return null;\r\n }\r\n\r\n let vertexData = vertexDataSource[0].clone(); // Preserve source data\r\n const additionalVertexData: VertexData[] = vertexDataSource.slice(1);\r\n\r\n if (additionalVertexData.length && vertexData) {\r\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\r\n }\r\n return vertexData;\r\n };\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n return codeString;\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.evaluateContext = this.evaluateContext;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MergeGeometryBlock\", MergeGeometryBlock);\r\n"]}