@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
@@ -2,31 +2,50 @@ import { Vector3 } from "../Maths/math.vector";
2
2
  import type { AbstractMesh } from "../Meshes/abstractMesh";
3
3
  import type { IFontData } from "../Meshes/Builders/textBuilder";
4
4
  import type { FloatArray, IndicesArray } from "../types";
5
+ import type { GreasedLinePoints } from "../Meshes/GreasedLine/greasedLineBaseMesh";
6
+ import type { Color3 } from "../Maths/math.color";
7
+ import { RawTexture } from "../Materials/Textures/rawTexture";
8
+ import type { Scene } from "../scene";
5
9
  /**
6
10
  * Tool functions for GreasedLine
7
11
  */
8
12
  export declare class GreasedLineTools {
13
+ /**
14
+ * Converts GreasedLinePoints to number[][]
15
+ * @param points GreasedLinePoints
16
+ * @returns number[][] with x, y, z coordinates of the points, like [[x, y, z, x, y, z, ...], [x, y, z, ...]]
17
+ */
18
+ static ConvertPoints(points: GreasedLinePoints): number[][];
9
19
  /**
10
20
  * Omit zero length lines predicate for the MeshesToLines function
11
21
  * @param p1 point1 position of the face
12
22
  * @param p2 point2 position of the face
13
23
  * @param p3 point3 position of the face
14
- * @returns
24
+ * @returns original points or null if any edge length is zero
15
25
  */
16
- static OmitZeroLengthPredicate(p1: Vector3, p2: Vector3, p3: Vector3): boolean;
26
+ static OmitZeroLengthPredicate(p1: Vector3, p2: Vector3, p3: Vector3): Vector3[][] | null;
27
+ /**
28
+ * Omit duplicate lines predicate for the MeshesToLines function
29
+ * @param p1 point1 position of the face
30
+ * @param p2 point2 position of the face
31
+ * @param p3 point3 position of the face
32
+ * @returns original points or null if any edge length is zero
33
+ */
34
+ static OmitDuplicatesPredicate(p1: Vector3, p2: Vector3, p3: Vector3, points: Vector3[][]): Vector3[][] | null;
35
+ private static _SearchInPoints;
17
36
  /**
18
37
  * Gets mesh triangles as line positions
19
38
  * @param meshes array of meshes
20
39
  * @param predicate predicate function which decides whether to include the mesh triangle/face in the ouput
21
40
  * @returns array of arrays of points
22
41
  */
23
- static MeshesToLines(meshes: AbstractMesh[], predicate?: (p1: Vector3, p2: Vector3, p3: Vector3, indiceIndex: number, vertexIndex: number, mesh: AbstractMesh, meshIndex: number, vertices: FloatArray, indices: IndicesArray) => Vector3[]): Vector3[][];
42
+ static MeshesToLines(meshes: AbstractMesh[], predicate?: (p1: Vector3, p2: Vector3, p3: Vector3, points: Vector3[][], indiceIndex: number, vertexIndex: number, mesh: AbstractMesh, meshIndex: number, vertices: FloatArray, indices: IndicesArray) => Vector3[][]): Vector3[][];
24
43
  /**
25
44
  * Converts number coordinates to Vector3s
26
45
  * @param points number array of x, y, z, x, y z, ... coordinates
27
46
  * @returns Vector3 array
28
47
  */
29
- static ToVector3Array(points: number[]): Vector3[];
48
+ static ToVector3Array(points: number[] | number[][]): Vector3[] | Vector3[][];
30
49
  /**
31
50
  * Gets a number array from a Vector3 array.
32
51
  * You can you for example to convert your Vector3[] offsets to the required number[] for the offsets option.
@@ -79,7 +98,7 @@ export declare class GreasedLineTools {
79
98
  * @param segmentCount number of segments
80
99
  * @returns line point
81
100
  */
82
- static SegmentizeLineBySegmentCount(what: Vector3[], segmentCount: number): Vector3[];
101
+ static SegmentizeLineBySegmentCount(what: Vector3[] | number[], segmentCount: number): Vector3[];
83
102
  /**
84
103
  * Gets line segments.
85
104
  * A segment is a part of the line between it's two points.
@@ -159,4 +178,32 @@ export declare class GreasedLineTools {
159
178
  * @returns number[][] of 3D positions
160
179
  */
161
180
  static GetPointsFromText(text: string, size: number, resolution: number, fontData: IFontData, z?: number, includeInner?: boolean): number[][];
181
+ /**
182
+ * Converts an array of Color3 to Uint8Array
183
+ * @param colors Arrray of Color3
184
+ * @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]
185
+ */
186
+ static Color3toRGBAUint8(colors: Color3[]): Uint8Array;
187
+ /**
188
+ * Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.
189
+ * @param name name of the texture
190
+ * @param colors Uint8Array of colors
191
+ */
192
+ static CreateColorsTexture(name: string, colors: Color3[], colorsSampling: number, scene: Scene): RawTexture;
193
+ /**
194
+ * A minimum size texture for the colors sampler2D when there is no colors texture defined yet.
195
+ * For fast switching using the useColors property without the need to use defines.
196
+ * @param scene Scene
197
+ */
198
+ static PrepareEmptyColorsTexture(scene: Scene): void;
199
+ /**
200
+ * Diposes the shared empty colors texture
201
+ */
202
+ static DisposeEmptyColorsTexture(): void;
203
+ /**
204
+ * Converts boolean to number.
205
+ * @param bool
206
+ * @returns 1 if true, 0 if false.
207
+ */
208
+ static BooleanToNumber(bool?: boolean): 0 | 1;
162
209
  }
@@ -2,19 +2,113 @@ import { Curve3 } from "../Maths/math.path.js";
2
2
  import { VertexBuffer } from "../Buffers/buffer.js";
3
3
  import { TmpVectors, Vector3 } from "../Maths/math.vector.js";
4
4
  import { CreateTextShapePaths } from "../Meshes/Builders/textBuilder.js";
5
+ import { RawTexture } from "../Materials/Textures/rawTexture.js";
6
+ import { Engine } from "../Engines/engine.js";
7
+ import { GreasedLineMaterialDefaults } from "../Materials/GreasedLine/greasedLineMaterialDefaults.js";
5
8
  /**
6
9
  * Tool functions for GreasedLine
7
10
  */
8
11
  export class GreasedLineTools {
12
+ /**
13
+ * Converts GreasedLinePoints to number[][]
14
+ * @param points GreasedLinePoints
15
+ * @returns number[][] with x, y, z coordinates of the points, like [[x, y, z, x, y, z, ...], [x, y, z, ...]]
16
+ */
17
+ static ConvertPoints(points) {
18
+ if (points.length && Array.isArray(points) && typeof points[0] === "number") {
19
+ return [points];
20
+ }
21
+ else if (points.length && Array.isArray(points[0]) && typeof points[0][0] === "number") {
22
+ return points;
23
+ }
24
+ else if (points.length && !Array.isArray(points[0]) && points[0] instanceof Vector3) {
25
+ const positions = [];
26
+ for (let j = 0; j < points.length; j++) {
27
+ const p = points[j];
28
+ positions.push(p.x, p.y, p.z);
29
+ }
30
+ return [positions];
31
+ }
32
+ else if (points.length > 0 && Array.isArray(points[0]) && points[0].length > 0 && points[0][0] instanceof Vector3) {
33
+ const positions = [];
34
+ const vectorPoints = points;
35
+ vectorPoints.forEach((p) => {
36
+ positions.push(p.flatMap((p2) => [p2.x, p2.y, p2.z]));
37
+ });
38
+ return positions;
39
+ }
40
+ else if (points instanceof Float32Array) {
41
+ return [Array.from(points)];
42
+ }
43
+ else if (points.length && points[0] instanceof Float32Array) {
44
+ const positions = [];
45
+ points.forEach((p) => {
46
+ positions.push(Array.from(p));
47
+ });
48
+ return positions;
49
+ }
50
+ return [];
51
+ }
9
52
  /**
10
53
  * Omit zero length lines predicate for the MeshesToLines function
11
54
  * @param p1 point1 position of the face
12
55
  * @param p2 point2 position of the face
13
56
  * @param p3 point3 position of the face
14
- * @returns
57
+ * @returns original points or null if any edge length is zero
15
58
  */
16
59
  static OmitZeroLengthPredicate(p1, p2, p3) {
17
- return p1.lengthSquared() === 0 && p2.lengthSquared() === 0 && p3.lengthSquared() === 0;
60
+ const fileredPoints = [];
61
+ // edge1
62
+ if (p2.subtract(p1).lengthSquared() > 0) {
63
+ fileredPoints.push([p1, p2]);
64
+ }
65
+ // edge2
66
+ if (p3.subtract(p2).lengthSquared() > 0) {
67
+ fileredPoints.push([p2, p3]);
68
+ }
69
+ // edge3
70
+ if (p1.subtract(p3).lengthSquared() > 0) {
71
+ fileredPoints.push([p3, p1]);
72
+ }
73
+ return fileredPoints.length === 0 ? null : fileredPoints;
74
+ }
75
+ /**
76
+ * Omit duplicate lines predicate for the MeshesToLines function
77
+ * @param p1 point1 position of the face
78
+ * @param p2 point2 position of the face
79
+ * @param p3 point3 position of the face
80
+ * @returns original points or null if any edge length is zero
81
+ */
82
+ static OmitDuplicatesPredicate(p1, p2, p3, points) {
83
+ const fileredPoints = [];
84
+ // edge1
85
+ if (!GreasedLineTools._SearchInPoints(p1, p2, points)) {
86
+ fileredPoints.push([p1, p2]);
87
+ }
88
+ // edge2
89
+ if (!GreasedLineTools._SearchInPoints(p2, p3, points)) {
90
+ fileredPoints.push([p2, p3]);
91
+ }
92
+ // edge3
93
+ if (!GreasedLineTools._SearchInPoints(p3, p1, points)) {
94
+ fileredPoints.push([p3, p1]);
95
+ }
96
+ return fileredPoints.length === 0 ? null : fileredPoints;
97
+ }
98
+ static _SearchInPoints(p1, p2, points) {
99
+ var _a, _b, _c;
100
+ for (const ps of points) {
101
+ for (let i = 0; i < ps.length; i++) {
102
+ if ((_a = ps[i]) === null || _a === void 0 ? void 0 : _a.equals(p1)) {
103
+ // find the first point
104
+ // if it has a sibling of p2 the line already exists
105
+ if (((_b = ps[i + 1]) === null || _b === void 0 ? void 0 : _b.equals(p2)) || ((_c = ps[i - 1]) === null || _c === void 0 ? void 0 : _c.equals(p2))) {
106
+ return true;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return false;
18
112
  }
19
113
  /**
20
114
  * Gets mesh triangles as line positions
@@ -36,11 +130,15 @@ export class GreasedLineTools {
36
130
  const p2 = new Vector3(vertices[vi2], vertices[vi2 + 1], vertices[vi2 + 2]);
37
131
  const p3 = new Vector3(vertices[vi3], vertices[vi3 + 1], vertices[vi3 + 2]);
38
132
  if (predicate) {
39
- const pointsFromPredicate = predicate(p1, p2, p3, i, vi1, m, meshIndex, vertices, indices);
40
- pointsFromPredicate && points.push(pointsFromPredicate);
133
+ const pointsFromPredicate = predicate(p1, p2, p3, points, i, vi1, m, meshIndex, vertices, indices);
134
+ if (pointsFromPredicate) {
135
+ for (const p of pointsFromPredicate) {
136
+ points.push(p);
137
+ }
138
+ }
41
139
  }
42
140
  else {
43
- points.push([p1, p2, p3, p1]);
141
+ points.push([p1, p2], [p2, p3], [p3, p1]);
44
142
  }
45
143
  }
46
144
  }
@@ -53,9 +151,22 @@ export class GreasedLineTools {
53
151
  * @returns Vector3 array
54
152
  */
55
153
  static ToVector3Array(points) {
154
+ if (Array.isArray(points[0])) {
155
+ const array = [];
156
+ const inputArray = points;
157
+ for (const subInputArray of inputArray) {
158
+ const subArray = [];
159
+ for (let i = 0; i < subInputArray.length; i += 3) {
160
+ subArray.push(new Vector3(subInputArray[i], subInputArray[i + 1], subInputArray[i + 2]));
161
+ }
162
+ array.push(subArray);
163
+ }
164
+ return array;
165
+ }
166
+ const inputArray = points;
56
167
  const array = [];
57
- for (let i = 0; i < points.length; i += 3) {
58
- array.push(new Vector3(points[i], points[i + 1], points[i + 2]));
168
+ for (let i = 0; i < inputArray.length; i += 3) {
169
+ array.push(new Vector3(inputArray[i], inputArray[i + 1], inputArray[i + 2]));
59
170
  }
60
171
  return array;
61
172
  }
@@ -140,7 +251,11 @@ export class GreasedLineTools {
140
251
  * @returns line point
141
252
  */
142
253
  static SegmentizeLineBySegmentLength(what, segmentLength) {
143
- const subLines = what[0] instanceof Vector3 ? GreasedLineTools.GetLineSegments(what) : what;
254
+ const subLines = what[0] instanceof Vector3
255
+ ? GreasedLineTools.GetLineSegments(what)
256
+ : typeof what[0] === "number"
257
+ ? GreasedLineTools.GetLineSegments(GreasedLineTools.ToVector3Array(what))
258
+ : what;
144
259
  const points = [];
145
260
  subLines.forEach((s) => {
146
261
  if (s.length > segmentLength) {
@@ -164,8 +279,9 @@ export class GreasedLineTools {
164
279
  * @returns line point
165
280
  */
166
281
  static SegmentizeLineBySegmentCount(what, segmentCount) {
167
- const segmentLength = GreasedLineTools.GetLineLength(what) / segmentCount;
168
- return GreasedLineTools.SegmentizeLineBySegmentLength(what, segmentLength);
282
+ const points = (typeof what[0] === "number" ? GreasedLineTools.ToVector3Array(what) : what);
283
+ const segmentLength = GreasedLineTools.GetLineLength(points) / segmentCount;
284
+ return GreasedLineTools.SegmentizeLineBySegmentLength(points, segmentLength);
169
285
  }
170
286
  /**
171
287
  * Gets line segments.
@@ -308,5 +424,59 @@ export class GreasedLineTools {
308
424
  }
309
425
  return allPoints;
310
426
  }
427
+ /**
428
+ * Converts an array of Color3 to Uint8Array
429
+ * @param colors Arrray of Color3
430
+ * @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]
431
+ */
432
+ static Color3toRGBAUint8(colors) {
433
+ const colorTable = new Uint8Array(colors.length * 4);
434
+ for (let i = 0, j = 0; i < colors.length; i++) {
435
+ colorTable[j++] = colors[i].r * 255;
436
+ colorTable[j++] = colors[i].g * 255;
437
+ colorTable[j++] = colors[i].b * 255;
438
+ colorTable[j++] = 255;
439
+ }
440
+ return colorTable;
441
+ }
442
+ /**
443
+ * Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.
444
+ * @param name name of the texture
445
+ * @param colors Uint8Array of colors
446
+ */
447
+ static CreateColorsTexture(name, colors, colorsSampling, scene) {
448
+ const colorsArray = GreasedLineTools.Color3toRGBAUint8(colors);
449
+ const colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, true, colorsSampling);
450
+ colorsTexture.name = name;
451
+ return colorsTexture;
452
+ }
453
+ /**
454
+ * A minimum size texture for the colors sampler2D when there is no colors texture defined yet.
455
+ * For fast switching using the useColors property without the need to use defines.
456
+ * @param scene Scene
457
+ */
458
+ static PrepareEmptyColorsTexture(scene) {
459
+ if (!GreasedLineMaterialDefaults.EmptyColorsTexture) {
460
+ const colorsArray = new Uint8Array(4);
461
+ GreasedLineMaterialDefaults.EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);
462
+ GreasedLineMaterialDefaults.EmptyColorsTexture.name = "grlEmptyColorsTexture";
463
+ }
464
+ }
465
+ /**
466
+ * Diposes the shared empty colors texture
467
+ */
468
+ static DisposeEmptyColorsTexture() {
469
+ var _a;
470
+ (_a = GreasedLineMaterialDefaults.EmptyColorsTexture) === null || _a === void 0 ? void 0 : _a.dispose();
471
+ GreasedLineMaterialDefaults.EmptyColorsTexture = null;
472
+ }
473
+ /**
474
+ * Converts boolean to number.
475
+ * @param bool
476
+ * @returns 1 if true, 0 if false.
477
+ */
478
+ static BooleanToNumber(bool) {
479
+ return bool ? 1 : 0;
480
+ }
311
481
  }
312
482
  //# sour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IAAI,EAAE,CAAC,KAAK,EAAE;gBACtB,MAAM,MAAM,GAAG,EAAE,CAAC;gBAClB,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC/B,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;oBACxB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBAChC;gBACD,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1B;YAED,IAAI,YAAY,EAAE;gBACd,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE;oBACtB,MAAM,KAAK,GAAG,EAAE,CAAC;oBACjB,MAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;oBAC/B,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;wBACxB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;qBAC/B;oBACD,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACzB;aACJ;SACJ;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import { Curve3 } from \"../Maths/math.path\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { IFontData } from \"../Meshes/Builders/textBuilder\";\r\nimport { CreateTextShapePaths } from \"../Meshes/Builders/textBuilder\";\r\nimport type { FloatArray, IndicesArray } from \"../types\";\r\n\r\n/**\r\n * Tool functions for GreasedLine\r\n */\r\nexport class GreasedLineTools {\r\n /**\r\n * Omit zero length lines predicate for the MeshesToLines function\r\n * @param p1 point1 position of the face\r\n * @param p2 point2 position of the face\r\n * @param p3 point3 position of the face\r\n * @returns\r\n */\r\n public static OmitZeroLengthPredicate(p1: Vector3, p2: Vector3, p3: Vector3) {\r\n return p1.lengthSquared() === 0 && p2.lengthSquared() === 0 && p3.lengthSquared() === 0;\r\n }\r\n /**\r\n * Gets mesh triangles as line positions\r\n * @param meshes array of meshes\r\n * @param predicate predicate function which decides whether to include the mesh triangle/face in the ouput\r\n * @returns array of arrays of points\r\n */\r\n public static MeshesToLines(\r\n meshes: AbstractMesh[],\r\n predicate?: (\r\n p1: Vector3,\r\n p2: Vector3,\r\n p3: Vector3,\r\n indiceIndex: number,\r\n vertexIndex: number,\r\n mesh: AbstractMesh,\r\n meshIndex: number,\r\n vertices: FloatArray,\r\n indices: IndicesArray\r\n ) => Vector3[]\r\n ) {\r\n const points: Vector3[][] = [];\r\n\r\n meshes.forEach((m, meshIndex) => {\r\n const vertices = m.getVerticesData(VertexBuffer.PositionKind);\r\n const indices = m.getIndices();\r\n if (vertices && indices) {\r\n for (let i = 0, ii = 0; i < indices.length; i++) {\r\n const vi1 = indices[ii++] * 3;\r\n const vi2 = indices[ii++] * 3;\r\n const vi3 = indices[ii++] * 3;\r\n\r\n const p1 = new Vector3(vertices[vi1], vertices[vi1 + 1], vertices[vi1 + 2]);\r\n const p2 = new Vector3(vertices[vi2], vertices[vi2 + 1], vertices[vi2 + 2]);\r\n const p3 = new Vector3(vertices[vi3], vertices[vi3 + 1], vertices[vi3 + 2]);\r\n\r\n if (predicate) {\r\n const pointsFromPredicate = predicate(p1, p2, p3, i, vi1, m, meshIndex, vertices, indices);\r\n pointsFromPredicate && points.push(pointsFromPredicate);\r\n } else {\r\n points.push([p1, p2, p3, p1]);\r\n }\r\n }\r\n }\r\n });\r\n\r\n return points;\r\n }\r\n\r\n /**\r\n * Converts number coordinates to Vector3s\r\n * @param points number array of x, y, z, x, y z, ... coordinates\r\n * @returns Vector3 array\r\n */\r\n public static ToVector3Array(points: number[]) {\r\n const array: Vector3[] = [];\r\n for (let i = 0; i < points.length; i += 3) {\r\n array.push(new Vector3(points[i], points[i + 1], points[i + 2]));\r\n }\r\n return array;\r\n }\r\n\r\n /**\r\n * Gets a number array from a Vector3 array.\r\n * You can you for example to convert your Vector3[] offsets to the required number[] for the offsets option.\r\n * @param points Vector3 array\r\n * @returns an array of x, y, z coordinates as numbers [x, y, z, x, y, z, x, y, z, ....]\r\n */\r\n public static ToNumberArray(points: Vector3[]) {\r\n return points.flatMap((v) => [v.x, v.y, v.z]);\r\n }\r\n\r\n /**\r\n * Calculates the sum of points of every line and the number of points in each line.\r\n * This function is useful when you are drawing multiple lines in one mesh and you want\r\n * to know the counts. For example for creating an offsets table.\r\n * @param points point array\r\n * @returns points count info\r\n */\r\n public static GetPointsCountInfo(points: number[][]): { total: number; counts: number[] } {\r\n const counts = new Array(points.length);\r\n let total = 0;\r\n for (let n = points.length; n--; ) {\r\n counts[n] = points[n].length / 3;\r\n total += counts[n];\r\n }\r\n return { total, counts };\r\n }\r\n\r\n /**\r\n * Gets the length of the line counting all it's segments length\r\n * @param data array of line points\r\n * @returns length of the line\r\n */\r\n public static GetLineLength(data: Vector3[] | number[]): number {\r\n if (data.length === 0) {\r\n return 0;\r\n }\r\n\r\n let points: Vector3[];\r\n if (typeof data[0] === \"number\") {\r\n points = GreasedLineTools.ToVector3Array(<number[]>data);\r\n } else {\r\n points = <Vector3[]>data;\r\n }\r\n\r\n const tmp = TmpVectors.Vector3[0];\r\n let length = 0;\r\n for (let index = 0; index < points.length - 1; index++) {\r\n const point1 = points[index];\r\n const point2 = points[index + 1];\r\n length += point2.subtractToRef(point1, tmp).length();\r\n }\r\n return length;\r\n }\r\n\r\n /**\r\n * Divides a segment into smaller segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param point1 first point of the line\r\n * @param point2 second point of the line\r\n * @param segmentCount number of segments we want to have in the divided line\r\n * @returns\r\n */\r\n public static SegmentizeSegmentByCount(point1: Vector3, point2: Vector3, segmentCount: number): Vector3[] {\r\n const dividedLinePoints: Vector3[] = [];\r\n const diff = point2.subtract(point1);\r\n const divisor = TmpVectors.Vector3[0];\r\n divisor.setAll(segmentCount);\r\n const segmentVector = TmpVectors.Vector3[1];\r\n diff.divideToRef(divisor, segmentVector);\r\n\r\n let nextPoint = point1.clone();\r\n dividedLinePoints.push(nextPoint);\r\n for (let index = 0; index < segmentCount; index++) {\r\n nextPoint = nextPoint.clone();\r\n dividedLinePoints.push(nextPoint.addInPlace(segmentVector));\r\n }\r\n\r\n return dividedLinePoints;\r\n }\r\n\r\n /**\r\n * Divides a line into segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param what line points\r\n * @param segmentLength length of each segment of the resulting line (distance between two line points)\r\n * @returns line point\r\n */\r\n public static SegmentizeLineBySegmentLength(what: Vector3[] | number[] | { point1: Vector3; point2: Vector3; length: number }[], segmentLength: number): Vector3[] {\r\n const subLines = what[0] instanceof Vector3 ? GreasedLineTools.GetLineSegments(what as Vector3[]) : (what as { point1: Vector3; point2: Vector3; length: number }[]);\r\n const points: Vector3[] = [];\r\n subLines.forEach((s) => {\r\n if (s.length > segmentLength) {\r\n const segments = GreasedLineTools.SegmentizeSegmentByCount(s.point1, s.point2, Math.ceil(s.length / segmentLength));\r\n segments.forEach((seg) => {\r\n points.push(seg);\r\n });\r\n } else {\r\n points.push(s.point1);\r\n points.push(s.point2);\r\n }\r\n });\r\n return points;\r\n }\r\n\r\n /**\r\n * Divides a line into segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param what line points\r\n * @param segmentCount number of segments\r\n * @returns line point\r\n */\r\n public static SegmentizeLineBySegmentCount(what: Vector3[], segmentCount: number): Vector3[] {\r\n const segmentLength = GreasedLineTools.GetLineLength(what) / segmentCount;\r\n return GreasedLineTools.SegmentizeLineBySegmentLength(what, segmentLength);\r\n }\r\n /**\r\n * Gets line segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param points line points\r\n * @returns segments information of the line segment including starting point, ending point and the distance between them\r\n */\r\n public static GetLineSegments(points: Vector3[]): { point1: Vector3; point2: Vector3; length: number }[] {\r\n const segments = [];\r\n for (let index = 0; index < points.length - 1; index++) {\r\n const point1 = points[index];\r\n const point2 = points[index + 1];\r\n const length = point2.subtract(point1).length();\r\n segments.push({ point1, point2, length });\r\n }\r\n\r\n return segments;\r\n }\r\n\r\n /**\r\n * Gets the minimum and the maximum length of a line segment in the line.\r\n * A segment is a part of the line between it's two points.\r\n * @param points line points\r\n * @returns\r\n */\r\n public static GetMinMaxSegmentLength(points: Vector3[]): { min: number; max: number } {\r\n const subLines = GreasedLineTools.GetLineSegments(points);\r\n const sorted = subLines.sort((s) => s.length);\r\n return {\r\n min: sorted[0].length,\r\n max: sorted[sorted.length - 1].length,\r\n };\r\n }\r\n\r\n /**\r\n * Finds the last visible position in world space of the line according to the visibility parameter\r\n * @param lineSegments segments of the line\r\n * @param lineLength total length of the line\r\n * @param visbility normalized value of visibility\r\n * @returns world space coordinate of the last visible piece of the line\r\n */\r\n public static GetPositionOnLineByVisibility(lineSegments: { point1: Vector3; point2: Vector3; length: number }[], lineLength: number, visbility: number, localSpace = false) {\r\n const lengthVisibilityRatio = lineLength * visbility;\r\n let sumSegmentLengths = 0;\r\n let segmentIndex = 0;\r\n\r\n const lineSegmentsLength = lineSegments.length;\r\n for (let i = 0; i < lineSegmentsLength; i++) {\r\n if (lengthVisibilityRatio <= sumSegmentLengths + lineSegments[i].length) {\r\n segmentIndex = i;\r\n break;\r\n }\r\n sumSegmentLengths += lineSegments[i].length;\r\n }\r\n\r\n const s = (lengthVisibilityRatio - sumSegmentLengths) / lineSegments[segmentIndex].length;\r\n\r\n lineSegments[segmentIndex].point2.subtractToRef(lineSegments[segmentIndex].point1, TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[1] = TmpVectors.Vector3[0].multiplyByFloats(s, s, s);\r\n if (!localSpace) {\r\n TmpVectors.Vector3[1].addInPlace(lineSegments[segmentIndex].point1);\r\n }\r\n\r\n return TmpVectors.Vector3[1].clone();\r\n }\r\n\r\n /**\r\n * Creates lines in a shape of circle/arc.\r\n * A segment is a part of the line between it's two points.\r\n * @param radiusX radiusX of the circle\r\n * @param segments number of segments in the circle\r\n * @param z z coordinate of the points. Defaults to 0.\r\n * @param radiusY radiusY of the circle - you can draw an oval if using different values\r\n * @param segmentAngle angle offset of the segments. Defaults to Math.PI * 2 / segments. Change this value to draw a part of the circle.\r\n * @returns line points\r\n */\r\n public static GetCircleLinePoints(radiusX: number, segments: number, z = 0, radiusY = radiusX, segmentAngle = (Math.PI * 2) / segments) {\r\n const points: Vector3[] = [];\r\n for (let i = 0; i <= segments; i++) {\r\n points.push(new Vector3(Math.cos(i * segmentAngle) * radiusX, Math.sin(i * segmentAngle) * radiusY, z));\r\n }\r\n return points;\r\n }\r\n\r\n /**\r\n * Gets line points in a shape of a bezier curve\r\n * @param p0 bezier point0\r\n * @param p1 bezier point1\r\n * @param p2 bezier point2\r\n * @param segments number of segments in the curve\r\n * @returns\r\n */\r\n public static GetBezierLinePoints(p0: Vector3, p1: Vector3, p2: Vector3, segments: number) {\r\n return Curve3.CreateQuadraticBezier(p0, p1, p2, segments)\r\n .getPoints()\r\n .flatMap((v) => [v.x, v.y, v.z]);\r\n }\r\n\r\n /**\r\n *\r\n * @param position position of the arrow cap (mainly you want to create a triangle, set widthUp and widthDown to the same value and omit widthStartUp and widthStartDown)\r\n * @param direction direction which the arrow points to\r\n * @param length length (size) of the arrow cap itself\r\n * @param widthUp the arrow width above the line\r\n * @param widthDown the arrow width belove the line\r\n * @param widthStartUp the arrow width at the start of the arrow above the line. In most scenarios this is 0.\r\n * @param widthStartDown the arrow width at the start of the arrow below the line. In most scenarios this is 0.\r\n * @returns\r\n */\r\n public static GetArrowCap(position: Vector3, direction: Vector3, length: number, widthUp: number, widthDown: number, widthStartUp = 0, widthStartDown = 0) {\r\n const points = [position.clone(), position.add(direction.multiplyByFloats(length, length, length))];\r\n const widths = [widthUp, widthDown, widthStartUp, widthStartDown];\r\n\r\n return {\r\n points,\r\n widths,\r\n };\r\n }\r\n\r\n /**\r\n * Gets 3D positions of points from a text and font\r\n * @param text Text\r\n * @param size Size of the font\r\n * @param resolution Resolution of the font\r\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\r\n * @param z z coordinate\r\n * @param includeInner include the inner parts of the font in the result. Default true. If false, only the outlines will be returned.\r\n * @returns number[][] of 3D positions\r\n */\r\n public static GetPointsFromText(text: string, size: number, resolution: number, fontData: IFontData, z = 0, includeInner = true) {\r\n const allPoints = [];\r\n const shapePaths = CreateTextShapePaths(text, size, resolution, fontData);\r\n\r\n for (const sp of shapePaths) {\r\n for (const p of sp.paths) {\r\n const points = [];\r\n const points2d = p.getPoints();\r\n for (const p2d of points2d) {\r\n points.push(p2d.x, p2d.y, z);\r\n }\r\n allPoints.push(points);\r\n }\r\n\r\n if (includeInner) {\r\n for (const h of sp.holes) {\r\n const holes = [];\r\n const points2d = h.getPoints();\r\n for (const p2d of points2d) {\r\n holes.push(p2d.x, p2d.y, z);\r\n }\r\n allPoints.push(holes);\r\n }\r\n }\r\n }\r\n\r\n return allPoints;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/greasedLineTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAItE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAEnG;;GAEG;AACH,MAAM,OAAO,gBAAgB;IACzB;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,MAAyB;QACjD,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,C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AAI,GAAG,IAAI,CAAC;QAC1B,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,yBAAyB,CAAC,KAAY;QAChD,IAAI,CAAC,2BAA2B,CAAC,kBAAkB,EAAE;YACjD,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;YACtC,2BAA2B,CAAC,kBAAkB,GAAG,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;YAC/J,2BAA2B,CAAC,kBAAkB,CAAC,IAAI,GAAG,uBAAuB,CAAC;SACjF;IACL,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,yBAAyB;;QACnC,MAAA,2BAA2B,CAAC,kBAAkB,0CAAE,OAAO,EAAE,CAAC;QAC1D,2BAA2B,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,IAAc;QACxC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;CACJ","sourcesContent":["import { Curve3 } from \"../Maths/math.path\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { IFontData } from \"../Meshes/Builders/textBuilder\";\r\nimport { CreateTextShapePaths } from \"../Meshes/Builders/textBuilder\";\r\nimport type { FloatArray, IndicesArray } from \"../types\";\r\nimport type { GreasedLinePoints } from \"../Meshes/GreasedLine/greasedLineBaseMesh\";\r\nimport type { Color3 } from \"../Maths/math.color\";\r\nimport { RawTexture } from \"../Materials/Textures/rawTexture\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { GreasedLineMaterialDefaults } from \"../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * Tool functions for GreasedLine\r\n */\r\nexport class GreasedLineTools {\r\n /**\r\n * Converts GreasedLinePoints to number[][]\r\n * @param points GreasedLinePoints\r\n * @returns number[][] with x, y, z coordinates of the points, like [[x, y, z, x, y, z, ...], [x, y, z, ...]]\r\n */\r\n public static ConvertPoints(points: GreasedLinePoints): number[][] {\r\n if (points.length && Array.isArray(points) && typeof points[0] === \"number\") {\r\n return [<number[]>points];\r\n } else if (points.length && Array.isArray(points[0]) && typeof points[0][0] === \"number\") {\r\n return <number[][]>points;\r\n } else if (points.length && !Array.isArray(points[0]) && points[0] instanceof Vector3) {\r\n const positions: number[] = [];\r\n for (let j = 0; j < points.length; j++) {\r\n const p = points[j] as Vector3;\r\n positions.push(p.x, p.y, p.z);\r\n }\r\n return [positions];\r\n } else if (points.length > 0 && Array.isArray(points[0]) && points[0].length > 0 && points[0][0] instanceof Vector3) {\r\n const positions: number[][] = [];\r\n const vectorPoints = points as Vector3[][];\r\n vectorPoints.forEach((p) => {\r\n positions.push(p.flatMap((p2) => [p2.x, p2.y, p2.z]));\r\n });\r\n return positions;\r\n } else if (points instanceof Float32Array) {\r\n return [Array.from(points)];\r\n } else if (points.length && points[0] instanceof Float32Array) {\r\n const positions: number[][] = [];\r\n points.forEach((p) => {\r\n positions.push(Array.from(p as Float32Array));\r\n });\r\n return positions;\r\n }\r\n\r\n return [];\r\n }\r\n\r\n /**\r\n * Omit zero length lines predicate for the MeshesToLines function\r\n * @param p1 point1 position of the face\r\n * @param p2 point2 position of the face\r\n * @param p3 point3 position of the face\r\n * @returns original points or null if any edge length is zero\r\n */\r\n public static OmitZeroLengthPredicate(p1: Vector3, p2: Vector3, p3: Vector3) {\r\n const fileredPoints = [];\r\n // edge1\r\n if (p2.subtract(p1).lengthSquared() > 0) {\r\n fileredPoints.push([p1, p2]);\r\n }\r\n // edge2\r\n if (p3.subtract(p2).lengthSquared() > 0) {\r\n fileredPoints.push([p2, p3]);\r\n }\r\n // edge3\r\n if (p1.subtract(p3).lengthSquared() > 0) {\r\n fileredPoints.push([p3, p1]);\r\n }\r\n return fileredPoints.length === 0 ? null : fileredPoints;\r\n }\r\n\r\n /**\r\n * Omit duplicate lines predicate for the MeshesToLines function\r\n * @param p1 point1 position of the face\r\n * @param p2 point2 position of the face\r\n * @param p3 point3 position of the face\r\n * @returns original points or null if any edge length is zero\r\n */\r\n public static OmitDuplicatesPredicate(p1: Vector3, p2: Vector3, p3: Vector3, points: Vector3[][]) {\r\n const fileredPoints = [];\r\n // edge1\r\n if (!GreasedLineTools._SearchInPoints(p1, p2, points)) {\r\n fileredPoints.push([p1, p2]);\r\n }\r\n // edge2\r\n if (!GreasedLineTools._SearchInPoints(p2, p3, points)) {\r\n fileredPoints.push([p2, p3]);\r\n }\r\n // edge3\r\n if (!GreasedLineTools._SearchInPoints(p3, p1, points)) {\r\n fileredPoints.push([p3, p1]);\r\n }\r\n return fileredPoints.length === 0 ? null : fileredPoints;\r\n }\r\n\r\n private static _SearchInPoints(p1: Vector3, p2: Vector3, points: Vector3[][]) {\r\n for (const ps of points) {\r\n for (let i = 0; i < ps.length; i++) {\r\n if (ps[i]?.equals(p1)) {\r\n // find the first point\r\n // if it has a sibling of p2 the line already exists\r\n if (ps[i + 1]?.equals(p2) || ps[i - 1]?.equals(p2)) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets mesh triangles as line positions\r\n * @param meshes array of meshes\r\n * @param predicate predicate function which decides whether to include the mesh triangle/face in the ouput\r\n * @returns array of arrays of points\r\n */\r\n public static MeshesToLines(\r\n meshes: AbstractMesh[],\r\n predicate?: (\r\n p1: Vector3,\r\n p2: Vector3,\r\n p3: Vector3,\r\n points: Vector3[][],\r\n indiceIndex: number,\r\n vertexIndex: number,\r\n mesh: AbstractMesh,\r\n meshIndex: number,\r\n vertices: FloatArray,\r\n indices: IndicesArray\r\n ) => Vector3[][]\r\n ) {\r\n const points: Vector3[][] = [];\r\n\r\n meshes.forEach((m, meshIndex) => {\r\n const vertices = m.getVerticesData(VertexBuffer.PositionKind);\r\n const indices = m.getIndices();\r\n if (vertices && indices) {\r\n for (let i = 0, ii = 0; i < indices.length; i++) {\r\n const vi1 = indices[ii++] * 3;\r\n const vi2 = indices[ii++] * 3;\r\n const vi3 = indices[ii++] * 3;\r\n\r\n const p1 = new Vector3(vertices[vi1], vertices[vi1 + 1], vertices[vi1 + 2]);\r\n const p2 = new Vector3(vertices[vi2], vertices[vi2 + 1], vertices[vi2 + 2]);\r\n const p3 = new Vector3(vertices[vi3], vertices[vi3 + 1], vertices[vi3 + 2]);\r\n\r\n if (predicate) {\r\n const pointsFromPredicate = predicate(p1, p2, p3, points, i, vi1, m, meshIndex, vertices, indices);\r\n if (pointsFromPredicate) {\r\n for (const p of pointsFromPredicate) {\r\n points.push(p);\r\n }\r\n }\r\n } else {\r\n points.push([p1, p2], [p2, p3], [p3, p1]);\r\n }\r\n }\r\n }\r\n });\r\n\r\n return points;\r\n }\r\n\r\n /**\r\n * Converts number coordinates to Vector3s\r\n * @param points number array of x, y, z, x, y z, ... coordinates\r\n * @returns Vector3 array\r\n */\r\n public static ToVector3Array(points: number[] | number[][]) {\r\n if (Array.isArray(points[0])) {\r\n const array: Vector3[][] = [];\r\n const inputArray = points as number[][];\r\n for (const subInputArray of inputArray) {\r\n const subArray: Vector3[] = [];\r\n for (let i = 0; i < subInputArray.length; i += 3) {\r\n subArray.push(new Vector3(subInputArray[i], subInputArray[i + 1], subInputArray[i + 2]));\r\n }\r\n array.push(subArray);\r\n }\r\n return array;\r\n }\r\n\r\n const inputArray = points as number[];\r\n const array: Vector3[] = [];\r\n for (let i = 0; i < inputArray.length; i += 3) {\r\n array.push(new Vector3(inputArray[i], inputArray[i + 1], inputArray[i + 2]));\r\n }\r\n return array;\r\n }\r\n\r\n /**\r\n * Gets a number array from a Vector3 array.\r\n * You can you for example to convert your Vector3[] offsets to the required number[] for the offsets option.\r\n * @param points Vector3 array\r\n * @returns an array of x, y, z coordinates as numbers [x, y, z, x, y, z, x, y, z, ....]\r\n */\r\n public static ToNumberArray(points: Vector3[]) {\r\n return points.flatMap((v) => [v.x, v.y, v.z]);\r\n }\r\n\r\n /**\r\n * Calculates the sum of points of every line and the number of points in each line.\r\n * This function is useful when you are drawing multiple lines in one mesh and you want\r\n * to know the counts. For example for creating an offsets table.\r\n * @param points point array\r\n * @returns points count info\r\n */\r\n public static GetPointsCountInfo(points: number[][]): { total: number; counts: number[] } {\r\n const counts = new Array(points.length);\r\n let total = 0;\r\n for (let n = points.length; n--; ) {\r\n counts[n] = points[n].length / 3;\r\n total += counts[n];\r\n }\r\n return { total, counts };\r\n }\r\n\r\n /**\r\n * Gets the length of the line counting all it's segments length\r\n * @param data array of line points\r\n * @returns length of the line\r\n */\r\n public static GetLineLength(data: Vector3[] | number[]): number {\r\n if (data.length === 0) {\r\n return 0;\r\n }\r\n\r\n let points: Vector3[];\r\n if (typeof data[0] === \"number\") {\r\n points = GreasedLineTools.ToVector3Array(<number[]>data) as Vector3[];\r\n } else {\r\n points = data as Vector3[];\r\n }\r\n\r\n const tmp = TmpVectors.Vector3[0];\r\n let length = 0;\r\n for (let index = 0; index < points.length - 1; index++) {\r\n const point1 = points[index];\r\n const point2 = points[index + 1];\r\n length += point2.subtractToRef(point1, tmp).length();\r\n }\r\n return length;\r\n }\r\n\r\n /**\r\n * Divides a segment into smaller segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param point1 first point of the line\r\n * @param point2 second point of the line\r\n * @param segmentCount number of segments we want to have in the divided line\r\n * @returns\r\n */\r\n public static SegmentizeSegmentByCount(point1: Vector3, point2: Vector3, segmentCount: number): Vector3[] {\r\n const dividedLinePoints: Vector3[] = [];\r\n const diff = point2.subtract(point1);\r\n const divisor = TmpVectors.Vector3[0];\r\n divisor.setAll(segmentCount);\r\n const segmentVector = TmpVectors.Vector3[1];\r\n diff.divideToRef(divisor, segmentVector);\r\n\r\n let nextPoint = point1.clone();\r\n dividedLinePoints.push(nextPoint);\r\n for (let index = 0; index < segmentCount; index++) {\r\n nextPoint = nextPoint.clone();\r\n dividedLinePoints.push(nextPoint.addInPlace(segmentVector));\r\n }\r\n\r\n return dividedLinePoints;\r\n }\r\n\r\n /**\r\n * Divides a line into segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param what line points\r\n * @param segmentLength length of each segment of the resulting line (distance between two line points)\r\n * @returns line point\r\n */\r\n public static SegmentizeLineBySegmentLength(what: Vector3[] | number[] | { point1: Vector3; point2: Vector3; length: number }[], segmentLength: number): Vector3[] {\r\n const subLines =\r\n what[0] instanceof Vector3\r\n ? GreasedLineTools.GetLineSegments(what as Vector3[])\r\n : typeof what[0] === \"number\"\r\n ? GreasedLineTools.GetLineSegments(GreasedLineTools.ToVector3Array(what as number[]) as Vector3[])\r\n : (what as { point1: Vector3; point2: Vector3; length: number }[]);\r\n const points: Vector3[] = [];\r\n subLines.forEach((s) => {\r\n if (s.length > segmentLength) {\r\n const segments = GreasedLineTools.SegmentizeSegmentByCount(s.point1, s.point2, Math.ceil(s.length / segmentLength));\r\n segments.forEach((seg) => {\r\n points.push(seg);\r\n });\r\n } else {\r\n points.push(s.point1);\r\n points.push(s.point2);\r\n }\r\n });\r\n return points;\r\n }\r\n\r\n /**\r\n * Divides a line into segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param what line points\r\n * @param segmentCount number of segments\r\n * @returns line point\r\n */\r\n public static SegmentizeLineBySegmentCount(what: Vector3[] | number[], segmentCount: number): Vector3[] {\r\n const points = <Vector3[]>(typeof what[0] === \"number\" ? GreasedLineTools.ToVector3Array(<number[]>what) : what);\r\n const segmentLength = GreasedLineTools.GetLineLength(points) / segmentCount;\r\n return GreasedLineTools.SegmentizeLineBySegmentLength(points, segmentLength);\r\n }\r\n /**\r\n * Gets line segments.\r\n * A segment is a part of the line between it's two points.\r\n * @param points line points\r\n * @returns segments information of the line segment including starting point, ending point and the distance between them\r\n */\r\n public static GetLineSegments(points: Vector3[]): { point1: Vector3; point2: Vector3; length: number }[] {\r\n const segments = [];\r\n for (let index = 0; index < points.length - 1; index++) {\r\n const point1 = points[index];\r\n const point2 = points[index + 1];\r\n const length = point2.subtract(point1).length();\r\n segments.push({ point1, point2, length });\r\n }\r\n\r\n return segments;\r\n }\r\n\r\n /**\r\n * Gets the minimum and the maximum length of a line segment in the line.\r\n * A segment is a part of the line between it's two points.\r\n * @param points line points\r\n * @returns\r\n */\r\n public static GetMinMaxSegmentLength(points: Vector3[]): { min: number; max: number } {\r\n const subLines = GreasedLineTools.GetLineSegments(points);\r\n const sorted = subLines.sort((s) => s.length);\r\n return {\r\n min: sorted[0].length,\r\n max: sorted[sorted.length - 1].length,\r\n };\r\n }\r\n\r\n /**\r\n * Finds the last visible position in world space of the line according to the visibility parameter\r\n * @param lineSegments segments of the line\r\n * @param lineLength total length of the line\r\n * @param visbility normalized value of visibility\r\n * @returns world space coordinate of the last visible piece of the line\r\n */\r\n public static GetPositionOnLineByVisibility(lineSegments: { point1: Vector3; point2: Vector3; length: number }[], lineLength: number, visbility: number, localSpace = false) {\r\n const lengthVisibilityRatio = lineLength * visbility;\r\n let sumSegmentLengths = 0;\r\n let segmentIndex = 0;\r\n\r\n const lineSegmentsLength = lineSegments.length;\r\n for (let i = 0; i < lineSegmentsLength; i++) {\r\n if (lengthVisibilityRatio <= sumSegmentLengths + lineSegments[i].length) {\r\n segmentIndex = i;\r\n break;\r\n }\r\n sumSegmentLengths += lineSegments[i].length;\r\n }\r\n\r\n const s = (lengthVisibilityRatio - sumSegmentLengths) / lineSegments[segmentIndex].length;\r\n\r\n lineSegments[segmentIndex].point2.subtractToRef(lineSegments[segmentIndex].point1, TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[1] = TmpVectors.Vector3[0].multiplyByFloats(s, s, s);\r\n if (!localSpace) {\r\n TmpVectors.Vector3[1].addInPlace(lineSegments[segmentIndex].point1);\r\n }\r\n\r\n return TmpVectors.Vector3[1].clone();\r\n }\r\n\r\n /**\r\n * Creates lines in a shape of circle/arc.\r\n * A segment is a part of the line between it's two points.\r\n * @param radiusX radiusX of the circle\r\n * @param segments number of segments in the circle\r\n * @param z z coordinate of the points. Defaults to 0.\r\n * @param radiusY radiusY of the circle - you can draw an oval if using different values\r\n * @param segmentAngle angle offset of the segments. Defaults to Math.PI * 2 / segments. Change this value to draw a part of the circle.\r\n * @returns line points\r\n */\r\n public static GetCircleLinePoints(radiusX: number, segments: number, z = 0, radiusY = radiusX, segmentAngle = (Math.PI * 2) / segments) {\r\n const points: Vector3[] = [];\r\n for (let i = 0; i <= segments; i++) {\r\n points.push(new Vector3(Math.cos(i * segmentAngle) * radiusX, Math.sin(i * segmentAngle) * radiusY, z));\r\n }\r\n return points;\r\n }\r\n\r\n /**\r\n * Gets line points in a shape of a bezier curve\r\n * @param p0 bezier point0\r\n * @param p1 bezier point1\r\n * @param p2 bezier point2\r\n * @param segments number of segments in the curve\r\n * @returns\r\n */\r\n public static GetBezierLinePoints(p0: Vector3, p1: Vector3, p2: Vector3, segments: number) {\r\n return Curve3.CreateQuadraticBezier(p0, p1, p2, segments)\r\n .getPoints()\r\n .flatMap((v) => [v.x, v.y, v.z]);\r\n }\r\n\r\n /**\r\n *\r\n * @param position position of the arrow cap (mainly you want to create a triangle, set widthUp and widthDown to the same value and omit widthStartUp and widthStartDown)\r\n * @param direction direction which the arrow points to\r\n * @param length length (size) of the arrow cap itself\r\n * @param widthUp the arrow width above the line\r\n * @param widthDown the arrow width belove the line\r\n * @param widthStartUp the arrow width at the start of the arrow above the line. In most scenarios this is 0.\r\n * @param widthStartDown the arrow width at the start of the arrow below the line. In most scenarios this is 0.\r\n * @returns\r\n */\r\n public static GetArrowCap(position: Vector3, direction: Vector3, length: number, widthUp: number, widthDown: number, widthStartUp = 0, widthStartDown = 0) {\r\n const points = [position.clone(), position.add(direction.multiplyByFloats(length, length, length))];\r\n const widths = [widthUp, widthDown, widthStartUp, widthStartDown];\r\n\r\n return {\r\n points,\r\n widths,\r\n };\r\n }\r\n\r\n /**\r\n * Gets 3D positions of points from a text and font\r\n * @param text Text\r\n * @param size Size of the font\r\n * @param resolution Resolution of the font\r\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\r\n * @param z z coordinate\r\n * @param includeInner include the inner parts of the font in the result. Default true. If false, only the outlines will be returned.\r\n * @returns number[][] of 3D positions\r\n */\r\n public static GetPointsFromText(text: string, size: number, resolution: number, fontData: IFontData, z = 0, includeInner = true) {\r\n const allPoints = [];\r\n const shapePaths = CreateTextShapePaths(text, size, resolution, fontData);\r\n\r\n for (const sp of shapePaths) {\r\n for (const p of sp.paths) {\r\n const points = [];\r\n const points2d = p.getPoints();\r\n for (const p2d of points2d) {\r\n points.push(p2d.x, p2d.y, z);\r\n }\r\n allPoints.push(points);\r\n }\r\n\r\n if (includeInner) {\r\n for (const h of sp.holes) {\r\n const holes = [];\r\n const points2d = h.getPoints();\r\n for (const p2d of points2d) {\r\n holes.push(p2d.x, p2d.y, z);\r\n }\r\n allPoints.push(holes);\r\n }\r\n }\r\n }\r\n\r\n return allPoints;\r\n }\r\n\r\n /**\r\n * Converts an array of Color3 to Uint8Array\r\n * @param colors Arrray of Color3\r\n * @returns Uin8Array of colors [r, g, b, a, r, g, b, a, ...]\r\n */\r\n public static Color3toRGBAUint8(colors: Color3[]) {\r\n const colorTable: Uint8Array = new Uint8Array(colors.length * 4);\r\n for (let i = 0, j = 0; i < colors.length; i++) {\r\n colorTable[j++] = colors[i].r * 255;\r\n colorTable[j++] = colors[i].g * 255;\r\n colorTable[j++] = colors[i].b * 255;\r\n colorTable[j++] = 255;\r\n }\r\n\r\n return colorTable;\r\n }\r\n\r\n /**\r\n * Creates a RawTexture from an RGBA color array and sets it on the plugin material instance.\r\n * @param name name of the texture\r\n * @param colors Uint8Array of colors\r\n */\r\n public static CreateColorsTexture(name: string, colors: Color3[], colorsSampling: number, scene: Scene) {\r\n const colorsArray = GreasedLineTools.Color3toRGBAUint8(colors);\r\n const colorsTexture = new RawTexture(colorsArray, colors.length, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, true, colorsSampling);\r\n colorsTexture.name = name;\r\n return colorsTexture;\r\n }\r\n\r\n /**\r\n * A minimum size texture for the colors sampler2D when there is no colors texture defined yet.\r\n * For fast switching using the useColors property without the need to use defines.\r\n * @param scene Scene\r\n */\r\n public static PrepareEmptyColorsTexture(scene: Scene) {\r\n if (!GreasedLineMaterialDefaults.EmptyColorsTexture) {\r\n const colorsArray = new Uint8Array(4);\r\n GreasedLineMaterialDefaults.EmptyColorsTexture = new RawTexture(colorsArray, 1, 1, Engine.TEXTUREFORMAT_RGBA, scene, false, false, RawTexture.NEAREST_NEAREST);\r\n GreasedLineMaterialDefaults.EmptyColorsTexture.name = \"grlEmptyColorsTexture\";\r\n }\r\n }\r\n\r\n /**\r\n * Diposes the shared empty colors texture\r\n */\r\n public static DisposeEmptyColorsTexture() {\r\n GreasedLineMaterialDefaults.EmptyColorsTexture?.dispose();\r\n GreasedLineMaterialDefaults.EmptyColorsTexture = null;\r\n }\r\n\r\n /**\r\n * Converts boolean to number.\r\n * @param bool\r\n * @returns 1 if true, 0 if false.\r\n */\r\n public static BooleanToNumber(bool?: boolean) {\r\n return bool ? 1 : 0;\r\n }\r\n}\r\n"]}
@@ -2,35 +2,32 @@
2
2
  import { AutoReleaseWorkerPool } from "./workerPool.js";
3
3
  import { Tools } from "./tools.js";
4
4
  import { EngineFormat, TranscodeTarget } from "../Materials/Textures/ktx2decoderTypes.js";
5
- function getAbsoluteUrlOrNull(url) {
6
- return url ? Tools.GetAbsoluteUrl(url) : null;
7
- }
8
5
  function applyConfig(urls) {
9
- if (urls.wasmUASTCToASTC !== null) {
6
+ if (urls.wasmUASTCToASTC) {
10
7
  KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL = urls.wasmUASTCToASTC;
11
8
  }
12
- if (urls.wasmUASTCToBC7 !== null) {
9
+ if (urls.wasmUASTCToBC7) {
13
10
  KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL = urls.wasmUASTCToBC7;
14
11
  }
15
- if (urls.wasmUASTCToRGBA_UNORM !== null) {
12
+ if (urls.wasmUASTCToRGBA_UNORM) {
16
13
  KTX2DECODER.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL = urls.wasmUASTCToRGBA_UNORM;
17
14
  }
18
- if (urls.wasmUASTCToRGBA_SRGB !== null) {
15
+ if (urls.wasmUASTCToRGBA_SRGB) {
19
16
  KTX2DECODER.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL = urls.wasmUASTCToRGBA_SRGB;
20
17
  }
21
- if (urls.wasmUASTCToR8_UNORM !== null) {
18
+ if (urls.wasmUASTCToR8_UNORM) {
22
19
  KTX2DECODER.LiteTranscoder_UASTC_R8_UNORM.WasmModuleURL = urls.wasmUASTCToR8_UNORM;
23
20
  }
24
- if (urls.wasmUASTCToRG8_UNORM !== null) {
21
+ if (urls.wasmUASTCToRG8_UNORM) {
25
22
  KTX2DECODER.LiteTranscoder_UASTC_RG8_UNORM.WasmModuleURL = urls.wasmUASTCToRG8_UNORM;
26
23
  }
27
- if (urls.jsMSCTranscoder !== null) {
24
+ if (urls.jsMSCTranscoder) {
28
25
  KTX2DECODER.MSCTranscoder.JSModuleURL = urls.jsMSCTranscoder;
29
26
  }
30
- if (urls.wasmMSCTranscoder !== null) {
27
+ if (urls.wasmMSCTranscoder) {
31
28
  KTX2DECODER.MSCTranscoder.WasmModuleURL = urls.wasmMSCTranscoder;
32
29
  }
33
- if (urls.wasmZSTDDecoder !== null) {
30
+ if (urls.wasmZSTDDecoder) {
34
31
  KTX2DECODER.ZSTDDecoder.WasmModuleURL = urls.wasmZSTDDecoder;
35
32
  }
36
33
  }
@@ -183,16 +180,16 @@ export class KhronosTextureContainer2 {
183
180
  return;
184
181
  }
185
182
  const urls = {
186
- jsDecoderModule: Tools.GetAbsoluteUrl(this.URLConfig.jsDecoderModule),
187
- wasmUASTCToASTC: getAbsoluteUrlOrNull(this.URLConfig.wasmUASTCToASTC),
188
- wasmUASTCToBC7: getAbsoluteUrlOrNull(this.URLConfig.wasmUASTCToBC7),
189
- wasmUASTCToRGBA_UNORM: getAbsoluteUrlOrNull(this.URLConfig.wasmUASTCToRGBA_UNORM),
190
- wasmUASTCToRGBA_SRGB: getAbsoluteUrlOrNull(this.URLConfig.wasmUASTCToRGBA_SRGB),
191
- wasmUASTCToR8_UNORM: getAbsoluteUrlOrNull(this.URLConfig.wasmUASTCToR8_UNORM),
192
- wasmUASTCToRG8_UNORM: getAbsoluteUrlOrNull(this.URLConfig.wasmUASTCToRG8_UNORM),
193
- jsMSCTranscoder: getAbsoluteUrlOrNull(this.URLConfig.jsMSCTranscoder),
194
- wasmMSCTranscoder: getAbsoluteUrlOrNull(this.URLConfig.wasmMSCTranscoder),
195
- wasmZSTDDecoder: getAbsoluteUrlOrNull(this.URLConfig.wasmZSTDDecoder),
183
+ jsDecoderModule: Tools.GetBabylonScriptURL(this.URLConfig.jsDecoderModule, true),
184
+ wasmUASTCToASTC: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToASTC, true),
185
+ wasmUASTCToBC7: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToBC7, true),
186
+ wasmUASTCToRGBA_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_UNORM, true),
187
+ wasmUASTCToRGBA_SRGB: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_SRGB, true),
188
+ wasmUASTCToR8_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToR8_UNORM, true),
189
+ wasmUASTCToRG8_UNORM: Tools.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRG8_UNORM, true),
190
+ jsMSCTranscoder: Tools.GetBabylonScriptURL(this.URLConfig.jsMSCTranscoder, true),
191
+ wasmMSCTranscoder: Tools.GetBabylonScriptURL(this.URLConfig.wasmMSCTranscoder, true),
192
+ wasmZSTDDecoder: Tools.GetBabylonScriptURL(this.URLConfig.wasmZSTDDecoder, true),
196
193
  };
197
194
  if (numWorkers && typeof Worker === "function" && typeof URL !== "undefined") {
198
195
  KhronosTextureContainer2._WorkerPoolPromise = new Promise((resolve) => {
@@ -222,7 +219,7 @@ export class KhronosTextureContainer2 {
222
219
  });
223
220
  }
224
221
  else if (typeof KTX2DECODER === "undefined") {
225
- KhronosTextureContainer2._DecoderModulePromise = Tools.LoadScriptAsync(urls.jsDecoderModule).then(() => {
222
+ KhronosTextureContainer2._DecoderModulePromise = Tools.LoadBabylonScriptAsync(urls.jsDecoderModule).then(() => {
226
223
  KTX2DECODER.MSCTranscoder.UseFromWorkerThread = false;
227
224
  KTX2DECODER.WASMMemoryManager.LoadBinariesFromCurrentThread = true;
228
225
  applyConfig(urls);
@@ -416,7 +413,7 @@ export class KhronosTextureContainer2 {
416
413
  * You can see their default values in this PG: https://playground.babylonjs.com/#EIJH8L#29
417
414
  */
418
415
  KhronosTextureContainer2.URLConfig = {
419
- jsDecoderModule: "https://preview.babylonjs.com/babylon.ktx2Decoder.js",
416
+ jsDecoderModule: "babylon.ktx2Decoder.js",
420
417
  wasmUASTCToASTC: null,
421
418
  wasmUASTCToBC7: null,
422
419
  wasmUASTCToRGBA_UNORM: null,