@babylonjs/core 7.16.0 → 7.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/Animations/animationGroup.d.ts +1 -0
  2. package/Animations/animationGroup.js +4 -1
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Collisions/gpuPicker.js +1 -1
  5. package/Collisions/gpuPicker.js.map +1 -1
  6. package/Compute/computeEffect.js +1 -1
  7. package/Compute/computeEffect.js.map +1 -1
  8. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +32 -0
  9. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +32 -0
  10. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  11. package/Engines/abstractEngine.js +2 -2
  12. package/Engines/abstractEngine.js.map +1 -1
  13. package/Engines/engine.d.ts +1993 -1993
  14. package/Engines/nativeEngine.d.ts +7 -0
  15. package/Engines/nativeEngine.js +24 -1
  16. package/Engines/nativeEngine.js.map +1 -1
  17. package/Engines/thinEngine.js +2 -2
  18. package/Engines/thinEngine.js.map +1 -1
  19. package/Engines/webgpuEngine.js +5 -3
  20. package/Engines/webgpuEngine.js.map +1 -1
  21. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +6 -6
  22. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  23. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -7
  24. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  25. package/Materials/Node/Blocks/Dual/textureBlock.js +1 -1
  26. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  27. package/Materials/Node/Blocks/Input/inputBlock.js +8 -11
  28. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  29. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +4 -4
  30. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  31. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +46 -40
  32. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  33. package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +2 -1
  34. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +10 -9
  35. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  36. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -0
  37. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +85 -69
  38. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  39. package/Materials/Node/Blocks/PBR/reflectionBlock.js +54 -38
  40. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  41. package/Materials/Node/Blocks/PBR/refractionBlock.js +8 -5
  42. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  43. package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +2 -1
  44. package/Materials/Node/Blocks/PBR/sheenBlock.js +40 -32
  45. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  46. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +53 -45
  47. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  48. package/Materials/Node/nodeMaterial.d.ts +2 -1
  49. package/Materials/Node/nodeMaterial.js +4 -1
  50. package/Materials/Node/nodeMaterial.js.map +1 -1
  51. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -0
  52. package/Materials/Node/nodeMaterialBuildState.js +12 -3
  53. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  54. package/Materials/effect.js +2 -2
  55. package/Materials/effect.js.map +1 -1
  56. package/Meshes/Builders/decalBuilder.js +14 -20
  57. package/Meshes/Builders/decalBuilder.js.map +1 -1
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +10 -1
  59. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +50 -11
  60. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  61. package/Meshes/Node/nodeGeometry.d.ts +6 -0
  62. package/Meshes/Node/nodeGeometry.js +7 -0
  63. package/Meshes/Node/nodeGeometry.js.map +1 -1
  64. package/Meshes/mesh.d.ts +1 -0
  65. package/Meshes/mesh.js +138 -134
  66. package/Meshes/mesh.js.map +1 -1
  67. package/Meshes/subMesh.js +1 -1
  68. package/Meshes/subMesh.js.map +1 -1
  69. package/Misc/khronosTextureContainer2.js +1 -1
  70. package/Misc/khronosTextureContainer2.js.map +1 -1
  71. package/Rendering/GlobalIllumination/giRSMManager.js +1 -1
  72. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  73. package/Rendering/edgesRenderer.js +1 -1
  74. package/Rendering/edgesRenderer.js.map +1 -1
  75. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +1 -1
  76. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  77. package/Shaders/ShadersInclude/lightFragment.js +3 -3
  78. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  79. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +1 -1
  80. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  81. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +13 -14
  82. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  83. package/Shaders/ShadersInclude/pbrBlockAlphaFresnel.js +4 -5
  84. package/Shaders/ShadersInclude/pbrBlockAlphaFresnel.js.map +1 -1
  85. package/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js +4 -5
  86. package/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js.map +1 -1
  87. package/Shaders/ShadersInclude/pbrBlockAnisotropic.js +4 -5
  88. package/Shaders/ShadersInclude/pbrBlockAnisotropic.js.map +1 -1
  89. package/Shaders/ShadersInclude/pbrBlockClearcoat.js +34 -35
  90. package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
  91. package/Shaders/ShadersInclude/pbrBlockIridescence.js +10 -11
  92. package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -1
  93. package/Shaders/ShadersInclude/pbrBlockReflection.js +23 -24
  94. package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
  95. package/Shaders/ShadersInclude/pbrBlockReflectivity.js +12 -13
  96. package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  97. package/Shaders/ShadersInclude/pbrBlockSheen.js +31 -32
  98. package/Shaders/ShadersInclude/pbrBlockSheen.js.map +1 -1
  99. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +43 -44
  100. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  101. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
  102. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  103. package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js +1 -1
  104. package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
  105. package/Shaders/pbr.fragment.js +143 -153
  106. package/Shaders/pbr.fragment.js.map +1 -1
  107. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js +3 -3
  108. package/ShadersWGSL/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  109. package/ShadersWGSL/ShadersInclude/decalFragment.d.ts +5 -0
  110. package/ShadersWGSL/ShadersInclude/decalFragment.js +18 -0
  111. package/ShadersWGSL/ShadersInclude/decalFragment.js.map +1 -0
  112. package/ShadersWGSL/ShadersInclude/depthPrePass.d.ts +5 -0
  113. package/ShadersWGSL/ShadersInclude/depthPrePass.js +12 -0
  114. package/ShadersWGSL/ShadersInclude/depthPrePass.js.map +1 -0
  115. package/ShadersWGSL/ShadersInclude/harmonicsFunctions.d.ts +5 -0
  116. package/ShadersWGSL/ShadersInclude/harmonicsFunctions.js +24 -0
  117. package/ShadersWGSL/ShadersInclude/harmonicsFunctions.js.map +1 -0
  118. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.d.ts +5 -0
  119. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +39 -0
  120. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -0
  121. package/ShadersWGSL/ShadersInclude/helperFunctions.js +6 -2
  122. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  123. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +2 -2
  124. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  125. package/ShadersWGSL/ShadersInclude/importanceSampling.d.ts +5 -0
  126. package/ShadersWGSL/ShadersInclude/importanceSampling.js +12 -0
  127. package/ShadersWGSL/ShadersInclude/importanceSampling.js.map +1 -0
  128. package/ShadersWGSL/ShadersInclude/lightFragment.js +3 -3
  129. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  130. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +1 -1
  131. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  132. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.d.ts +5 -0
  133. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +139 -0
  134. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -0
  135. package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.d.ts +6 -0
  136. package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js +81 -0
  137. package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -0
  138. package/ShadersWGSL/ShadersInclude/pbrBlockAlphaFresnel.d.ts +5 -0
  139. package/ShadersWGSL/ShadersInclude/pbrBlockAlphaFresnel.js +37 -0
  140. package/ShadersWGSL/ShadersInclude/pbrBlockAlphaFresnel.js.map +1 -0
  141. package/ShadersWGSL/ShadersInclude/pbrBlockAmbientOcclusion.d.ts +5 -0
  142. package/ShadersWGSL/ShadersInclude/pbrBlockAmbientOcclusion.js +35 -0
  143. package/ShadersWGSL/ShadersInclude/pbrBlockAmbientOcclusion.js.map +1 -0
  144. package/ShadersWGSL/ShadersInclude/pbrBlockAnisotropic.d.ts +5 -0
  145. package/ShadersWGSL/ShadersInclude/pbrBlockAnisotropic.js +46 -0
  146. package/ShadersWGSL/ShadersInclude/pbrBlockAnisotropic.js.map +1 -0
  147. package/ShadersWGSL/ShadersInclude/pbrBlockClearcoat.d.ts +5 -0
  148. package/ShadersWGSL/ShadersInclude/pbrBlockClearcoat.js +267 -0
  149. package/ShadersWGSL/ShadersInclude/pbrBlockClearcoat.js.map +1 -0
  150. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.d.ts +5 -0
  151. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js +24 -0
  152. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js.map +1 -0
  153. package/ShadersWGSL/ShadersInclude/pbrBlockFinalColorComposition.d.ts +5 -0
  154. package/ShadersWGSL/ShadersInclude/pbrBlockFinalColorComposition.js +51 -0
  155. package/ShadersWGSL/ShadersInclude/pbrBlockFinalColorComposition.js.map +1 -0
  156. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.d.ts +5 -0
  157. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +96 -0
  158. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -0
  159. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.d.ts +5 -0
  160. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +26 -0
  161. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -0
  162. package/ShadersWGSL/ShadersInclude/pbrBlockGeometryInfo.d.ts +5 -0
  163. package/ShadersWGSL/ShadersInclude/pbrBlockGeometryInfo.js +33 -0
  164. package/ShadersWGSL/ShadersInclude/pbrBlockGeometryInfo.js.map +1 -0
  165. package/ShadersWGSL/ShadersInclude/pbrBlockImageProcessing.d.ts +5 -0
  166. package/ShadersWGSL/ShadersInclude/pbrBlockImageProcessing.js +20 -0
  167. package/ShadersWGSL/ShadersInclude/pbrBlockImageProcessing.js.map +1 -0
  168. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.d.ts +5 -0
  169. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js +51 -0
  170. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js.map +1 -0
  171. package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.d.ts +5 -0
  172. package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.js +19 -0
  173. package/ShadersWGSL/ShadersInclude/pbrBlockLightmapInit.js.map +1 -0
  174. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.d.ts +5 -0
  175. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +19 -0
  176. package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -0
  177. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.d.ts +5 -0
  178. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +30 -0
  179. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -0
  180. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.d.ts +5 -0
  181. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.js +18 -0
  182. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.js.map +1 -0
  183. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.d.ts +5 -0
  184. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +277 -0
  185. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -0
  186. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.d.ts +5 -0
  187. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +120 -0
  188. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -0
  189. package/ShadersWGSL/ShadersInclude/pbrBlockSheen.d.ts +5 -0
  190. package/ShadersWGSL/ShadersInclude/pbrBlockSheen.js +195 -0
  191. package/ShadersWGSL/ShadersInclude/pbrBlockSheen.js.map +1 -0
  192. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.d.ts +5 -0
  193. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +425 -0
  194. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -0
  195. package/ShadersWGSL/ShadersInclude/pbrDebug.d.ts +5 -0
  196. package/ShadersWGSL/ShadersInclude/pbrDebug.js +193 -0
  197. package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -0
  198. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.d.ts +5 -0
  199. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js +43 -0
  200. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFalloffFunctions.js.map +1 -0
  201. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +5 -0
  202. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +68 -0
  203. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -0
  204. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.d.ts +5 -0
  205. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +30 -0
  206. package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -0
  207. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.d.ts +5 -0
  208. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +41 -0
  209. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -0
  210. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.d.ts +5 -0
  211. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js +23 -0
  212. package/ShadersWGSL/ShadersInclude/pbrIBLFunctions.js.map +1 -0
  213. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { Observable } from "../../Misc/observable";
2
2
  import type { Nullable } from "../../types";
3
3
  import { Mesh } from "../mesh";
4
+ import type { VertexData } from "../mesh.vertexData";
4
5
  import type { Scene } from "../../scene";
5
6
  import { GeometryOutputBlock } from "./Blocks/geometryOutputBlock";
6
7
  import type { NodeGeometryBlock } from "./nodeGeometryBlock";
@@ -77,6 +78,11 @@ export declare class NodeGeometry {
77
78
  * @returns the class name
78
79
  */
79
80
  getClassName(): string;
81
+ /**
82
+ * Gets the vertex data. This needs to be done after build() was called.
83
+ * This is used to access vertexData when creating a mesh is not required.
84
+ */
85
+ get vertexData(): Nullable<VertexData>;
80
86
  /**
81
87
  * Get a block by its name
82
88
  * @param name defines the name of the block to retrieve
@@ -70,6 +70,13 @@ export class NodeGeometry {
70
70
  getClassName() {
71
71
  return "NodeGeometry";
72
72
  }
73
+ /**
74
+ * Gets the vertex data. This needs to be done after build() was called.
75
+ * This is used to access vertexData when creating a mesh is not required.
76
+ */
77
+ get vertexData() {
78
+ return this._vertexData;
79
+ }
73
80
  /**
74
81
  * Get a block by its name
75
82
  * @param name defines the name of the block to retrieve
@@ -1 +1 @@
1
- {"version":3,"file":"nodeGeometry.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometry.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,S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,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;wBAE7D,IAAI,CAAC,YAAY,EAAE;4BACf,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;yBAC1G;wBAED,YAAY,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;wBACxD,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;wBAEnC,IAAI;4BACA,IAAI,CAAC,SAAS,EAAE;gCACZ,YAAY,CAAC,KAAK,EAAE,CAAC;6BACxB;4BACD,OAAO,CAAC,YAAY,CAAC,CAAC;yBACzB;wBAAC,OAAO,GAAG,EAAE;4BACV,MAAM,CAAC,GAAG,CAAC,CAAC;yBACf;qBACJ;yBAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AA1oBc,8BAAiB,GAAW,CAAC,AAAZ,CAAa;AAM7C,gDAAgD;AAClC,sBAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC,OAAO,mDAAmD,AAAhG,CAAiG;AAExH,sCAAsC;AACxB,uBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAuDzC;IADN,SAAS,EAAE;0CACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;6CACE","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { GeometryOutputBlock } from \"./Blocks/geometryOutputBlock\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { BoxBlock } from \"./Blocks/Sources/boxBlock\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { TeleportOutBlock } from \"./Blocks/Teleport/teleportOutBlock\";\r\nimport type { TeleportInBlock } from \"./Blocks/Teleport/teleportInBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { Engine } from \"../../Engines/engine\";\r\n\r\n// declare NODEGEOMETRYEDITOR namespace for compilation issue\r\ndeclare let NODEGEOMETRYEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node geometry editor\r\n */\r\nexport interface INodeGeometryEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NGE */\r\n nodeGeometryEditorConfig?: {\r\n backgroundColor?: Color4;\r\n hostScene?: Scene;\r\n hostMesh?: Mesh;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a node based geometry\r\n * @see demo at https://playground.babylonjs.com#PYY6XE#69\r\n */\r\nexport class NodeGeometry {\r\n private static _BuildIdGenerator: number = 0;\r\n private _buildId: number = NodeGeometry._BuildIdGenerator++;\r\n private _buildWasSuccessful = false;\r\n private _vertexData: Nullable<VertexData> = null;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/nodeGeometryEditor/babylon.nodeGeometryEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODEGEOMETRYEDITOR = this._getGlobalNodeGeometryEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeGeometryEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEGEOMETRYEDITOR !== \"undefined\") {\r\n return NODEGEOMETRYEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeGeometryEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeGeometryBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the geometry is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometry>();\r\n\r\n /** Gets or sets the GeometryOutputBlock used to gather the final geometry data */\r\n public outputBlock: Nullable<GeometryOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the geometry\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the geometry\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param name defines the name of the geometry\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeGeometry\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometry\";\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeGeometryBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: GeometryInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as GeometryInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node geometry editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeGeometryEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n if (typeof this.BJSNODEGEOMETRYEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeGeometry.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the NGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeGeometry: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final geometry\r\n * @param verbose defines if the build should log activity\r\n * @param updateBuildId defines if the internal build Id should be updated (default is true)\r\n * @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)\r\n */\r\n public build(verbose: boolean = false, updateBuildId = true, autoConfigure = false) {\r\n this._buildWasSuccessful = false;\r\n\r\n if (!this.outputBlock) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"You must define the outputBlock property before building the geometry\";\r\n }\r\n const now = PrecisionDate.Now;\r\n // Initialize blocks\r\n this._initializeBlock(this.outputBlock, autoConfigure);\r\n\r\n // Build\r\n const state = new NodeGeometryBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = verbose;\r\n\r\n this.outputBlock.build(state);\r\n\r\n if (updateBuildId) {\r\n this._buildId = NodeGeometry._BuildIdGenerator++;\r\n }\r\n\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n this._buildWasSuccessful = true;\r\n this._vertexData = state.vertexData;\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param name defines the name of the mesh\r\n * @param scene The scene the mesh is scoped to\r\n * @returns The new mesh\r\n */\r\n public createMesh(name: string, scene: Nullable<Scene> = null): Nullable<Mesh> {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return null;\r\n }\r\n\r\n const mesh = new Mesh(name, scene);\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param mesh the mesh to update\r\n * @returns True if successfully updated\r\n */\r\n public updateMesh(mesh: Mesh) {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return false;\r\n }\r\n\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n private _initializeBlock(node: NodeGeometryBlock, autoConfigure = true) {\r\n node.initialize();\r\n if (autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n node._preparationId = this._buildId;\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current geometry\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeGeometryBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the geometry\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeGeometryBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as TeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as TeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as GeometryOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeGeometryBlock, source: any, map: { [key: number]: NodeGeometryBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this geometry\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeGeometryBlock[] = [];\r\n const blocks: NodeGeometryBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n let codeString = `let nodeGeometry = new BABYLON.NodeGeometry(\"${this.name || \"node geometry\"}\");\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeGeometry.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeGeometry.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeGeometryBlock, list: NodeGeometryBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as TeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source\r\n const dataBlock = new BoxBlock(\"Box\");\r\n dataBlock.autoConfigure();\r\n\r\n // Final output\r\n const output = new GeometryOutputBlock(\"Geometry Output\");\r\n dataBlock.geometry.connectTo(output.geometry);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current geometry.\r\n * @param name defines the name to use for the new geometry\r\n * @returns the new geometry\r\n */\r\n public clone(name: string): NodeGeometry {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeGeometry(name), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build(false);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeGeometryBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeGeometryBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeGeometry\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node geometry set to default basic configuration\r\n * @param name defines the name of the geometry\r\n * @returns a new NodeGeometry\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeGeometry = new NodeGeometry(name);\r\n\r\n nodeGeometry.setToDefault();\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from parsed geometry data\r\n * @param source defines the JSON representation of the geometry\r\n * @returns a new node geometry\r\n */\r\n public static Parse(source: any): NodeGeometry {\r\n const nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(source.name), source, null);\r\n\r\n nodeGeometry.parseSerializedObject(source);\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeGeometry defines a node geometry to update (instead of creating a new one)\r\n * @param skipBuild defines whether to build the node geometry\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n public static ParseFromSnippetAsync(snippetId: string, nodeGeometry?: NodeGeometry, skipBuild: boolean = false): Promise<NodeGeometry> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeGeometry.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeGeometry);\r\n\r\n if (!nodeGeometry) {\r\n nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeGeometry.parseSerializedObject(serializationObject);\r\n nodeGeometry.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeGeometry.build();\r\n }\r\n resolve(nodeGeometry);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeGeometry.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometry.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE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BACzE,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;wBAE7D,IAAI,CAAC,YAAY,EAAE;4BACf,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;yBAC1G;wBAED,YAAY,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;wBACxD,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;wBAEnC,IAAI;4BACA,IAAI,CAAC,SAAS,EAAE;gCACZ,YAAY,CAAC,KAAK,EAAE,CAAC;6BACxB;4BACD,OAAO,CAAC,YAAY,CAAC,CAAC;yBACzB;wBAAC,OAAO,GAAG,EAAE;4BACV,MAAM,CAAC,GAAG,CAAC,CAAC;yBACf;qBACJ;yBAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AAlpBc,8BAAiB,GAAW,CAAC,AAAZ,CAAa;AAM7C,gDAAgD;AAClC,sBAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC,OAAO,mDAAmD,AAAhG,CAAiG;AAExH,sCAAsC;AACxB,uBAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAuDzC;IADN,SAAS,EAAE;0CACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;6CACE","sourcesContent":["import { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport type { VertexData } from \"../mesh.vertexData\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { GeometryOutputBlock } from \"./Blocks/geometryOutputBlock\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { BoxBlock } from \"./Blocks/Sources/boxBlock\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport { PrecisionDate } from \"../../Misc/precisionDate\";\r\nimport type { TeleportOutBlock } from \"./Blocks/Teleport/teleportOutBlock\";\r\nimport type { TeleportInBlock } from \"./Blocks/Teleport/teleportInBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Color4 } from \"../../Maths/math.color\";\r\nimport { Engine } from \"../../Engines/engine\";\r\n\r\n// declare NODEGEOMETRYEDITOR namespace for compilation issue\r\ndeclare let NODEGEOMETRYEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node geometry editor\r\n */\r\nexport interface INodeGeometryEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NGE */\r\n nodeGeometryEditorConfig?: {\r\n backgroundColor?: Color4;\r\n hostScene?: Scene;\r\n hostMesh?: Mesh;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a node based geometry\r\n * @see demo at https://playground.babylonjs.com#PYY6XE#69\r\n */\r\nexport class NodeGeometry {\r\n private static _BuildIdGenerator: number = 0;\r\n private _buildId: number = NodeGeometry._BuildIdGenerator++;\r\n private _buildWasSuccessful = false;\r\n private _vertexData: Nullable<VertexData> = null;\r\n private _buildExecutionTime: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/nodeGeometryEditor/babylon.nodeGeometryEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODEGEOMETRYEDITOR = this._getGlobalNodeGeometryEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeGeometryEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEGEOMETRYEDITOR !== \"undefined\") {\r\n return NODEGEOMETRYEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeGeometryEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the time spent to build this block (in ms)\r\n */\r\n public get buildExecutionTime() {\r\n return this._buildExecutionTime;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeGeometryBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the geometry is built\r\n */\r\n public onBuildObservable = new Observable<NodeGeometry>();\r\n\r\n /** Gets or sets the GeometryOutputBlock used to gather the final geometry data */\r\n public outputBlock: Nullable<GeometryOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the geometry\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the geometry\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param name defines the name of the geometry\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeGeometry\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometry\";\r\n }\r\n\r\n /**\r\n * Gets the vertex data. This needs to be done after build() was called.\r\n * This is used to access vertexData when creating a mesh is not required.\r\n */\r\n public get vertexData() {\r\n return this._vertexData;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeGeometryBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: GeometryInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as GeometryInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node geometry editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeGeometryEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n if (typeof this.BJSNODEGEOMETRYEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeGeometry.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEGEOMETRYEDITOR = this.BJSNODEGEOMETRYEDITOR || this._getGlobalNodeGeometryEditor();\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeGeometryEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the NGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeGeometry: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEGEOMETRYEDITOR.NodeGeometryEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final geometry\r\n * @param verbose defines if the build should log activity\r\n * @param updateBuildId defines if the internal build Id should be updated (default is true)\r\n * @param autoConfigure defines if the autoConfigure method should be called when initializing blocks (default is false)\r\n */\r\n public build(verbose: boolean = false, updateBuildId = true, autoConfigure = false) {\r\n this._buildWasSuccessful = false;\r\n\r\n if (!this.outputBlock) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"You must define the outputBlock property before building the geometry\";\r\n }\r\n const now = PrecisionDate.Now;\r\n // Initialize blocks\r\n this._initializeBlock(this.outputBlock, autoConfigure);\r\n\r\n // Build\r\n const state = new NodeGeometryBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = verbose;\r\n\r\n this.outputBlock.build(state);\r\n\r\n if (updateBuildId) {\r\n this._buildId = NodeGeometry._BuildIdGenerator++;\r\n }\r\n\r\n this._buildExecutionTime = PrecisionDate.Now - now;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n this._buildWasSuccessful = true;\r\n this._vertexData = state.vertexData;\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param name defines the name of the mesh\r\n * @param scene The scene the mesh is scoped to\r\n * @returns The new mesh\r\n */\r\n public createMesh(name: string, scene: Nullable<Scene> = null): Nullable<Mesh> {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return null;\r\n }\r\n\r\n const mesh = new Mesh(name, scene);\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Creates a mesh from the geometry blocks\r\n * @param mesh the mesh to update\r\n * @returns True if successfully updated\r\n */\r\n public updateMesh(mesh: Mesh) {\r\n if (!this._buildWasSuccessful) {\r\n this.build();\r\n }\r\n\r\n if (!this._vertexData) {\r\n return false;\r\n }\r\n\r\n this._vertexData.applyToMesh(mesh);\r\n\r\n mesh._internalMetadata = mesh._internalMetadata || {};\r\n mesh._internalMetadata.nodeGeometry = this;\r\n\r\n return mesh;\r\n }\r\n\r\n private _initializeBlock(node: NodeGeometryBlock, autoConfigure = true) {\r\n node.initialize();\r\n if (autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n node._preparationId = this._buildId;\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current geometry\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeGeometryBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the geometry\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeGeometryBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeGeometryBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as TeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as TeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as GeometryOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeGeometryBlock, source: any, map: { [key: number]: NodeGeometryBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this geometry\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeGeometryBlock[] = [];\r\n const blocks: NodeGeometryBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n let codeString = `let nodeGeometry = new BABYLON.NodeGeometry(\"${this.name || \"node geometry\"}\");\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeGeometry.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeGeometry.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeGeometryBlock, list: NodeGeometryBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as TeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current geometry and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source\r\n const dataBlock = new BoxBlock(\"Box\");\r\n dataBlock.autoConfigure();\r\n\r\n // Final output\r\n const output = new GeometryOutputBlock(\"Geometry Output\");\r\n dataBlock.geometry.connectTo(output.geometry);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current geometry.\r\n * @param name defines the name to use for the new geometry\r\n * @returns the new geometry\r\n */\r\n public clone(name: string): NodeGeometry {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeGeometry(name), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build(false);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeGeometryBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeGeometryBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeGeometry\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node geometry set to default basic configuration\r\n * @param name defines the name of the geometry\r\n * @returns a new NodeGeometry\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeGeometry = new NodeGeometry(name);\r\n\r\n nodeGeometry.setToDefault();\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from parsed geometry data\r\n * @param source defines the JSON representation of the geometry\r\n * @returns a new node geometry\r\n */\r\n public static Parse(source: any): NodeGeometry {\r\n const nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(source.name), source, null);\r\n\r\n nodeGeometry.parseSerializedObject(source);\r\n nodeGeometry.build();\r\n\r\n return nodeGeometry;\r\n }\r\n\r\n /**\r\n * Creates a node geometry from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeGeometry defines a node geometry to update (instead of creating a new one)\r\n * @param skipBuild defines whether to build the node geometry\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n public static ParseFromSnippetAsync(snippetId: string, nodeGeometry?: NodeGeometry, skipBuild: boolean = false): Promise<NodeGeometry> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeGeometry.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeGeometry);\r\n\r\n if (!nodeGeometry) {\r\n nodeGeometry = SerializationHelper.Parse(() => new NodeGeometry(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeGeometry.parseSerializedObject(serializationObject);\r\n nodeGeometry.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeGeometry.build();\r\n }\r\n resolve(nodeGeometry);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
package/Meshes/mesh.d.ts CHANGED
@@ -330,6 +330,7 @@ export declare class Mesh extends AbstractMesh implements IGetSetVerticesData {
330
330
  /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices must be performed in all cases (and notably even in frozen mode) */
331
331
  get forceWorldMatrixInstancedBufferUpdate(): boolean;
332
332
  set forceWorldMatrixInstancedBufferUpdate(value: boolean);
333
+ protected _copySource(source: Mesh, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): void;
333
334
  /**
334
335
  * Constructor
335
336
  * @param name The value used by scene.getMeshByName() to do a lookup.
package/Meshes/mesh.js CHANGED
@@ -296,6 +296,143 @@ export class Mesh extends AbstractMesh {
296
296
  set forceWorldMatrixInstancedBufferUpdate(value) {
297
297
  this._instanceDataStorage.forceMatrixUpdates = value;
298
298
  }
299
+ _copySource(source, doNotCloneChildren, clonePhysicsImpostor = true) {
300
+ const scene = this.getScene();
301
+ // Geometry
302
+ if (source._geometry) {
303
+ source._geometry.applyToMesh(this);
304
+ }
305
+ // Deep copy
306
+ DeepCopier.DeepCopy(source, this, [
307
+ "name",
308
+ "material",
309
+ "skeleton",
310
+ "instances",
311
+ "parent",
312
+ "uniqueId",
313
+ "source",
314
+ "metadata",
315
+ "morphTargetManager",
316
+ "hasInstances",
317
+ "worldMatrixInstancedBuffer",
318
+ "previousWorldMatrixInstancedBuffer",
319
+ "hasLODLevels",
320
+ "geometry",
321
+ "isBlocked",
322
+ "areNormalsFrozen",
323
+ "facetNb",
324
+ "isFacetDataEnabled",
325
+ "lightSources",
326
+ "useBones",
327
+ "isAnInstance",
328
+ "collider",
329
+ "edgesRenderer",
330
+ "forward",
331
+ "up",
332
+ "right",
333
+ "absolutePosition",
334
+ "absoluteScaling",
335
+ "absoluteRotationQuaternion",
336
+ "isWorldMatrixFrozen",
337
+ "nonUniformScaling",
338
+ "behaviors",
339
+ "worldMatrixFromCache",
340
+ "hasThinInstances",
341
+ "cloneMeshMap",
342
+ "hasBoundingInfo",
343
+ "physicsBody",
344
+ "physicsImpostor",
345
+ ], ["_poseMatrix"]);
346
+ // Source mesh
347
+ this._internalMeshDataInfo._source = source;
348
+ if (scene.useClonedMeshMap) {
349
+ if (!source._internalMeshDataInfo.meshMap) {
350
+ source._internalMeshDataInfo.meshMap = {};
351
+ }
352
+ source._internalMeshDataInfo.meshMap[this.uniqueId] = this;
353
+ }
354
+ // Construction Params
355
+ // Clone parameters allowing mesh to be updated in case of parametric shapes.
356
+ this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;
357
+ this._creationDataStorage = source._creationDataStorage;
358
+ // Animation ranges
359
+ if (source._ranges) {
360
+ const ranges = source._ranges;
361
+ for (const name in ranges) {
362
+ if (!Object.prototype.hasOwnProperty.call(ranges, name)) {
363
+ continue;
364
+ }
365
+ if (!ranges[name]) {
366
+ continue;
367
+ }
368
+ this.createAnimationRange(name, ranges[name].from, ranges[name].to);
369
+ }
370
+ }
371
+ // Metadata
372
+ if (source.metadata && source.metadata.clone) {
373
+ this.metadata = source.metadata.clone();
374
+ }
375
+ else {
376
+ this.metadata = source.metadata;
377
+ }
378
+ this._internalMetadata = source._internalMetadata;
379
+ // Tags
380
+ if (Tags && Tags.HasTags(source)) {
381
+ Tags.AddTagsTo(this, Tags.GetTags(source, true));
382
+ }
383
+ // Enabled. We shouldn't need to check the source's ancestors, as this mesh
384
+ // will have the same ones.
385
+ this.setEnabled(source.isEnabled(false));
386
+ // Parent
387
+ this.parent = source.parent;
388
+ // Pivot
389
+ this.setPivotMatrix(source.getPivotMatrix(), this._postMultiplyPivotMatrix);
390
+ this.id = name + "." + source.id;
391
+ // Material
392
+ this.material = source.material;
393
+ if (!doNotCloneChildren) {
394
+ // Children
395
+ const directDescendants = source.getDescendants(true);
396
+ for (let index = 0; index < directDescendants.length; index++) {
397
+ const child = directDescendants[index];
398
+ if (child.clone) {
399
+ child.clone(name + "." + child.name, this);
400
+ }
401
+ }
402
+ }
403
+ // Morphs
404
+ if (source.morphTargetManager) {
405
+ this.morphTargetManager = source.morphTargetManager;
406
+ }
407
+ // Physics clone
408
+ if (scene.getPhysicsEngine) {
409
+ const physicsEngine = scene.getPhysicsEngine();
410
+ if (clonePhysicsImpostor && physicsEngine) {
411
+ if (physicsEngine.getPluginVersion() === 1) {
412
+ const impostor = physicsEngine.getImpostorForPhysicsObject(source);
413
+ if (impostor) {
414
+ this.physicsImpostor = impostor.clone(this);
415
+ }
416
+ }
417
+ else if (physicsEngine.getPluginVersion() === 2) {
418
+ if (source.physicsBody) {
419
+ source.physicsBody.clone(this);
420
+ }
421
+ }
422
+ }
423
+ }
424
+ // Particles
425
+ for (let index = 0; index < scene.particleSystems.length; index++) {
426
+ const system = scene.particleSystems[index];
427
+ if (system.emitter === source) {
428
+ system.clone(system.name, this);
429
+ }
430
+ }
431
+ // Skeleton
432
+ this.skeleton = source.skeleton;
433
+ this.refreshBoundingInfo(true, true);
434
+ this.computeWorldMatrix(true);
435
+ }
299
436
  /**
300
437
  * Constructor
301
438
  * @param name The value used by scene.getMeshByName() to do a lookup.
@@ -364,140 +501,7 @@ export class Mesh extends AbstractMesh {
364
501
  }
365
502
  };
366
503
  if (source) {
367
- // Geometry
368
- if (source._geometry) {
369
- source._geometry.applyToMesh(this);
370
- }
371
- // Deep copy
372
- DeepCopier.DeepCopy(source, this, [
373
- "name",
374
- "material",
375
- "skeleton",
376
- "instances",
377
- "parent",
378
- "uniqueId",
379
- "source",
380
- "metadata",
381
- "morphTargetManager",
382
- "hasInstances",
383
- "worldMatrixInstancedBuffer",
384
- "previousWorldMatrixInstancedBuffer",
385
- "hasLODLevels",
386
- "geometry",
387
- "isBlocked",
388
- "areNormalsFrozen",
389
- "facetNb",
390
- "isFacetDataEnabled",
391
- "lightSources",
392
- "useBones",
393
- "isAnInstance",
394
- "collider",
395
- "edgesRenderer",
396
- "forward",
397
- "up",
398
- "right",
399
- "absolutePosition",
400
- "absoluteScaling",
401
- "absoluteRotationQuaternion",
402
- "isWorldMatrixFrozen",
403
- "nonUniformScaling",
404
- "behaviors",
405
- "worldMatrixFromCache",
406
- "hasThinInstances",
407
- "cloneMeshMap",
408
- "hasBoundingInfo",
409
- "physicsBody",
410
- "physicsImpostor",
411
- ], ["_poseMatrix"]);
412
- // Source mesh
413
- this._internalMeshDataInfo._source = source;
414
- if (scene.useClonedMeshMap) {
415
- if (!source._internalMeshDataInfo.meshMap) {
416
- source._internalMeshDataInfo.meshMap = {};
417
- }
418
- source._internalMeshDataInfo.meshMap[this.uniqueId] = this;
419
- }
420
- // Construction Params
421
- // Clone parameters allowing mesh to be updated in case of parametric shapes.
422
- this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;
423
- this._creationDataStorage = source._creationDataStorage;
424
- // Animation ranges
425
- if (source._ranges) {
426
- const ranges = source._ranges;
427
- for (const name in ranges) {
428
- if (!Object.prototype.hasOwnProperty.call(ranges, name)) {
429
- continue;
430
- }
431
- if (!ranges[name]) {
432
- continue;
433
- }
434
- this.createAnimationRange(name, ranges[name].from, ranges[name].to);
435
- }
436
- }
437
- // Metadata
438
- if (source.metadata && source.metadata.clone) {
439
- this.metadata = source.metadata.clone();
440
- }
441
- else {
442
- this.metadata = source.metadata;
443
- }
444
- this._internalMetadata = source._internalMetadata;
445
- // Tags
446
- if (Tags && Tags.HasTags(source)) {
447
- Tags.AddTagsTo(this, Tags.GetTags(source, true));
448
- }
449
- // Enabled. We shouldn't need to check the source's ancestors, as this mesh
450
- // will have the same ones.
451
- this.setEnabled(source.isEnabled(false));
452
- // Parent
453
- this.parent = source.parent;
454
- // Pivot
455
- this.setPivotMatrix(source.getPivotMatrix(), this._postMultiplyPivotMatrix);
456
- this.id = name + "." + source.id;
457
- // Material
458
- this.material = source.material;
459
- if (!doNotCloneChildren) {
460
- // Children
461
- const directDescendants = source.getDescendants(true);
462
- for (let index = 0; index < directDescendants.length; index++) {
463
- const child = directDescendants[index];
464
- if (child.clone) {
465
- child.clone(name + "." + child.name, this);
466
- }
467
- }
468
- }
469
- // Morphs
470
- if (source.morphTargetManager) {
471
- this.morphTargetManager = source.morphTargetManager;
472
- }
473
- // Physics clone
474
- if (scene.getPhysicsEngine) {
475
- const physicsEngine = scene.getPhysicsEngine();
476
- if (clonePhysicsImpostor && physicsEngine) {
477
- if (physicsEngine.getPluginVersion() === 1) {
478
- const impostor = physicsEngine.getImpostorForPhysicsObject(source);
479
- if (impostor) {
480
- this.physicsImpostor = impostor.clone(this);
481
- }
482
- }
483
- else if (physicsEngine.getPluginVersion() === 2) {
484
- if (source.physicsBody) {
485
- source.physicsBody.clone(this);
486
- }
487
- }
488
- }
489
- }
490
- // Particles
491
- for (let index = 0; index < scene.particleSystems.length; index++) {
492
- const system = scene.particleSystems[index];
493
- if (system.emitter === source) {
494
- system.clone(system.name, this);
495
- }
496
- }
497
- // Skeleton
498
- this.skeleton = source.skeleton;
499
- this.refreshBoundingInfo(true, true);
500
- this.computeWorldMatrix(true);
504
+ this._copySource(source, doNotCloneChildren, clonePhysicsImpostor);
501
505
  }
502
506
  // Parent
503
507
  if (parent !== null) {