@babylonjs/core 6.24.0 → 6.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/Buffers/buffer.align.d.ts +25 -0
  2. package/Buffers/buffer.align.js +120 -0
  3. package/Buffers/buffer.align.js.map +1 -0
  4. package/Buffers/buffer.d.ts +15 -3
  5. package/Buffers/buffer.js +27 -7
  6. package/Buffers/buffer.js.map +1 -1
  7. package/Buffers/index.d.ts +1 -0
  8. package/Buffers/index.js +1 -0
  9. package/Buffers/index.js.map +1 -1
  10. package/Cameras/Inputs/BaseCameraPointersInput.js +0 -3
  11. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  12. package/Cameras/Inputs/flyCameraMouseInput.js +1 -4
  13. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  14. package/Cameras/Inputs/freeCameraMouseInput.js +0 -6
  15. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  16. package/Cameras/RigModes/index.d.ts +0 -1
  17. package/Cameras/RigModes/index.js +0 -1
  18. package/Cameras/RigModes/index.js.map +1 -1
  19. package/Cameras/RigModes/vrRigMode.js +1 -1
  20. package/Cameras/RigModes/vrRigMode.js.map +1 -1
  21. package/Cameras/VR/index.d.ts +0 -1
  22. package/Cameras/VR/index.js +0 -1
  23. package/Cameras/VR/index.js.map +1 -1
  24. package/Cameras/VR/vrExperienceHelper.d.ts +7 -66
  25. package/Cameras/VR/vrExperienceHelper.js +17 -702
  26. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  27. package/Cameras/camera.d.ts +15 -20
  28. package/Cameras/camera.js +41 -36
  29. package/Cameras/camera.js.map +1 -1
  30. package/Cameras/targetCamera.js +1 -1
  31. package/Cameras/targetCamera.js.map +1 -1
  32. package/Debug/debugLayer.js +2 -2
  33. package/Debug/debugLayer.js.map +1 -1
  34. package/Engines/Extensions/index.d.ts +0 -1
  35. package/Engines/Extensions/index.js +0 -1
  36. package/Engines/Extensions/index.js.map +1 -1
  37. package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +4 -0
  38. package/Engines/WebGL/webGLRenderTargetWrapper.js +4 -0
  39. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  40. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +8 -7
  41. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  42. package/Engines/WebGPU/webgpuCacheSampler.js +1 -1
  43. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  44. package/Engines/WebGPU/webgpuTintWASM.js +4 -10
  45. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  46. package/Engines/constants.d.ts +0 -4
  47. package/Engines/constants.js +0 -4
  48. package/Engines/constants.js.map +1 -1
  49. package/Engines/engine.d.ts +38 -258
  50. package/Engines/engine.js +0 -65
  51. package/Engines/engine.js.map +1 -1
  52. package/Engines/engineFactory.js +9 -14
  53. package/Engines/engineFactory.js.map +1 -1
  54. package/Engines/engineFeatures.d.ts +2 -0
  55. package/Engines/engineFeatures.js.map +1 -1
  56. package/Engines/nativeEngine.js +1 -0
  57. package/Engines/nativeEngine.js.map +1 -1
  58. package/Engines/nullEngine.js +1 -0
  59. package/Engines/nullEngine.js.map +1 -1
  60. package/Engines/thinEngine.d.ts +22 -5
  61. package/Engines/thinEngine.js +55 -22
  62. package/Engines/thinEngine.js.map +1 -1
  63. package/Engines/webgpuEngine.d.ts +1 -0
  64. package/Engines/webgpuEngine.js +9 -14
  65. package/Engines/webgpuEngine.js.map +1 -1
  66. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.d.ts +9 -8
  67. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js +34 -16
  68. package/FlowGraph/Blocks/Data/Logic/flowGraphBitwiseBlocks.js.map +1 -1
  69. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.d.ts +4 -3
  70. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js +14 -6
  71. package/FlowGraph/Blocks/Data/Logic/flowGraphLogicBlocks.js.map +1 -1
  72. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.d.ts +19 -14
  73. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js +64 -27
  74. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixBlocks.js.map +1 -1
  75. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.d.ts +39 -41
  76. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js +152 -74
  77. package/FlowGraph/Blocks/Data/Math/flowGraphNumberMathBlocks.js.map +1 -1
  78. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.d.ts +13 -12
  79. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js +42 -21
  80. package/FlowGraph/Blocks/Data/Math/flowGraphVector2MathBlocks.js.map +1 -1
  81. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.d.ts +17 -13
  82. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js +62 -26
  83. package/FlowGraph/Blocks/Data/Math/flowGraphVector3MathBlocks.js.map +1 -1
  84. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.d.ts +13 -9
  85. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js +46 -18
  86. package/FlowGraph/Blocks/Data/Math/flowGraphVector4MathBlocks.js.map +1 -1
  87. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +4 -1
  88. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +6 -2
  89. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  90. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +3 -1
  91. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +7 -2
  92. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  93. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +5 -3
  94. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +10 -5
  95. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  96. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +4 -1
  97. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +6 -2
  98. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  99. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +3 -1
  100. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +7 -2
  101. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  102. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +3 -1
  103. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +7 -2
  104. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  105. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +4 -1
  106. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +6 -2
  107. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  108. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +6 -2
  109. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -3
  110. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  111. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +5 -3
  112. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +11 -6
  113. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  114. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +1 -0
  115. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +7 -2
  116. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  117. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +1 -0
  118. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +7 -2
  119. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  120. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +3 -1
  121. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +7 -2
  122. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  123. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +3 -1
  124. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +8 -3
  125. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  126. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +3 -1
  127. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +7 -2
  128. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  129. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.d.ts +3 -1
  130. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js +7 -2
  131. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  132. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.d.ts +3 -1
  133. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js +7 -2
  134. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  135. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -1
  136. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +7 -2
  137. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  138. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -1
  139. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +7 -2
  140. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  141. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -1
  142. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +7 -2
  143. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  144. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +3 -1
  145. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +7 -2
  146. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  147. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -1
  148. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +7 -2
  149. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  150. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -1
  151. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +7 -2
  152. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  153. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +6 -3
  154. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +22 -16
  155. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  156. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +7 -4
  157. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +15 -10
  158. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  159. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -1
  160. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +7 -2
  161. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  162. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +3 -1
  163. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +8 -3
  164. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  165. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +7 -4
  166. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +14 -7
  167. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  168. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +5 -3
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +9 -4
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  171. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.d.ts +3 -1
  172. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js +7 -2
  173. package/FlowGraph/Blocks/Execution/flowGraphLogBlock.js.map +1 -1
  174. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +3 -1
  175. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +8 -3
  176. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  177. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +3 -1
  178. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +7 -2
  179. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  180. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +3 -1
  181. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +7 -2
  182. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  183. package/FlowGraph/flowGraph.d.ts +41 -3
  184. package/FlowGraph/flowGraph.js +135 -0
  185. package/FlowGraph/flowGraph.js.map +1 -1
  186. package/FlowGraph/flowGraphAsyncExecutionBlock.d.ts +2 -1
  187. package/FlowGraph/flowGraphAsyncExecutionBlock.js +2 -2
  188. package/FlowGraph/flowGraphAsyncExecutionBlock.js.map +1 -1
  189. package/FlowGraph/flowGraphBlock.d.ts +15 -3
  190. package/FlowGraph/flowGraphBlock.js +50 -7
  191. package/FlowGraph/flowGraphBlock.js.map +1 -1
  192. package/FlowGraph/flowGraphConnection.d.ts +34 -4
  193. package/FlowGraph/flowGraphConnection.js +49 -3
  194. package/FlowGraph/flowGraphConnection.js.map +1 -1
  195. package/FlowGraph/flowGraphContext.d.ts +25 -5
  196. package/FlowGraph/flowGraphContext.js +86 -4
  197. package/FlowGraph/flowGraphContext.js.map +1 -1
  198. package/FlowGraph/flowGraphCoordinator.d.ts +7 -1
  199. package/FlowGraph/flowGraphCoordinator.js +18 -2
  200. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  201. package/FlowGraph/flowGraphDataConnection.d.ts +4 -11
  202. package/FlowGraph/flowGraphDataConnection.js +16 -14
  203. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  204. package/FlowGraph/flowGraphExecutionBlock.d.ts +8 -3
  205. package/FlowGraph/flowGraphExecutionBlock.js +37 -6
  206. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  207. package/FlowGraph/flowGraphRichTypes.d.ts +5 -9
  208. package/FlowGraph/flowGraphRichTypes.js +29 -44
  209. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  210. package/FlowGraph/flowGraphSignalConnection.js +2 -0
  211. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  212. package/FlowGraph/flowGraphVariableDefinitions.d.ts +22 -2
  213. package/FlowGraph/flowGraphVariableDefinitions.js +29 -0
  214. package/FlowGraph/flowGraphVariableDefinitions.js.map +1 -1
  215. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.d.ts +2 -1
  216. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js +2 -2
  217. package/FlowGraph/flowGraphWithOnDoneExecutionBlock.js.map +1 -1
  218. package/Gamepads/gamepadManager.js +0 -5
  219. package/Gamepads/gamepadManager.js.map +1 -1
  220. package/Gamepads/index.d.ts +0 -1
  221. package/Gamepads/index.js +0 -2
  222. package/Gamepads/index.js.map +1 -1
  223. package/Gizmos/gizmo.js +1 -4
  224. package/Gizmos/gizmo.js.map +1 -1
  225. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +24 -0
  226. package/Materials/GreasedLine/greasedLineMaterialDefaults.js +19 -0
  227. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -0
  228. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +243 -0
  229. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js +55 -0
  230. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -0
  231. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +253 -0
  232. package/Materials/{greasedLinePluginMaterial.js → GreasedLine/greasedLinePluginMaterial.js} +148 -205
  233. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -0
  234. package/Materials/{greasedLineSimpleMaterial.d.ts → GreasedLine/greasedLineSimpleMaterial.d.ts} +20 -48
  235. package/Materials/{greasedLineSimpleMaterial.js → GreasedLine/greasedLineSimpleMaterial.js} +74 -91
  236. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -0
  237. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
  238. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  239. package/Materials/Node/nodeMaterial.js +2 -2
  240. package/Materials/Node/nodeMaterial.js.map +1 -1
  241. package/Materials/Textures/texture.js +1 -0
  242. package/Materials/Textures/texture.js.map +1 -1
  243. package/Materials/index.d.ts +4 -1
  244. package/Materials/index.js +4 -1
  245. package/Materials/index.js.map +1 -1
  246. package/Materials/shadowDepthWrapper.d.ts +1 -0
  247. package/Materials/shadowDepthWrapper.js +17 -4
  248. package/Materials/shadowDepthWrapper.js.map +1 -1
  249. package/Maths/math.vector.d.ts +32 -22
  250. package/Maths/math.vector.js +54 -43
  251. package/Maths/math.vector.js.map +1 -1
  252. package/Meshes/Builders/greasedLineBuilder.d.ts +7 -6
  253. package/Meshes/Builders/greasedLineBuilder.js +65 -31
  254. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  255. package/Meshes/Compression/dracoCompression.js +7 -7
  256. package/Meshes/Compression/dracoCompression.js.map +1 -1
  257. package/Meshes/Compression/meshoptCompression.js +2 -2
  258. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  259. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +216 -0
  260. package/Meshes/GreasedLine/greasedLineBaseMesh.js +247 -0
  261. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -0
  262. package/Meshes/GreasedLine/greasedLineMesh.d.ts +93 -0
  263. package/Meshes/{greasedLineMesh.js → GreasedLine/greasedLineMesh.js} +29 -223
  264. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -0
  265. package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +107 -0
  266. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +462 -0
  267. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -0
  268. package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.d.ts +1 -1
  269. package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -1
  270. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +9 -2
  271. package/Meshes/Node/Blocks/Sources/meshBlock.js +17 -5
  272. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  273. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +15 -0
  274. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +50 -1
  275. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  276. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +5 -5
  277. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  278. package/Meshes/Node/nodeGeometry.d.ts +1 -2
  279. package/Meshes/Node/nodeGeometry.js +5 -6
  280. package/Meshes/Node/nodeGeometry.js.map +1 -1
  281. package/Meshes/Node/nodeGeometryBlock.d.ts +1 -2
  282. package/Meshes/Node/nodeGeometryBlock.js +1 -2
  283. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  284. package/Meshes/geometry.js +6 -12
  285. package/Meshes/geometry.js.map +1 -1
  286. package/Meshes/index.d.ts +3 -1
  287. package/Meshes/index.js +3 -1
  288. package/Meshes/index.js.map +1 -1
  289. package/Meshes/instancedMesh.js +9 -9
  290. package/Meshes/instancedMesh.js.map +1 -1
  291. package/Meshes/mesh.d.ts +4 -0
  292. package/Meshes/mesh.js +10 -1
  293. package/Meshes/mesh.js.map +1 -1
  294. package/Misc/basis.js +4 -4
  295. package/Misc/basis.js.map +1 -1
  296. package/Misc/deepCopier.js +3 -0
  297. package/Misc/deepCopier.js.map +1 -1
  298. package/Misc/fileTools.d.ts +2 -0
  299. package/Misc/fileTools.js +12 -3
  300. package/Misc/fileTools.js.map +1 -1
  301. package/Misc/greasedLineTools.d.ts +52 -5
  302. package/Misc/greasedLineTools.js +180 -10
  303. package/Misc/greasedLineTools.js.map +1 -1
  304. package/Misc/khronosTextureContainer2.js +21 -24
  305. package/Misc/khronosTextureContainer2.js.map +1 -1
  306. package/Misc/tools.d.ts +42 -2
  307. package/Misc/tools.js +102 -2
  308. package/Misc/tools.js.map +1 -1
  309. package/Particles/solidParticleSystem.d.ts +1 -1
  310. package/Particles/solidParticleSystem.js +2 -2
  311. package/Particles/solidParticleSystem.js.map +1 -1
  312. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +9 -2
  313. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  314. package/PostProcesses/motionBlurPostProcess.js +4 -1
  315. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  316. package/PostProcesses/postProcess.js +1 -6
  317. package/PostProcesses/postProcess.js.map +1 -1
  318. package/Rendering/geometryBufferRenderer.js +4 -0
  319. package/Rendering/geometryBufferRenderer.js.map +1 -1
  320. package/Shaders/ShadersInclude/bonesDeclaration.js +1 -1
  321. package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
  322. package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +1 -2
  323. package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
  324. package/Shaders/greasedLine.fragment.js +2 -5
  325. package/Shaders/greasedLine.fragment.js.map +1 -1
  326. package/Shaders/greasedLine.vertex.js +15 -4
  327. package/Shaders/greasedLine.vertex.js.map +1 -1
  328. package/XR/webXRDefaultExperience.d.ts +1 -1
  329. package/XR/webXRDefaultExperience.js +1 -1
  330. package/XR/webXRDefaultExperience.js.map +1 -1
  331. package/package.json +1 -1
  332. package/scene.d.ts +17 -10
  333. package/scene.js +25 -30
  334. package/scene.js.map +1 -1
  335. package/Cameras/RigModes/webVRRigMode.d.ts +0 -5
  336. package/Cameras/RigModes/webVRRigMode.js +0 -34
  337. package/Cameras/RigModes/webVRRigMode.js.map +0 -1
  338. package/Cameras/VR/webVRCamera.d.ts +0 -316
  339. package/Cameras/VR/webVRCamera.js +0 -618
  340. package/Cameras/VR/webVRCamera.js.map +0 -1
  341. package/Engines/Extensions/engine.webVR.d.ts +0 -91
  342. package/Engines/Extensions/engine.webVR.js +0 -195
  343. package/Engines/Extensions/engine.webVR.js.map +0 -1
  344. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.d.ts +0 -23
  345. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js +0 -18
  346. package/FlowGraph/Blocks/Execution/flowGraphCustomFunctionBlock.js.map +0 -1
  347. package/Gamepads/Controllers/daydreamController.d.ts +0 -38
  348. package/Gamepads/Controllers/daydreamController.js +0 -70
  349. package/Gamepads/Controllers/daydreamController.js.map +0 -1
  350. package/Gamepads/Controllers/gearVRController.d.ts +0 -39
  351. package/Gamepads/Controllers/gearVRController.js +0 -79
  352. package/Gamepads/Controllers/gearVRController.js.map +0 -1
  353. package/Gamepads/Controllers/genericController.d.ts +0 -34
  354. package/Gamepads/Controllers/genericController.js +0 -48
  355. package/Gamepads/Controllers/genericController.js.map +0 -1
  356. package/Gamepads/Controllers/index.d.ts +0 -8
  357. package/Gamepads/Controllers/index.js +0 -9
  358. package/Gamepads/Controllers/index.js.map +0 -1
  359. package/Gamepads/Controllers/oculusTouchController.d.ts +0 -78
  360. package/Gamepads/Controllers/oculusTouchController.js +0 -196
  361. package/Gamepads/Controllers/oculusTouchController.js.map +0 -1
  362. package/Gamepads/Controllers/poseEnabledController.d.ts +0 -219
  363. package/Gamepads/Controllers/poseEnabledController.js +0 -293
  364. package/Gamepads/Controllers/poseEnabledController.js.map +0 -1
  365. package/Gamepads/Controllers/viveController.d.ts +0 -52
  366. package/Gamepads/Controllers/viveController.js +0 -115
  367. package/Gamepads/Controllers/viveController.js.map +0 -1
  368. package/Gamepads/Controllers/webVRController.d.ts +0 -85
  369. package/Gamepads/Controllers/webVRController.js +0 -122
  370. package/Gamepads/Controllers/webVRController.js.map +0 -1
  371. package/Gamepads/Controllers/windowsMotionController.d.ts +0 -212
  372. package/Gamepads/Controllers/windowsMotionController.js +0 -519
  373. package/Gamepads/Controllers/windowsMotionController.js.map +0 -1
  374. package/Materials/greasedLinePluginMaterial.d.ts +0 -496
  375. package/Materials/greasedLinePluginMaterial.js.map +0 -1
  376. package/Materials/greasedLineSimpleMaterial.js.map +0 -1
  377. package/Meshes/greasedLineMesh.d.ts +0 -204
  378. package/Meshes/greasedLineMesh.js.map +0 -1
@@ -0,0 +1,462 @@
1
+ import { Quaternion, Vector3 } from "../../Maths/math.vector.js";
2
+ import { Mesh } from "../mesh.js";
3
+ import { Buffer } from "../../Buffers/buffer.js";
4
+ import { DeepCopier } from "../../Misc/deepCopier.js";
5
+ import { GreasedLineTools } from "../../Misc/greasedLineTools.js";
6
+ import { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from "./greasedLineBaseMesh.js";
7
+ Mesh._GreasedLineRibbonMeshParser = (parsedMesh, scene) => {
8
+ return GreasedLineRibbonMesh.Parse(parsedMesh, scene);
9
+ };
10
+ /**
11
+ * GreasedLineRibbonMesh
12
+ * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.
13
+ */
14
+ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
15
+ /**
16
+ * GreasedLineRibbonMesh
17
+ * @param name name of the mesh
18
+ * @param scene the scene
19
+ * @param _options mesh options
20
+ * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh
21
+ */
22
+ constructor(name, scene, _options, _pathOptions) {
23
+ var _a;
24
+ super(name, scene, _options);
25
+ this.name = name;
26
+ if (!_options.ribbonOptions) {
27
+ throw "'GreasedLineMeshOptions.ribbonOptions' is not set.";
28
+ }
29
+ this._paths = [];
30
+ this._counters = [];
31
+ this._slopes = [];
32
+ this._widths = (_a = _options.widths) !== null && _a !== void 0 ? _a : [];
33
+ this._ribbonWidths = [];
34
+ this._pathsOptions = _pathOptions !== null && _pathOptions !== void 0 ? _pathOptions : [];
35
+ if (_options.points) {
36
+ this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);
37
+ }
38
+ }
39
+ /**
40
+ * Adds new points to the line. It doesn't rerenders the line if in lazy mode.
41
+ * @param points points table
42
+ */
43
+ addPoints(points, options, hasPathOptions = false) {
44
+ if (!options.ribbonOptions) {
45
+ throw "addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.";
46
+ }
47
+ if (!hasPathOptions) {
48
+ this._pathsOptions.push({ options, pathCount: points.length });
49
+ }
50
+ super.addPoints(points, options);
51
+ }
52
+ /**
53
+ * "GreasedLineRibbonMesh"
54
+ * @returns "GreasedLineRibbonMesh"
55
+ */
56
+ getClassName() {
57
+ return "GreasedLineRibbonMesh";
58
+ }
59
+ /**
60
+ * Return true if the line was created from two edge paths or one points path.
61
+ * In this case the line is always flat.
62
+ */
63
+ get isFlatLine() {
64
+ return this._paths.length < 3;
65
+ }
66
+ /**
67
+ * Returns the slopes of the line at each point relative to the center of the line
68
+ */
69
+ get slopes() {
70
+ return this._slopes;
71
+ }
72
+ /**
73
+ * Set the slopes of the line at each point relative to the center of the line
74
+ */
75
+ set slopes(slopes) {
76
+ this._slopes = slopes;
77
+ }
78
+ _updateColorPointers() {
79
+ if (this._options.colorPointers) {
80
+ return;
81
+ }
82
+ let colorPointer = 0;
83
+ this._colorPointers = [];
84
+ for (let i = 0; i < this._pathsOptions.length; i++) {
85
+ const { options: pathOptions, pathCount } = this._pathsOptions[i];
86
+ const points = this._points[i];
87
+ if (pathOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {
88
+ for (let k = 0; k < pathCount; k++) {
89
+ for (let j = 0; j < points.length; j += 3) {
90
+ this._colorPointers.push(colorPointer);
91
+ this._colorPointers.push(colorPointer++);
92
+ }
93
+ }
94
+ }
95
+ else {
96
+ for (let j = 0; j < points.length; j += 3) {
97
+ for (let k = 0; k < pathCount; k++) {
98
+ this._colorPointers.push(colorPointer);
99
+ }
100
+ colorPointer++;
101
+ }
102
+ }
103
+ }
104
+ }
105
+ _updateWidths() {
106
+ super._updateWidthsWithValue(1);
107
+ }
108
+ _setPoints(points, _options) {
109
+ var _a, _b;
110
+ if (!this._options.ribbonOptions) {
111
+ throw "No 'GreasedLineMeshOptions.ribbonOptions' provided.";
112
+ }
113
+ this._points = points;
114
+ this._options.points = points;
115
+ this._initGreasedLine();
116
+ let indiceOffset = 0;
117
+ let directionPlanes;
118
+ for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {
119
+ const { options: pathOptions, pathCount } = this._pathsOptions[i];
120
+ const subPoints = points.slice(c, c + pathCount);
121
+ c += pathCount;
122
+ if (((_a = pathOptions.ribbonOptions) === null || _a === void 0 ? void 0 : _a.pointsMode) === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {
123
+ indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints), indiceOffset, pathOptions);
124
+ }
125
+ else {
126
+ if (((_b = pathOptions.ribbonOptions) === null || _b === void 0 ? void 0 : _b.directionsAutoMode) === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {
127
+ if (!pathOptions.ribbonOptions.directions) {
128
+ throw "In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.";
129
+ }
130
+ directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions.directions);
131
+ }
132
+ subPoints.forEach((p, idx) => {
133
+ const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(p, pathOptions.ribbonOptions, this._scene.useRightHandedSystem, directionPlanes ? directionPlanes[idx] : directionPlanes);
134
+ indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);
135
+ });
136
+ }
137
+ }
138
+ if (!this._lazy) {
139
+ this._createVertexBuffers();
140
+ this.refreshBoundingInfo();
141
+ }
142
+ }
143
+ static _GetDirectionPlanesFromDirectionsOption(count, directions) {
144
+ if (Array.isArray(directions)) {
145
+ return directions;
146
+ }
147
+ return new Array(count).fill(directions);
148
+ }
149
+ static _CreateRibbonVertexData(pathArray, options) {
150
+ var _a, _b, _c;
151
+ const numOfPaths = pathArray.length;
152
+ if (numOfPaths < 2) {
153
+ throw "Minimum of two paths are required to create a GreasedLineRibbonMesh.";
154
+ }
155
+ const positions = [];
156
+ const indices = [];
157
+ const path = pathArray[0];
158
+ for (let i = 0; i < path.length; i++) {
159
+ for (let pi = 0; pi < pathArray.length; pi++) {
160
+ const v = pathArray[pi][i];
161
+ positions.push(v.x, v.y, v.z);
162
+ }
163
+ }
164
+ const v = [1, 0, numOfPaths];
165
+ const doubleSided = (_b = ((_a = options.ribbonOptions) === null || _a === void 0 ? void 0 : _a.facesMode) === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED) !== null && _b !== void 0 ? _b : false;
166
+ const closePath = ((_c = options.ribbonOptions) === null || _c === void 0 ? void 0 : _c.pointsMode) === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;
167
+ if (numOfPaths > 2) {
168
+ for (let i = 0; i < path.length - 1; i++) {
169
+ v[0] = 1 + numOfPaths * i;
170
+ v[1] = numOfPaths * i;
171
+ v[2] = (i + 1) * numOfPaths;
172
+ for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {
173
+ if (pi % 2 !== 0) {
174
+ v[2] += 1;
175
+ }
176
+ if (pi % 2 === 0 && pi > 0) {
177
+ v[0] += 1;
178
+ v[1] += 1;
179
+ }
180
+ indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);
181
+ if (doubleSided) {
182
+ indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);
183
+ }
184
+ }
185
+ }
186
+ }
187
+ else {
188
+ for (let i = 0; i < positions.length / 3 - 3; i += 2) {
189
+ indices.push(i, i + 1, i + 2);
190
+ indices.push(i + 2, i + 1, i + 3);
191
+ if (doubleSided) {
192
+ indices.push(i + 1, i, i + 2);
193
+ indices.push(i + 1, i + 2, i + 3);
194
+ }
195
+ }
196
+ }
197
+ if (closePath) {
198
+ let lastIndice = numOfPaths * (path.length - 1);
199
+ for (let pi = 0; pi < numOfPaths - 1; pi++) {
200
+ indices.push(lastIndice, pi + 1, pi);
201
+ indices.push(lastIndice + 1, pi + 1, lastIndice);
202
+ if (doubleSided) {
203
+ indices.push(pi, pi + 1, lastIndice);
204
+ indices.push(lastIndice, pi + 1, lastIndice + 1);
205
+ }
206
+ lastIndice++;
207
+ }
208
+ }
209
+ return {
210
+ positions,
211
+ indices,
212
+ };
213
+ }
214
+ _preprocess(pathArray, indiceOffset, options) {
215
+ var _a, _b, _c, _d;
216
+ this._paths = pathArray;
217
+ const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);
218
+ const positions = ribbonVertexData.positions;
219
+ if (!this._options.widths) {
220
+ throw "No 'GreasedLineMeshOptions.widths' table is specified.";
221
+ }
222
+ for (const p of positions) {
223
+ this._vertexPositions.push(p);
224
+ }
225
+ let pathArrayCopy = pathArray;
226
+ if (((_a = options.ribbonOptions) === null || _a === void 0 ? void 0 : _a.pointsMode) === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {
227
+ pathArrayCopy = [];
228
+ for (let i = 0; i < pathArray.length; i++) {
229
+ const pathCopy = pathArray[i].slice();
230
+ pathCopy.push(pathArray[i][0].clone());
231
+ pathArrayCopy.push(pathCopy);
232
+ }
233
+ }
234
+ this._calculateSegmentLengths(pathArrayCopy);
235
+ const pathArrayLength = pathArrayCopy.length;
236
+ const previousCounters = new Array(pathArrayLength).fill(0);
237
+ for (let i = 0; i < pathArrayCopy[0].length; i++) {
238
+ let v = 0;
239
+ for (let pi = 0; pi < pathArrayLength; pi++) {
240
+ const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];
241
+ this._counters.push(counter);
242
+ this._uvs.push(counter, v);
243
+ previousCounters[pi] = counter;
244
+ v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];
245
+ }
246
+ }
247
+ for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {
248
+ const widthLower = this._uSegmentLengths[i][0] / 2;
249
+ const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;
250
+ this._ribbonWidths.push((((_b = this._widths[c++]) !== null && _b !== void 0 ? _b : 1) - 1) * widthLower);
251
+ for (let pi = 0; pi < pathArrayLength - 2; pi++) {
252
+ this._ribbonWidths.push(0);
253
+ }
254
+ this._ribbonWidths.push((((_c = this._widths[c++]) !== null && _c !== void 0 ? _c : 1) - 1) * widthUpper);
255
+ }
256
+ const slopes = ((_d = options.ribbonOptions) === null || _d === void 0 ? void 0 : _d.pointsMode) === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS
257
+ ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)
258
+ : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);
259
+ for (const s of slopes) {
260
+ this._slopes.push(s);
261
+ }
262
+ if (ribbonVertexData.indices) {
263
+ for (let i = 0; i < ribbonVertexData.indices.length; i++) {
264
+ this._indices.push(ribbonVertexData.indices[i] + indiceOffset);
265
+ }
266
+ }
267
+ indiceOffset += positions.length / 3;
268
+ return indiceOffset;
269
+ }
270
+ static _ConvertToRibbonPath(points, ribbonInfo, rightHandedSystem, directionPlane) {
271
+ if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {
272
+ throw "'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.";
273
+ }
274
+ const path1 = [];
275
+ const path2 = [];
276
+ if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {
277
+ const width = ribbonInfo.width / 2;
278
+ const pointVectors = GreasedLineTools.ToVector3Array(points);
279
+ let direction = null;
280
+ let fatDirection = null;
281
+ if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {
282
+ // set the direction plane from the first line segment for the whole line
283
+ directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);
284
+ }
285
+ for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {
286
+ const p1 = pointVectors[i];
287
+ const p2 = pointVectors[i + 1];
288
+ if (directionPlane) {
289
+ direction = directionPlane;
290
+ }
291
+ else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {
292
+ direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);
293
+ }
294
+ else {
295
+ // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED
296
+ const directionTemp = p2.subtract(p1);
297
+ directionTemp.applyRotationQuaternionInPlace(directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z
298
+ ? rightHandedSystem
299
+ ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion
300
+ : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion
301
+ : GreasedLineRibbonMesh._LeftReadOnlyQuaternion);
302
+ direction = directionTemp.normalize();
303
+ }
304
+ fatDirection = direction.multiplyByFloats(width, width, width);
305
+ path1.push(p1.add(fatDirection));
306
+ path2.push(p1.subtract(fatDirection));
307
+ }
308
+ if (!directionPlane) {
309
+ path1.push(pointVectors[pointVectors.length - 1].add(fatDirection));
310
+ path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection));
311
+ }
312
+ }
313
+ return [path1, path2];
314
+ }
315
+ static _GetDirectionFromPoints(p1, p2, previousDirection) {
316
+ // handle straight lines
317
+ if (p1.x === p2.x && (!previousDirection || (previousDirection === null || previousDirection === void 0 ? void 0 : previousDirection.x) === 1)) {
318
+ return GreasedLineRibbonMesh.DIRECTION_YZ;
319
+ }
320
+ if (p1.y === p2.y) {
321
+ return GreasedLineRibbonMesh.DIRECTION_XZ;
322
+ }
323
+ if (p1.z === p2.z) {
324
+ return GreasedLineRibbonMesh.DIRECTION_XY;
325
+ }
326
+ return GreasedLineRibbonMesh.DIRECTION_XZ;
327
+ }
328
+ /**
329
+ * Clones the GreasedLineRibbonMesh.
330
+ * @param name new line name
331
+ * @param newParent new parent node
332
+ * @returns cloned line
333
+ */
334
+ clone(name = `${this.name}-cloned`, newParent) {
335
+ const lineOptions = this._createLineOptions();
336
+ const deepCopiedLineOptions = {};
337
+ const pathOptionsCloned = [];
338
+ DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned);
339
+ DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, ["instance"]);
340
+ const cloned = new GreasedLineRibbonMesh(name, this._scene, deepCopiedLineOptions, pathOptionsCloned);
341
+ if (newParent) {
342
+ cloned.parent = newParent;
343
+ }
344
+ cloned.material = this.material;
345
+ return cloned;
346
+ }
347
+ /**
348
+ * Serializes this GreasedLineRibbonMesh
349
+ * @param serializationObject object to write serialization to
350
+ */
351
+ serialize(serializationObject) {
352
+ super.serialize(serializationObject);
353
+ serializationObject.type = this.getClassName();
354
+ serializationObject.lineOptions = this._createLineOptions();
355
+ serializationObject.pathsOptions = this._pathsOptions;
356
+ }
357
+ /**
358
+ * Parses a serialized GreasedLineRibbonMesh
359
+ * @param parsedMesh the serialized GreasedLineRibbonMesh
360
+ * @param scene the scene to create the GreasedLineRibbonMesh in
361
+ * @returns the created GreasedLineRibbonMesh
362
+ */
363
+ static Parse(parsedMesh, scene) {
364
+ const lineOptions = parsedMesh.lineOptions;
365
+ const name = parsedMesh.name;
366
+ const pathOptions = parsedMesh.pathOptions;
367
+ const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);
368
+ return result;
369
+ }
370
+ _initGreasedLine() {
371
+ super._initGreasedLine();
372
+ this._paths = [];
373
+ this._counters = [];
374
+ this._slopes = [];
375
+ this._ribbonWidths = [];
376
+ }
377
+ _calculateSegmentLengths(pathArray) {
378
+ const pathArrayLength = pathArray.length;
379
+ this._vSegmentLengths = new Array(pathArrayLength);
380
+ this._vTotalLengths = new Array(pathArrayLength);
381
+ let length = 0;
382
+ for (let pi = 0; pi < pathArrayLength; pi++) {
383
+ const points = pathArray[pi];
384
+ this._vSegmentLengths[pi] = [0]; // first point has 0 distance
385
+ length = 0;
386
+ for (let i = 0; i < points.length - 1; i++) {
387
+ const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here
388
+ length += l;
389
+ this._vSegmentLengths[pi].push(l);
390
+ }
391
+ this._vTotalLengths[pi] = length;
392
+ }
393
+ const positionsLength = pathArray[0].length;
394
+ this._uSegmentLengths = new Array(positionsLength).fill([]);
395
+ this._uTotalLengths = new Array(positionsLength).fill([]);
396
+ const uLength = new Vector3();
397
+ for (let i = 0; i < positionsLength; i++) {
398
+ length = 0;
399
+ for (let pi = 1; pi < pathArrayLength; pi++) {
400
+ pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);
401
+ const l = uLength.length(); // must be length()
402
+ length += l;
403
+ this._uSegmentLengths[i].push(l);
404
+ }
405
+ this._uTotalLengths[i] = length;
406
+ }
407
+ }
408
+ static _CalculateSlopes(paths) {
409
+ const points1 = paths[0];
410
+ const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];
411
+ const slopes = [];
412
+ const slope = new Vector3();
413
+ for (let i = 0; i < points1.length; i++) {
414
+ for (let pi = 0; pi < paths.length; pi++) {
415
+ if (pi === 0 || pi === paths.length - 1) {
416
+ points1[i].subtract(points2[i]).normalizeToRef(slope);
417
+ slopes.push(slope.x, slope.y, slope.z);
418
+ slopes.push(-slope.x, -slope.y, -slope.z);
419
+ }
420
+ else {
421
+ slopes.push(0, 0, 0, 0, 0, 0);
422
+ }
423
+ }
424
+ }
425
+ return slopes;
426
+ }
427
+ _createVertexBuffers() {
428
+ var _a, _b;
429
+ this._uvs = (_a = this._options.uvs) !== null && _a !== void 0 ? _a : this._uvs;
430
+ const vertexData = super._createVertexBuffers((_b = this._options.ribbonOptions) === null || _b === void 0 ? void 0 : _b.smoothShading);
431
+ const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);
432
+ this.setVerticesBuffer(countersBuffer.createVertexBuffer("grl_counters", 0, 1));
433
+ const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);
434
+ this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer("grl_colorPointers", 0, 1));
435
+ const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);
436
+ this.setVerticesBuffer(slopesBuffer.createVertexBuffer("grl_slopes", 0, 3));
437
+ const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);
438
+ this.setVerticesBuffer(widthsBuffer.createVertexBuffer("grl_widths", 0, 1));
439
+ this._widthsBuffer = widthsBuffer;
440
+ return vertexData;
441
+ }
442
+ }
443
+ /**
444
+ * Default line width
445
+ */
446
+ GreasedLineRibbonMesh.DEFAULT_WIDTH = 0.1;
447
+ GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);
448
+ GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);
449
+ GreasedLineRibbonMesh._LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);
450
+ /**
451
+ * Direction which the line segment will be thickened if drawn on the XY plane
452
+ */
453
+ GreasedLineRibbonMesh.DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates
454
+ /**
455
+ * Direction which the line segment will be thickened if drawn on the XZ plane
456
+ */
457
+ GreasedLineRibbonMesh.DIRECTION_XZ = Vector3.UpReadOnly;
458
+ /**
459
+ * Direction which the line segment will be thickened if drawn on the YZ plane
460
+ */
461
+ GreasedLineRibbonMesh.DIRECTION_YZ = Vector3.LeftReadOnly;
462
+ //# sourceMappingURL=greasedLineRibbonMesh.js.map
@@ -0,0 +1 @@
1
+ {"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C,aAAa,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,OAAO,UAAU,CAAC;IACtB,CAAC;;AA3gBD;;GAEG;AACW,mCAAa,GAAG,GAAG,CAAC;AAEnB,2DAAqC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACjH,0DAAoC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/G,6CAAuB,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAEpG;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,2DAA2D;AAC3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions, GreasedLineRibbonOptions } from \"./greasedLineBaseMesh\";\r\nimport { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"./greasedLineBaseMesh\";\r\n\r\nMesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(public readonly name: string, scene: Scene, _options: GreasedLineMeshOptions, _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[];\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions!.directions) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions!.directions);\r\n }\r\n subPoints.forEach((p, idx) => {\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n });\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n for (const p of positions) {\r\n this._vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n this._uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n this._indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = <Vector3>directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"]);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected _createVertexBuffers() {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { NodeGeometryConnectionPoint } from "../../nodeGeometryBlockConnectionPoint";
2
- import { type NodeGeometryBuildState } from "../../nodeGeometryBuildState";
2
+ import type { NodeGeometryBuildState } from "../../nodeGeometryBuildState";
3
3
  import { InstantiateBaseBlock } from "./instantiateBaseBlock";
4
4
  /**
5
5
  * Block used to clone geometry in a radial shape
@@ -1 +1 @@
1
- {"version":3,"file":"instantiateRadialBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateRadialBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,MA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AI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChF;aACJ;YAED,UAAU;YACV,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAChC,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,WAAW,CAAC;QAC5B,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ;AAED,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Quaternion, Vector3 } from \"../../../../Maths/math.vector\";\r\nimport { type NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { InstantiateBaseBlock } from \"./instantiateBaseBlock\";\r\n\r\n/**\r\n * Block used to clone geometry in a radial shape\r\n */\r\nexport class InstantiateRadialBlock extends InstantiateBaseBlock {\r\n /**\r\n * Create a new InstantiateRadialBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n this.registerInput(\"radius\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n\r\n // Angle start and end\r\n this.registerInput(\"angleStart\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"angleEnd\", NodeGeometryBlockConnectionPointTypes.Float, true, Math.PI * 2);\r\n\r\n // Transform offset\r\n this.registerInput(\"transform\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n\r\n // Rotation is magnitude per step\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n\r\n // Scale is magnitude per step\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"InstantiateRadialBlock\";\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get radius(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get angleStart(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get angleEnd(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the transform input component\r\n */\r\n public get transform(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\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[6];\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[7];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n const iterationCount = this.count.getConnectedValue(state) as number;\r\n\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n const rotMatrix = Matrix.Identity();\r\n const radiusMatrix = Matrix.Identity();\r\n const transformMatrix = Matrix.Identity();\r\n const transformOffset = Vector3.Zero();\r\n const rotationOffset = Vector3.Zero();\r\n const scaleOffset = Vector3.Zero();\r\n\r\n for (this._currentIndex = 0; this._currentIndex < iterationCount; this._currentIndex++) {\r\n const instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n // Clone the instance\r\n const clone = instanceGeometry.clone();\r\n\r\n const radius = this.radius.getConnectedValue(state) as number;\r\n const angleStart: number = this.angleStart.getConnectedValue(state) as number;\r\n const angleEnd = this.angleEnd.getConnectedValue(state) as number;\r\n\r\n const transform = this.transform.getConnectedValue(state) as Vector3;\r\n\r\n const rotation = this.rotation.getConnectedValue(state) as Vector3;\r\n\r\n const scale = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n\r\n // Define arc size\r\n const pieSlice = angleEnd - angleStart;\r\n const rStep = pieSlice / iterationCount;\r\n\r\n const angle = angleStart + rStep * this._currentIndex;\r\n const angleQuat = Quaternion.FromEulerAngles(0, angle, 0);\r\n\r\n // Get local transforms\r\n transformOffset.copyFrom(transform.clone().scale(this._currentIndex));\r\n rotationOffset.copyFrom(rotation.clone().scale(this._currentIndex));\r\n scaleOffset.copyFrom(scale.clone().scale(this._currentIndex));\r\n scaleOffset.addInPlaceFromFloats(1, 1, 1);\r\n\r\n // Compose (rotMatrix x radius x scale x angle x user transform)\r\n Matrix.RotationYawPitchRollToRef(rotationOffset.y, rotationOffset.x, rotationOffset.z, rotMatrix);\r\n radiusMatrix.setTranslationFromFloats(0, 0, radius);\r\n Matrix.ComposeToRef(scaleOffset, angleQuat, transformOffset, transformMatrix);\r\n\r\n rotMatrix.multiplyToRef(radiusMatrix, radiusMatrix);\r\n radiusMatrix.multiplyToRef(transformMatrix, transformMatrix);\r\n\r\n state._instantiateWithMatrix(clone, transformMatrix, additionalVertexData);\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n // Storage\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._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\r\nRegisterClass(\"BABYLON.InstantiateRadialBlock\", InstantiateRadialBlock);\r\n"]}
1
+ {"version":3,"file":"instantiateRadialBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateRadialBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,oBAAoB;IAC5D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEpF,sBAAsB;QACtB,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvF,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE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AAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import type { NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { Matrix, Quaternion, Vector3 } from \"../../../../Maths/math.vector\";\r\nimport type { NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport type { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport { InstantiateBaseBlock } from \"./instantiateBaseBlock\";\r\n\r\n/**\r\n * Block used to clone geometry in a radial shape\r\n */\r\nexport class InstantiateRadialBlock extends InstantiateBaseBlock {\r\n /**\r\n * Create a new InstantiateRadialBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n this.registerInput(\"radius\", NodeGeometryBlockConnectionPointTypes.Int, true, 0, 0);\r\n\r\n // Angle start and end\r\n this.registerInput(\"angleStart\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"angleEnd\", NodeGeometryBlockConnectionPointTypes.Float, true, Math.PI * 2);\r\n\r\n // Transform offset\r\n this.registerInput(\"transform\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n\r\n // Rotation is magnitude per step\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n\r\n // Scale is magnitude per step\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"InstantiateRadialBlock\";\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get radius(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get angleStart(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get angleEnd(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the transform input component\r\n */\r\n public get transform(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\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[6];\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[7];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n const iterationCount = this.count.getConnectedValue(state) as number;\r\n\r\n const additionalVertexData: VertexData[] = [];\r\n\r\n const rotMatrix = Matrix.Identity();\r\n const radiusMatrix = Matrix.Identity();\r\n const transformMatrix = Matrix.Identity();\r\n const transformOffset = Vector3.Zero();\r\n const rotationOffset = Vector3.Zero();\r\n const scaleOffset = Vector3.Zero();\r\n\r\n for (this._currentIndex = 0; this._currentIndex < iterationCount; this._currentIndex++) {\r\n const instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n // Clone the instance\r\n const clone = instanceGeometry.clone();\r\n\r\n const radius = this.radius.getConnectedValue(state) as number;\r\n const angleStart: number = this.angleStart.getConnectedValue(state) as number;\r\n const angleEnd = this.angleEnd.getConnectedValue(state) as number;\r\n\r\n const transform = this.transform.getConnectedValue(state) as Vector3;\r\n\r\n const rotation = this.rotation.getConnectedValue(state) as Vector3;\r\n\r\n const scale = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n\r\n // Define arc size\r\n const pieSlice = angleEnd - angleStart;\r\n const rStep = pieSlice / iterationCount;\r\n\r\n const angle = angleStart + rStep * this._currentIndex;\r\n const angleQuat = Quaternion.FromEulerAngles(0, angle, 0);\r\n\r\n // Get local transforms\r\n transformOffset.copyFrom(transform.clone().scale(this._currentIndex));\r\n rotationOffset.copyFrom(rotation.clone().scale(this._currentIndex));\r\n scaleOffset.copyFrom(scale.clone().scale(this._currentIndex));\r\n scaleOffset.addInPlaceFromFloats(1, 1, 1);\r\n\r\n // Compose (rotMatrix x radius x scale x angle x user transform)\r\n Matrix.RotationYawPitchRollToRef(rotationOffset.y, rotationOffset.x, rotationOffset.z, rotMatrix);\r\n radiusMatrix.setTranslationFromFloats(0, 0, radius);\r\n Matrix.ComposeToRef(scaleOffset, angleQuat, transformOffset, transformMatrix);\r\n\r\n rotMatrix.multiplyToRef(radiusMatrix, radiusMatrix);\r\n radiusMatrix.multiplyToRef(transformMatrix, transformMatrix);\r\n\r\n state._instantiateWithMatrix(clone, transformMatrix, additionalVertexData);\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n // Storage\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._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\r\nRegisterClass(\"BABYLON.InstantiateRadialBlock\", InstantiateRadialBlock);\r\n"]}
@@ -12,6 +12,10 @@ export declare class MeshBlock extends NodeGeometryBlock {
12
12
  * Gets or sets a boolean indicating that winding order needs to be reserved
13
13
  */
14
14
  reverseWindingOrder: boolean;
15
+ /**
16
+ * Gets or sets a boolean indicating that this block should serialize its cached data
17
+ */
18
+ serializedCachedData: boolean;
15
19
  /**
16
20
  * Gets or sets the mesh to use to get vertex data
17
21
  */
@@ -35,12 +39,15 @@ export declare class MeshBlock extends NodeGeometryBlock {
35
39
  * Gets the geometry output component
36
40
  */
37
41
  get geometry(): NodeGeometryConnectionPoint;
42
+ /**
43
+ * Remove stored data
44
+ */
45
+ cleanData(): void;
38
46
  protected _buildBlock(): void;
39
47
  /**
40
48
  * Serializes this block in a JSON representation
41
- * @param saveMeshData defines a boolean indicating that mesh data must be saved as well
42
49
  * @returns the serialized block object
43
50
  */
44
- serialize(saveMeshData?: boolean): any;
51
+ serialize(): any;
45
52
  _deserialize(serializationObject: any): void;
46
53
  }