@babylonjs/core 6.41.0 → 6.41.2

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 (650) hide show
  1. package/Animations/animatable.js +1 -2
  2. package/Animations/animatable.js.map +1 -1
  3. package/Animations/animation.js +4 -6
  4. package/Animations/animation.js.map +1 -1
  5. package/Animations/animationGroup.js +3 -3
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/Animations/runtimeAnimation.js +1 -1
  8. package/Animations/runtimeAnimation.js.map +1 -1
  9. package/Audio/audioEngine.js +3 -5
  10. package/Audio/audioEngine.js.map +1 -1
  11. package/Audio/audioSceneComponent.js +1 -2
  12. package/Audio/audioSceneComponent.js.map +1 -1
  13. package/Audio/sound.js +48 -74
  14. package/Audio/sound.js.map +1 -1
  15. package/Audio/soundTrack.js +6 -12
  16. package/Audio/soundTrack.js.map +1 -1
  17. package/BakedVertexAnimation/bakedVertexAnimationManager.js +1 -2
  18. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  19. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  20. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  21. package/Behaviors/Meshes/fadeInOutBehavior.js +2 -4
  22. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  23. package/Behaviors/Meshes/followBehavior.js +1 -2
  24. package/Behaviors/Meshes/followBehavior.js.map +1 -1
  25. package/Behaviors/Meshes/handConstraintBehavior.js +2 -2
  26. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  27. package/Bones/bone.js +4 -6
  28. package/Bones/bone.js.map +1 -1
  29. package/Bones/skeleton.js +2 -3
  30. package/Bones/skeleton.js.map +1 -1
  31. package/Buffers/buffer.align.js +5 -8
  32. package/Buffers/buffer.align.js.map +1 -1
  33. package/Buffers/buffer.js +6 -8
  34. package/Buffers/buffer.js.map +1 -1
  35. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -4
  36. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  37. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +3 -5
  38. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  39. package/Cameras/Inputs/flyCameraMouseInput.js +2 -2
  40. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  41. package/Cameras/Inputs/freeCameraMouseInput.js +2 -2
  42. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  43. package/Cameras/arcRotateCamera.js +1 -2
  44. package/Cameras/arcRotateCamera.js.map +1 -1
  45. package/Cameras/camera.d.ts +5 -0
  46. package/Cameras/camera.js +18 -11
  47. package/Cameras/camera.js.map +1 -1
  48. package/Collisions/pickingInfo.js +1 -1
  49. package/Collisions/pickingInfo.js.map +1 -1
  50. package/Compute/computeEffect.js +5 -8
  51. package/Compute/computeEffect.js.map +1 -1
  52. package/Compute/computeShader.js +12 -9
  53. package/Compute/computeShader.js.map +1 -1
  54. package/Culling/Octrees/octreeSceneComponent.js +1 -2
  55. package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
  56. package/Culling/boundingBox.js +2 -3
  57. package/Culling/boundingBox.js.map +1 -1
  58. package/Culling/ray.d.ts +6 -1
  59. package/Culling/ray.js +9 -4
  60. package/Culling/ray.js.map +1 -1
  61. package/Debug/debugLayer.js +4 -1
  62. package/Debug/debugLayer.js.map +1 -1
  63. package/Debug/directionalLightFrustumViewer.js +7 -9
  64. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  65. package/Debug/physicsViewer.js +5 -7
  66. package/Debug/physicsViewer.js.map +1 -1
  67. package/Debug/rayHelper.js +1 -2
  68. package/Debug/rayHelper.js.map +1 -1
  69. package/Debug/skeletonViewer.js +26 -31
  70. package/Debug/skeletonViewer.js.map +1 -1
  71. package/Decorators/nodeDecorator.js +1 -1
  72. package/Decorators/nodeDecorator.js.map +1 -1
  73. package/DeviceInput/InputDevices/deviceSourceManager.js +3 -5
  74. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  75. package/DeviceInput/eventFactory.js +1 -1
  76. package/DeviceInput/eventFactory.js.map +1 -1
  77. package/DeviceInput/internalDeviceSourceManager.js +1 -2
  78. package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
  79. package/DeviceInput/webDeviceInputSystem.js +9 -12
  80. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  81. package/Engines/Extensions/engine.cubeTexture.js +6 -1
  82. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  83. package/Engines/Extensions/engine.multiRender.js +3 -4
  84. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  85. package/Engines/Extensions/engine.rawTexture.js +4 -4
  86. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  87. package/Engines/Extensions/engine.readTexture.js +2 -3
  88. package/Engines/Extensions/engine.readTexture.js.map +1 -1
  89. package/Engines/Extensions/engine.renderTarget.js +9 -5
  90. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  91. package/Engines/Extensions/engine.renderTargetCube.js +9 -1
  92. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  93. package/Engines/Extensions/engine.views.js +1 -2
  94. package/Engines/Extensions/engine.views.js.map +1 -1
  95. package/Engines/Processors/shaderCodeNode.js +6 -7
  96. package/Engines/Processors/shaderCodeNode.js.map +1 -1
  97. package/Engines/Processors/shaderProcessor.js +6 -11
  98. package/Engines/Processors/shaderProcessor.js.map +1 -1
  99. package/Engines/WebGL/webGLHardwareTexture.js +1 -2
  100. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  101. package/Engines/WebGL/webGLRenderTargetWrapper.js +3 -5
  102. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  103. package/Engines/WebGPU/Extensions/engine.cubeTexture.js +9 -2
  104. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  105. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -2
  106. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  107. package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -6
  108. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  109. package/Engines/WebGPU/Extensions/engine.query.js +2 -4
  110. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  111. package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -4
  112. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  113. package/Engines/WebGPU/Extensions/engine.renderTarget.js +11 -5
  114. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  115. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +11 -3
  116. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  117. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +2 -3
  118. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  119. package/Engines/WebGPU/Extensions/engine.textureSampler.js +1 -2
  120. package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
  121. package/Engines/WebGPU/Extensions/engine.videoTexture.js +1 -2
  122. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  123. package/Engines/WebGPU/webgpuBufferManager.js +1 -1
  124. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  125. package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -7
  126. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  127. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +15 -20
  128. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  129. package/Engines/WebGPU/webgpuCacheSampler.js +10 -5
  130. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  131. package/Engines/WebGPU/webgpuClearQuad.js +2 -3
  132. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  133. package/Engines/WebGPU/webgpuComputePipelineContext.js +1 -2
  134. package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
  135. package/Engines/WebGPU/webgpuDepthCullingState.js +2 -2
  136. package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
  137. package/Engines/WebGPU/webgpuDrawContext.js +1 -2
  138. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  139. package/Engines/WebGPU/webgpuHardwareTexture.js +4 -6
  140. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  141. package/Engines/WebGPU/webgpuMaterialContext.js +2 -3
  142. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  143. package/Engines/WebGPU/webgpuOcclusionQuery.js +3 -5
  144. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  145. package/Engines/WebGPU/webgpuPipelineContext.js +2 -4
  146. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  147. package/Engines/WebGPU/webgpuQuerySet.js +1 -1
  148. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  149. package/Engines/WebGPU/webgpuShaderProcessingContext.js +2 -4
  150. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  151. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +2 -4
  152. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  153. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +5 -4
  154. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  155. package/Engines/WebGPU/webgpuStencilStateComposer.js +1 -2
  156. package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
  157. package/Engines/WebGPU/webgpuTextureManager.js +40 -43
  158. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  159. package/Engines/WebGPU/webgpuTimestampQuery.js +12 -7
  160. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  161. package/Engines/WebGPU/webgpuTintWASM.js +4 -1
  162. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  163. package/Engines/engine.js +4 -7
  164. package/Engines/engine.js.map +1 -1
  165. package/Engines/nativeEngine.js +16 -22
  166. package/Engines/nativeEngine.js.map +1 -1
  167. package/Engines/nullEngine.js +9 -1
  168. package/Engines/nullEngine.js.map +1 -1
  169. package/Engines/renderTargetWrapper.js +11 -16
  170. package/Engines/renderTargetWrapper.js.map +1 -1
  171. package/Engines/thinEngine.js +32 -44
  172. package/Engines/thinEngine.js.map +1 -1
  173. package/Engines/webgpuEngine.js +77 -95
  174. package/Engines/webgpuEngine.js.map +1 -1
  175. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +2 -3
  176. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  177. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +3 -6
  178. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -2
  180. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +1 -2
  182. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  183. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +2 -4
  184. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  185. package/FlowGraph/flowGraph.js +1 -2
  186. package/FlowGraph/flowGraph.js.map +1 -1
  187. package/FlowGraph/flowGraphBlock.js +2 -4
  188. package/FlowGraph/flowGraphBlock.js.map +1 -1
  189. package/FlowGraph/flowGraphContext.js +1 -2
  190. package/FlowGraph/flowGraphContext.js.map +1 -1
  191. package/FlowGraph/flowGraphCoordinator.js +4 -7
  192. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  193. package/FlowGraph/flowGraphSignalConnection.js +1 -2
  194. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  195. package/FlowGraph/serialization.js +2 -3
  196. package/FlowGraph/serialization.js.map +1 -1
  197. package/Gamepads/gamepadManager.js +1 -1
  198. package/Gamepads/gamepadManager.js.map +1 -1
  199. package/Gizmos/axisDragGizmo.js +2 -4
  200. package/Gizmos/axisDragGizmo.js.map +1 -1
  201. package/Gizmos/axisScaleGizmo.js +5 -8
  202. package/Gizmos/axisScaleGizmo.js.map +1 -1
  203. package/Gizmos/boundingBoxGizmo.js +1 -1
  204. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  205. package/Gizmos/cameraGizmo.js +2 -3
  206. package/Gizmos/cameraGizmo.js.map +1 -1
  207. package/Gizmos/gizmo.js +4 -7
  208. package/Gizmos/gizmo.js.map +1 -1
  209. package/Gizmos/gizmoManager.js +3 -4
  210. package/Gizmos/gizmoManager.js.map +1 -1
  211. package/Gizmos/planeDragGizmo.js +2 -4
  212. package/Gizmos/planeDragGizmo.js.map +1 -1
  213. package/Gizmos/planeRotationGizmo.js +2 -4
  214. package/Gizmos/planeRotationGizmo.js.map +1 -1
  215. package/Helpers/environmentHelper.js +8 -2
  216. package/Helpers/environmentHelper.js.map +1 -1
  217. package/Helpers/videoDome.js +1 -2
  218. package/Helpers/videoDome.js.map +1 -1
  219. package/Inputs/scene.inputManager.js +8 -10
  220. package/Inputs/scene.inputManager.js.map +1 -1
  221. package/Layers/effectLayer.js +16 -10
  222. package/Layers/effectLayer.js.map +1 -1
  223. package/Layers/glowLayer.js +16 -6
  224. package/Layers/glowLayer.js.map +1 -1
  225. package/Layers/highlightLayer.js +12 -3
  226. package/Layers/highlightLayer.js.map +1 -1
  227. package/Layers/layer.js +1 -2
  228. package/Layers/layer.js.map +1 -1
  229. package/LensFlares/lensFlareSystem.js +1 -2
  230. package/LensFlares/lensFlareSystem.js.map +1 -1
  231. package/Lights/Shadows/cascadedShadowGenerator.js +21 -25
  232. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  233. package/Lights/Shadows/shadowGenerator.js +18 -21
  234. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  235. package/Lights/light.js +2 -4
  236. package/Lights/light.js.map +1 -1
  237. package/Lights/shadowLight.js +1 -1
  238. package/Lights/shadowLight.js.map +1 -1
  239. package/Loading/Plugins/babylonFileLoader.js +1 -2
  240. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  241. package/Loading/sceneLoader.js +1 -1
  242. package/Loading/sceneLoader.js.map +1 -1
  243. package/Materials/GreasedLine/greasedLinePluginMaterial.js +26 -32
  244. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  245. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +22 -27
  246. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  247. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +6 -7
  248. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  249. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
  250. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  251. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -2
  252. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  253. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +1 -1
  254. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  255. package/Materials/Node/Blocks/Dual/textureBlock.js +10 -16
  256. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  257. package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -3
  258. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  259. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -2
  260. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  261. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +2 -4
  262. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  263. package/Materials/Node/Blocks/Input/inputBlock.js +1 -2
  264. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  265. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +24 -26
  266. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  267. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +3 -3
  268. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  269. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +45 -49
  270. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  271. package/Materials/Node/Blocks/PBR/reflectionBlock.js +1 -2
  272. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  273. package/Materials/Node/Blocks/PBR/refractionBlock.js +1 -2
  274. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  275. package/Materials/Node/Blocks/PBR/sheenBlock.js +13 -13
  276. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  277. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +27 -28
  278. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  279. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +1 -2
  280. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  281. package/Materials/Node/Blocks/Vertex/instancesBlock.js +2 -2
  282. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  283. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +43 -33
  284. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  285. package/Materials/Node/Blocks/biPlanarBlock.js +1 -2
  286. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  287. package/Materials/Node/Blocks/cloudBlock.js +2 -3
  288. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  289. package/Materials/Node/Blocks/colorMergerBlock.js +4 -5
  290. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  291. package/Materials/Node/Blocks/customBlock.js +4 -6
  292. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  293. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +2 -4
  294. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  295. package/Materials/Node/Blocks/triPlanarBlock.js +14 -23
  296. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  297. package/Materials/Node/Blocks/vectorMergerBlock.js +4 -5
  298. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  299. package/Materials/Node/nodeMaterial.js +16 -11
  300. package/Materials/Node/nodeMaterial.js.map +1 -1
  301. package/Materials/Node/nodeMaterialBlock.js +3 -4
  302. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  303. package/Materials/Node/nodeMaterialBuildState.js +1 -1
  304. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  305. package/Materials/PBR/pbrBaseMaterial.js +25 -28
  306. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  307. package/Materials/PBR/pbrClearCoatConfiguration.js +6 -9
  308. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  309. package/Materials/PBR/pbrIridescenceConfiguration.js +4 -7
  310. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  311. package/Materials/PBR/pbrSheenConfiguration.js +4 -7
  312. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  313. package/Materials/Textures/Loaders/envTextureLoader.js +2 -2
  314. package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
  315. package/Materials/Textures/Packer/packer.js +13 -14
  316. package/Materials/Textures/Packer/packer.js.map +1 -1
  317. package/Materials/Textures/Procedurals/noiseProceduralTexture.js +1 -2
  318. package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
  319. package/Materials/Textures/Procedurals/proceduralTexture.js +19 -11
  320. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  321. package/Materials/Textures/baseTexture.js +2 -4
  322. package/Materials/Textures/baseTexture.js.map +1 -1
  323. package/Materials/Textures/cubeTexture.js +7 -13
  324. package/Materials/Textures/cubeTexture.js.map +1 -1
  325. package/Materials/Textures/dynamicTexture.js +1 -2
  326. package/Materials/Textures/dynamicTexture.js.map +1 -1
  327. package/Materials/Textures/hdrCubeTexture.js +2 -4
  328. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  329. package/Materials/Textures/htmlElementTexture.js +5 -3
  330. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  331. package/Materials/Textures/internalTexture.js +3 -5
  332. package/Materials/Textures/internalTexture.js.map +1 -1
  333. package/Materials/Textures/mirrorTexture.js +3 -6
  334. package/Materials/Textures/mirrorTexture.js.map +1 -1
  335. package/Materials/Textures/multiRenderTarget.js +5 -8
  336. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  337. package/Materials/Textures/rawTexture.js +1 -1
  338. package/Materials/Textures/rawTexture.js.map +1 -1
  339. package/Materials/Textures/renderTargetTexture.js +22 -34
  340. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  341. package/Materials/Textures/texture.js +16 -21
  342. package/Materials/Textures/texture.js.map +1 -1
  343. package/Materials/Textures/thinRenderTargetTexture.js +2 -4
  344. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  345. package/Materials/Textures/thinTexture.js +1 -1
  346. package/Materials/Textures/thinTexture.js.map +1 -1
  347. package/Materials/Textures/videoTexture.js +12 -10
  348. package/Materials/Textures/videoTexture.js.map +1 -1
  349. package/Materials/clipPlaneMaterialHelper.js +18 -21
  350. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  351. package/Materials/drawWrapper.js +2 -4
  352. package/Materials/drawWrapper.js.map +1 -1
  353. package/Materials/effect.d.ts +4 -0
  354. package/Materials/effect.js +18 -18
  355. package/Materials/effect.js.map +1 -1
  356. package/Materials/effectRenderer.js +2 -3
  357. package/Materials/effectRenderer.js.map +1 -1
  358. package/Materials/material.decalMapConfiguration.js +3 -3
  359. package/Materials/material.decalMapConfiguration.js.map +1 -1
  360. package/Materials/material.detailMapConfiguration.js +1 -2
  361. package/Materials/material.detailMapConfiguration.js.map +1 -1
  362. package/Materials/material.js +7 -4
  363. package/Materials/material.js.map +1 -1
  364. package/Materials/materialDefines.js +5 -6
  365. package/Materials/materialDefines.js.map +1 -1
  366. package/Materials/materialHelper.d.ts +1 -1
  367. package/Materials/materialHelper.js +3 -4
  368. package/Materials/materialHelper.js.map +1 -1
  369. package/Materials/materialPluginManager.js +3 -5
  370. package/Materials/materialPluginManager.js.map +1 -1
  371. package/Materials/meshDebugPluginMaterial.js +13 -14
  372. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  373. package/Materials/multiMaterial.js +1 -2
  374. package/Materials/multiMaterial.js.map +1 -1
  375. package/Materials/shaderMaterial.d.ts +1 -1
  376. package/Materials/shaderMaterial.js +64 -32
  377. package/Materials/shaderMaterial.js.map +1 -1
  378. package/Materials/shadowDepthWrapper.js +24 -23
  379. package/Materials/shadowDepthWrapper.js.map +1 -1
  380. package/Materials/standardMaterial.js +10 -12
  381. package/Materials/standardMaterial.js.map +1 -1
  382. package/Materials/uniformBuffer.js +1 -1
  383. package/Materials/uniformBuffer.js.map +1 -1
  384. package/Maths/math.vector.js +1 -2
  385. package/Maths/math.vector.js.map +1 -1
  386. package/Meshes/Builders/decalBuilder.js +26 -29
  387. package/Meshes/Builders/decalBuilder.js.map +1 -1
  388. package/Meshes/Builders/greasedLineBuilder.js +16 -16
  389. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  390. package/Meshes/Builders/groundBuilder.d.ts +5 -1
  391. package/Meshes/Builders/groundBuilder.js +13 -2
  392. package/Meshes/Builders/groundBuilder.js.map +1 -1
  393. package/Meshes/Builders/textBuilder.js +2 -3
  394. package/Meshes/Builders/textBuilder.js.map +1 -1
  395. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +9 -1
  396. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +141 -12
  397. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  398. package/Meshes/GreasedLine/greasedLineBaseMesh.js +8 -11
  399. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  400. package/Meshes/GreasedLine/greasedLineMesh.js +3 -5
  401. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  402. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +13 -18
  403. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  404. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +1 -2
  405. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  406. package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +18 -18
  407. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +18 -18
  408. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  409. package/Meshes/Node/nodeGeometry.js +6 -3
  410. package/Meshes/Node/nodeGeometry.js.map +1 -1
  411. package/Meshes/Node/nodeGeometryBlock.js +1 -1
  412. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  413. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -2
  414. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  415. package/Meshes/Node/nodeGeometryBuildState.js +1 -2
  416. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  417. package/Meshes/abstractMesh.js +6 -10
  418. package/Meshes/abstractMesh.js.map +1 -1
  419. package/Meshes/csg.js +1 -2
  420. package/Meshes/csg.js.map +1 -1
  421. package/Meshes/geometry.js +1 -1
  422. package/Meshes/geometry.js.map +1 -1
  423. package/Meshes/instancedMesh.js +5 -10
  424. package/Meshes/instancedMesh.js.map +1 -1
  425. package/Meshes/mesh.js +13 -22
  426. package/Meshes/mesh.js.map +1 -1
  427. package/Meshes/mesh.vertexData.js +3 -4
  428. package/Meshes/mesh.vertexData.js.map +1 -1
  429. package/Meshes/meshUVSpaceRenderer.js +18 -15
  430. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  431. package/Meshes/subMesh.js +8 -14
  432. package/Meshes/subMesh.js.map +1 -1
  433. package/Meshes/thinInstanceMesh.js +12 -18
  434. package/Meshes/thinInstanceMesh.js.map +1 -1
  435. package/Meshes/trailMesh.js +2 -3
  436. package/Meshes/trailMesh.js.map +1 -1
  437. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -2
  438. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  439. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +9 -14
  440. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
  441. package/Misc/PerformanceViewer/performanceViewerCollector.js +2 -3
  442. package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
  443. package/Misc/arrayTools.js +1 -1
  444. package/Misc/arrayTools.js.map +1 -1
  445. package/Misc/basis.js +2 -3
  446. package/Misc/basis.js.map +1 -1
  447. package/Misc/dataStorage.js +1 -1
  448. package/Misc/dataStorage.js.map +1 -1
  449. package/Misc/deepCopier.js +1 -1
  450. package/Misc/deepCopier.js.map +1 -1
  451. package/Misc/environmentTextureTools.js +3 -4
  452. package/Misc/environmentTextureTools.js.map +1 -1
  453. package/Misc/equirectangularCapture.js +2 -3
  454. package/Misc/equirectangularCapture.js.map +1 -1
  455. package/Misc/fileTools.js +4 -4
  456. package/Misc/fileTools.js.map +1 -1
  457. package/Misc/greasedLineTools.js +3 -5
  458. package/Misc/greasedLineTools.js.map +1 -1
  459. package/Misc/logger.js +1 -2
  460. package/Misc/logger.js.map +1 -1
  461. package/Misc/minMaxReducer.js +2 -3
  462. package/Misc/minMaxReducer.js.map +1 -1
  463. package/Misc/pressureObserverWrapper.js +5 -8
  464. package/Misc/pressureObserverWrapper.js.map +1 -1
  465. package/Misc/sceneRecorder.js +1 -1
  466. package/Misc/sceneRecorder.js.map +1 -1
  467. package/Misc/screenshotTools.js +1 -1
  468. package/Misc/screenshotTools.js.map +1 -1
  469. package/Misc/textureTools.js +5 -5
  470. package/Misc/textureTools.js.map +1 -1
  471. package/Misc/timer.js +3 -5
  472. package/Misc/timer.js.map +1 -1
  473. package/Misc/tools.d.ts +3 -2
  474. package/Misc/tools.js +6 -5
  475. package/Misc/tools.js.map +1 -1
  476. package/Misc/trajectoryClassifier.js +3 -3
  477. package/Misc/trajectoryClassifier.js.map +1 -1
  478. package/Misc/videoRecorder.js +6 -4
  479. package/Misc/videoRecorder.js.map +1 -1
  480. package/Misc/virtualJoystick.js +4 -1
  481. package/Misc/virtualJoystick.js.map +1 -1
  482. package/Morph/morphTargetManager.js +1 -2
  483. package/Morph/morphTargetManager.js.map +1 -1
  484. package/Particles/EmitterTypes/meshParticleEmitter.js +1 -2
  485. package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
  486. package/Particles/baseParticleSystem.d.ts +4 -0
  487. package/Particles/baseParticleSystem.js +4 -0
  488. package/Particles/baseParticleSystem.js.map +1 -1
  489. package/Particles/computeShaderParticleSystem.js +3 -6
  490. package/Particles/computeShaderParticleSystem.js.map +1 -1
  491. package/Particles/gpuParticleSystem.d.ts +2 -2
  492. package/Particles/gpuParticleSystem.js +30 -20
  493. package/Particles/gpuParticleSystem.js.map +1 -1
  494. package/Particles/particleSystem.d.ts +3 -2
  495. package/Particles/particleSystem.js +33 -30
  496. package/Particles/particleSystem.js.map +1 -1
  497. package/Particles/particleSystemComponent.js +2 -3
  498. package/Particles/particleSystemComponent.js.map +1 -1
  499. package/Particles/pointsCloudSystem.js +5 -8
  500. package/Particles/pointsCloudSystem.js.map +1 -1
  501. package/Particles/solidParticleSystem.js +5 -7
  502. package/Particles/solidParticleSystem.js.map +1 -1
  503. package/Particles/webgl2ParticleSystem.js +1 -2
  504. package/Particles/webgl2ParticleSystem.js.map +1 -1
  505. package/Physics/castingResult.js +1 -1
  506. package/Physics/castingResult.js.map +1 -1
  507. package/Physics/joinedPhysicsEngineComponent.js +2 -2
  508. package/Physics/joinedPhysicsEngineComponent.js.map +1 -1
  509. package/Physics/physicsHelper.js +19 -21
  510. package/Physics/physicsHelper.js.map +1 -1
  511. package/Physics/v2/IPhysicsEnginePlugin.d.ts +20 -0
  512. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  513. package/Physics/v2/Plugins/havokPlugin.js +48 -35
  514. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  515. package/Physics/v2/physicsAggregate.js +10 -12
  516. package/Physics/v2/physicsAggregate.js.map +1 -1
  517. package/Physics/v2/physicsBody.js +2 -4
  518. package/Physics/v2/physicsBody.js.map +1 -1
  519. package/Physics/v2/physicsShape.js +1 -2
  520. package/Physics/v2/physicsShape.js.map +1 -1
  521. package/Physics/v2/ragdoll.js +6 -8
  522. package/Physics/v2/ragdoll.js.map +1 -1
  523. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +6 -8
  524. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  525. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +14 -22
  526. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  527. package/PostProcesses/colorCorrectionPostProcess.js +1 -1
  528. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  529. package/PostProcesses/postProcess.js +28 -34
  530. package/PostProcesses/postProcess.js.map +1 -1
  531. package/PostProcesses/postProcessManager.js +4 -6
  532. package/PostProcesses/postProcessManager.js.map +1 -1
  533. package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -2
  534. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  535. package/PostProcesses/volumetricLightScatteringPostProcess.js +4 -7
  536. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  537. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +1 -1
  538. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  539. package/Probes/reflectionProbe.js +2 -4
  540. package/Probes/reflectionProbe.js.map +1 -1
  541. package/Rendering/GlobalIllumination/giRSMManager.js +22 -19
  542. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  543. package/Rendering/boundingBoxRenderer.js +2 -3
  544. package/Rendering/boundingBoxRenderer.js.map +1 -1
  545. package/Rendering/depthPeelingRenderer.js +2 -4
  546. package/Rendering/depthPeelingRenderer.js.map +1 -1
  547. package/Rendering/depthPeelingSceneComponent.js +2 -4
  548. package/Rendering/depthPeelingSceneComponent.js.map +1 -1
  549. package/Rendering/depthRenderer.js +10 -13
  550. package/Rendering/depthRenderer.js.map +1 -1
  551. package/Rendering/edgesRenderer.js +8 -11
  552. package/Rendering/edgesRenderer.js.map +1 -1
  553. package/Rendering/fluidRenderer/fluidRenderer.js +6 -11
  554. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  555. package/Rendering/fluidRenderer/fluidRenderingObject.js +3 -5
  556. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  557. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +2 -4
  558. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  559. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +30 -36
  560. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  561. package/Rendering/fluidRenderer/fluidRenderingTextures.js +5 -7
  562. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  563. package/Rendering/geometryBufferRenderer.js +3 -2
  564. package/Rendering/geometryBufferRenderer.js.map +1 -1
  565. package/Rendering/outlineRenderer.js +5 -4
  566. package/Rendering/outlineRenderer.js.map +1 -1
  567. package/Rendering/prePassRenderer.js +3 -6
  568. package/Rendering/prePassRenderer.js.map +1 -1
  569. package/Rendering/reflectiveShadowMap.d.ts +1 -0
  570. package/Rendering/reflectiveShadowMap.js +5 -5
  571. package/Rendering/reflectiveShadowMap.js.map +1 -1
  572. package/Shaders/color.fragment.d.ts +2 -0
  573. package/Shaders/color.fragment.js +4 -0
  574. package/Shaders/color.fragment.js.map +1 -1
  575. package/Shaders/color.vertex.d.ts +2 -0
  576. package/Shaders/color.vertex.js +7 -0
  577. package/Shaders/color.vertex.js.map +1 -1
  578. package/Shaders/gpuRenderParticles.fragment.d.ts +2 -0
  579. package/Shaders/gpuRenderParticles.fragment.js +4 -0
  580. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  581. package/Shaders/gpuRenderParticles.vertex.d.ts +2 -0
  582. package/Shaders/gpuRenderParticles.vertex.js +5 -1
  583. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  584. package/Shaders/particles.fragment.d.ts +2 -0
  585. package/Shaders/particles.fragment.js +4 -0
  586. package/Shaders/particles.fragment.js.map +1 -1
  587. package/Shaders/particles.vertex.d.ts +2 -0
  588. package/Shaders/particles.vertex.js +5 -1
  589. package/Shaders/particles.vertex.js.map +1 -1
  590. package/Sprites/spriteManager.js +1 -2
  591. package/Sprites/spriteManager.js.map +1 -1
  592. package/Sprites/spriteRenderer.js +5 -7
  593. package/Sprites/spriteRenderer.js.map +1 -1
  594. package/States/stencilStateComposer.js +2 -4
  595. package/States/stencilStateComposer.js.map +1 -1
  596. package/XR/features/WebXRAbstractFeature.js +6 -2
  597. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  598. package/XR/features/WebXRAnchorSystem.js +1 -2
  599. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  600. package/XR/features/WebXRControllerMovement.js +6 -7
  601. package/XR/features/WebXRControllerMovement.js.map +1 -1
  602. package/XR/features/WebXRControllerPhysics.js +17 -10
  603. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  604. package/XR/features/WebXRControllerPointerSelection.js +1 -2
  605. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  606. package/XR/features/WebXRControllerTeleportation.d.ts +1 -0
  607. package/XR/features/WebXRControllerTeleportation.js +6 -3
  608. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  609. package/XR/features/WebXRDepthSensing.js +3 -5
  610. package/XR/features/WebXRDepthSensing.js.map +1 -1
  611. package/XR/features/WebXRHandTracking.d.ts +1 -0
  612. package/XR/features/WebXRHandTracking.js +31 -28
  613. package/XR/features/WebXRHandTracking.js.map +1 -1
  614. package/XR/features/WebXRLayers.js +9 -11
  615. package/XR/features/WebXRLayers.js.map +1 -1
  616. package/XR/features/WebXRLightEstimation.js +3 -6
  617. package/XR/features/WebXRLightEstimation.js.map +1 -1
  618. package/XR/features/WebXRMeshDetector.js +2 -4
  619. package/XR/features/WebXRMeshDetector.js.map +1 -1
  620. package/XR/features/WebXRNearInteraction.js +21 -18
  621. package/XR/features/WebXRNearInteraction.js.map +1 -1
  622. package/XR/features/WebXRPlaneDetector.js +1 -2
  623. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  624. package/XR/features/WebXRRawCameraAccess.js +2 -3
  625. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  626. package/XR/features/WebXRSpaceWarp.js +1 -1
  627. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  628. package/XR/motionController/webXRAbstractMotionController.js +4 -1
  629. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  630. package/XR/native/nativeXRFrame.js +1 -2
  631. package/XR/native/nativeXRFrame.js.map +1 -1
  632. package/XR/webXRCamera.js +1 -2
  633. package/XR/webXRCamera.js.map +1 -1
  634. package/XR/webXRDefaultExperience.js +28 -6
  635. package/XR/webXRDefaultExperience.js.map +1 -1
  636. package/XR/webXRExperienceHelper.js +5 -7
  637. package/XR/webXRExperienceHelper.js.map +1 -1
  638. package/XR/webXRFeaturesManager.js +4 -1
  639. package/XR/webXRFeaturesManager.js.map +1 -1
  640. package/XR/webXRInput.js +6 -1
  641. package/XR/webXRInput.js.map +1 -1
  642. package/XR/webXRInputSource.js +1 -2
  643. package/XR/webXRInputSource.js.map +1 -1
  644. package/XR/webXRSessionManager.js +16 -29
  645. package/XR/webXRSessionManager.js.map +1 -1
  646. package/assetContainer.js +4 -1
  647. package/assetContainer.js.map +1 -1
  648. package/package.json +1 -1
  649. package/scene.js +18 -17
  650. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/greasedLineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,kCAAkC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjJ,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAEtG;;;GAGG;AACH,MAAM,CAAN,IAAY,gCAyBX;AAzBD,WAAY,gCAAgC;IACxC;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,iIAA6B,CAAA;IAC7B;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,+HAA4B,CAAA;IAC5B;;OAEG;IACH,2HAA0B,CAAA;IAC1B;;OAEG;IACH,uIAAgC,CAAA;AACpC,CAAC,EAzBW,gCAAgC,KAAhC,gCAAgC,QAyB3C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,gCAyBX;AAzBD,WAAY,gCAAgC;IACxC;;OAEG;IACH,6HAA2B,CAAA;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E3B,CAAC,IAAI,iBAAiB,CAAC;aAC1B;SACJ;aAAM,IAAI,iBAAiB,KAAK,gCAAgC,CAAC,uBAAuB,EAAE;YACvF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9B;SACJ;KACJ;SAAM;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;YACjC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9B;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { StandardMaterial } from \"./../../Materials/standardMaterial\";\r\nimport { PBRMaterial } from \"../../Materials/PBR/pbrMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { GreasedLineMesh } from \"../GreasedLine/greasedLineMesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonMesh } from \"../GreasedLine/greasedLineRibbonMesh\";\r\nimport type { GreasedLineMaterialOptions } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshMaterialType } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { GreasedLineMaterialDefaults } from \"../../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * How are the colors distributed along the color table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colors-and-colordistribution}\r\n */\r\nexport enum GreasedLineMeshColorDistribution {\r\n /**\r\n * Do no modify the color table\r\n */\r\n COLOR_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the colors until the color table is full\r\n */\r\n COLOR_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the colors evenly through the color table\r\n */\r\n COLOR_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the colors to start of the color table a fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the colors to the end of the color table and fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the colors to start and to the end of the color table and fill the gap between with the default color\r\n */\r\n COLOR_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * How are the widths distributed along the width table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#widths-and-widthdistribution}\r\n */\r\nexport enum GreasedLineMeshWidthDistribution {\r\n /**\r\n * Do no modify the width table\r\n */\r\n WIDTH_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the widths until the width table is full\r\n */\r\n WIDTH_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the widths evenly through the width table\r\n */\r\n WIDTH_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the widths to start of the width table a fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the widths to the end of the width table and fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the widths to start and to the end of the width table and fill the gap between with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * Material options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMaterialBuilderOptions extends GreasedLineMaterialOptions {\r\n /**\r\n * If set to true a new material will be created and a new material plugin will be attached\r\n * to the material. The material will be set on the mesh. If the instance option is specified in the mesh options,\r\n * no material will be created/assigned. Defaults to true.\r\n */\r\n createAndAssignMaterial?: boolean;\r\n /**\r\n * Distribution of the colors if the color table contains fewer entries than needed. Defaults to GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START\r\n * @see CompleteGreasedLineColorTable\r\n */\r\n colorDistribution?: GreasedLineMeshColorDistribution;\r\n}\r\n\r\n/**\r\n * Line mesh options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMeshBuilderOptions extends GreasedLineMeshOptions {\r\n /**\r\n * Distribution of the widths if the width table contains fewer entries than needed. Defaults to GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START\r\n * @see CompleteGreasedLineWidthTable\r\n */\r\n widthDistribution?: GreasedLineMeshWidthDistribution;\r\n}\r\n\r\n/**\r\n * Builder functions for creating GreasedLineMeshes\r\n */\r\n\r\n/**\r\n * Creates a new @see GreasedLinePluginMaterial\r\n * @param name name of the material\r\n * @param options material options @see GreasedLineMaterialOptions\r\n * @param scene scene or null to use the last scene\r\n * @returns StandardMaterial or PBRMaterial with the @see GreasedLinePluginMaterial attached to it\r\n */\r\nexport function CreateGreasedLineMaterial(name: string, options: GreasedLineMaterialOptions, scene: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let material;\r\n switch (options.materialType) {\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:\r\n material = new PBRMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:\r\n material = new GreasedLineSimpleMaterial(name, scene, options);\r\n break;\r\n default:\r\n material = new StandardMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n }\r\n\r\n return material;\r\n}\r\n\r\n/**\r\n * Creates a GreasedLine mesh\r\n * @param name name of the mesh\r\n * @param options options for the mesh\r\n * @param materialOptions material options for the mesh\r\n * @param scene scene where the mesh will be created\r\n * @returns instance of GreasedLineMesh\r\n */\r\nexport function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let instance;\r\n const allPoints = GreasedLineTools.ConvertPoints(options.points);\r\n\r\n options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;\r\n if (options.ribbonOptions) {\r\n options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;\r\n options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;\r\n options.ribbonOptions.directionsAutoMode =\r\n options.ribbonOptions.directionsAutoMode ??\r\n (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);\r\n }\r\n\r\n materialOptions = materialOptions ?? {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;\r\n materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;\r\n materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;\r\n\r\n let length = 0;\r\n if (Array.isArray(allPoints[0])) {\r\n allPoints.forEach((points) => {\r\n length += points.length / 3;\r\n });\r\n }\r\n\r\n const widths = CompleteGreasedLineWidthTable(length, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(length, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)\r\n : undefined;\r\n\r\n // create new mesh if instance is not defined\r\n const initialGreasedLineOptions: GreasedLineMeshOptions = {\r\n points: allPoints,\r\n updatable: options.updatable,\r\n widths,\r\n lazy: options.lazy,\r\n ribbonOptions: options.ribbonOptions,\r\n uvs: options.uvs,\r\n colorPointers: options.colorPointers,\r\n };\r\n\r\n if (initialGreasedLineOptions.ribbonOptions) {\r\n if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n }\r\n }\r\n\r\n if (!options.instance) {\r\n instance = initialGreasedLineOptions.ribbonOptions\r\n ? new GreasedLineRibbonMesh(name, scene, initialGreasedLineOptions)\r\n : new GreasedLineMesh(name, scene, initialGreasedLineOptions);\r\n\r\n if (materialOptions) {\r\n const initialMaterialOptions: GreasedLineMaterialOptions = {\r\n materialType: materialOptions.materialType,\r\n dashCount: materialOptions.dashCount,\r\n dashOffset: materialOptions.dashOffset,\r\n dashRatio: materialOptions.dashRatio,\r\n resolution: materialOptions.resolution,\r\n sizeAttenuation: materialOptions.sizeAttenuation,\r\n useColors: materialOptions.useColors,\r\n useDash: materialOptions.useDash,\r\n visibility: materialOptions.visibility,\r\n width: materialOptions.width,\r\n color: materialOptions.color,\r\n colorMode: materialOptions.colorMode,\r\n colorsSampling: materialOptions.colorsSampling,\r\n colorDistributionType: materialOptions.colorDistributionType,\r\n colors,\r\n cameraFacing: !options.ribbonOptions,\r\n colorsTexture: materialOptions.colorsTexture,\r\n };\r\n\r\n if (materialOptions.createAndAssignMaterial) {\r\n const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);\r\n instance.material = material;\r\n\r\n if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {\r\n material.backFaceCulling = false;\r\n }\r\n }\r\n }\r\n } else {\r\n // update the data on the mesh instance\r\n instance = options.instance;\r\n if (instance instanceof GreasedLineRibbonMesh) {\r\n instance.addPoints(allPoints, initialGreasedLineOptions);\r\n } else {\r\n const currentWidths = instance.widths;\r\n\r\n if (currentWidths) {\r\n const newWidths = currentWidths.slice();\r\n for (const w of widths) {\r\n newWidths.push(w);\r\n }\r\n instance.widths = newWidths;\r\n } else {\r\n instance.widths = widths;\r\n }\r\n instance.addPoints(allPoints);\r\n }\r\n }\r\n\r\n // add colors\r\n // it will merge if any colors already on the instance\r\n if (colors && options.instance) {\r\n if (options.instance.greasedLineMaterial) {\r\n const currentColors = options.instance.greasedLineMaterial.colors;\r\n if (currentColors) {\r\n const newColors = currentColors.concat(colors);\r\n options.instance.greasedLineMaterial.setColors(newColors, instance.isLazy());\r\n }\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\n/**\r\n * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.\r\n * You can provide more points the widths when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMeshWidthDistribution.REPEAT - the width table will be repeatedly copied to the empty values [wL, wU] = [wL, wU, wL, wU, wL, wU, wL, wU, ...]\r\n * GreasedLineMeshWidthDistribution.EVEN - the width table will be evenly copied to the empty values [wL, wU] = [wL, wL, wL, wL, wU, wU, wU, wU]\r\n * GreasedLineMeshWidthDistribution.START - the width table will be copied at the start of the empty values\r\n * and rest will be filled width the default width upper and default width lower values [wU, wL] = [wL, wU, dwL, dwU, dwL, dwU, dwL, dwU]\r\n * GreasedLineMeshWidthDistribution.END - the width table will be copied at the end of the empty values\r\n * and rest will be filled width the default values [wL, wU] = [wL, wU, dwL, dwU, dwL, dwU, wL, wU]\r\n * @param pointCount number of points of the line mesh\r\n * @param widths array of widths [widhtLower, widthUpper, widthLower, widthUpper ...]. Two widths (lower/upper) per point.\r\n * @param widthsDistribution how to distribute widths if the widths array has fewer entries than pointCount\r\n * @param defaultWidthUpper the default value which will be used to fill empty width entries - upper width\r\n * @param defaultWidthLower the default value which will be used to fill empty width entries - lower width\r\n * @returns completed width table.\r\n */\r\nexport function CompleteGreasedLineWidthTable(\r\n pointCount: number,\r\n widths: number[],\r\n widthsDistribution: GreasedLineMeshWidthDistribution,\r\n defaultWidthUpper = 1,\r\n defaultWidthLower = 1\r\n): number[] {\r\n const missingCount = pointCount - widths.length / 2;\r\n\r\n const widthsData: number[] = [];\r\n if (missingCount < 0) {\r\n return widths.slice(0, pointCount * 2);\r\n }\r\n\r\n // is the width table shorter than the point table?\r\n if (missingCount > 0) {\r\n if (widths.length % 2 != 0) {\r\n widths.push(defaultWidthUpper);\r\n }\r\n // it is, fill in the missing elements\r\n if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(widths.length / 2);\r\n\r\n // start sector\r\n for (let i = 0, j = 0; i < halfCount - 1; i++) {\r\n widthsData.push(widths[j++]);\r\n widthsData.push(widths[j++]);\r\n }\r\n\r\n // middle sector\r\n const widthL = widths[halfCount / 2];\r\n const widthU = widths[halfCount / 2 + 1];\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(widthU);\r\n widthsData.push(widthL);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n widthsData.push(widths[i++]);\r\n widthsData.push(widths[i++]);\r\n\r\n if (i === widths.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const widthsectorLength = widths.length / ((pointCount - 1) * 2);\r\n for (let x = 0; x < pointCount; x++) {\r\n const i = Math.floor(j);\r\n\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n\r\n j += widthsectorLength;\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < widths.length; i++) {\r\n widthsData.push(widths[i]);\r\n }\r\n }\r\n\r\n return widthsData;\r\n}\r\n\r\n/**\r\n * Completes the color table/fill the missing color entries. It means it creates a color entry for every point of the line mesh.\r\n * You can provide more points the colors when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMesColorhDistribution.REPEAT - the color table will be repeatedly copied to the empty values [c1, c2] = [c1, c2, c1, c2, c1, c2, c1, c2]\r\n * GreasedLineMesColorhDistribution.EVEN - the color table will be evenly copied to the empty values [c1, c2] = [c1, c1, c1, c1, c2, c2, c2, c2]\r\n * GreasedLineMesColorhDistribution.START - the color table will be copied at the start of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, dc, dc]\r\n * GreasedLineMesColorhDistribution.START_END - the color table will be copied at the start and the end of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, c1, c2]\r\n * @param pointCount number of points of the line mesh\r\n * @param colors array of Color3 for the color table\r\n * @param colorDistribution how to distribute colors if the colors array has fewer entries than pointCount\r\n * @param defaultColor default color to be used to fill empty entries in the color table\r\n * @returns completed array of Color3s\r\n */\r\nexport function CompleteGreasedLineColorTable(pointCount: number, colors: Color3[], colorDistribution: GreasedLineMeshColorDistribution, defaultColor: Color3): Color3[] {\r\n pointCount = Math.max(colors.length, pointCount);\r\n const missingCount = pointCount - colors.length;\r\n if (missingCount < 0) {\r\n return colors.slice(0, pointCount);\r\n }\r\n\r\n const colorsData: Color3[] = [];\r\n // is the color table shorter than the point table?\r\n if (missingCount > 0) {\r\n // it is, fill in the missing elements\r\n if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(colors.length / 2);\r\n\r\n // start sector\r\n for (let i = 0; i < halfCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // middle sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n colorsData.push(colors[i]);\r\n\r\n i++;\r\n\r\n if (i === colors.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const colorSectorLength = colors.length / (pointCount - 1);\r\n for (let x = 0; x < pointCount - 1; x++) {\r\n const i = Math.floor(j);\r\n\r\n colorsData.push(colors[i]);\r\n\r\n j += colorSectorLength;\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < pointCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n\r\n return colorsData;\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/greasedLineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,kCAAkC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjJ,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAA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AiB,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAExB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE3B,CAAC,IAAI,iBAAiB,CAAC;aAC1B;SACJ;aAAM,IAAI,iBAAiB,KAAK,gCAAgC,CAAC,uBAAuB,EAAE;YACvF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9B;SACJ;KACJ;SAAM;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;YACjC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9B;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { StandardMaterial } from \"./../../Materials/standardMaterial\";\r\nimport { PBRMaterial } from \"../../Materials/PBR/pbrMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { GreasedLineMesh } from \"../GreasedLine/greasedLineMesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonMesh } from \"../GreasedLine/greasedLineRibbonMesh\";\r\nimport type { GreasedLineMaterialOptions } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshMaterialType } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { GreasedLineMaterialDefaults } from \"../../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * How are the colors distributed along the color table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colors-and-colordistribution}\r\n */\r\nexport enum GreasedLineMeshColorDistribution {\r\n /**\r\n * Do no modify the color table\r\n */\r\n COLOR_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the colors until the color table is full\r\n */\r\n COLOR_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the colors evenly through the color table\r\n */\r\n COLOR_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the colors to start of the color table a fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the colors to the end of the color table and fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the colors to start and to the end of the color table and fill the gap between with the default color\r\n */\r\n COLOR_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * How are the widths distributed along the width table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#widths-and-widthdistribution}\r\n */\r\nexport enum GreasedLineMeshWidthDistribution {\r\n /**\r\n * Do no modify the width table\r\n */\r\n WIDTH_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the widths until the width table is full\r\n */\r\n WIDTH_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the widths evenly through the width table\r\n */\r\n WIDTH_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the widths to start of the width table a fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the widths to the end of the width table and fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the widths to start and to the end of the width table and fill the gap between with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * Material options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMaterialBuilderOptions extends GreasedLineMaterialOptions {\r\n /**\r\n * If set to true a new material will be created and a new material plugin will be attached\r\n * to the material. The material will be set on the mesh. If the instance option is specified in the mesh options,\r\n * no material will be created/assigned. Defaults to true.\r\n */\r\n createAndAssignMaterial?: boolean;\r\n /**\r\n * Distribution of the colors if the color table contains fewer entries than needed. Defaults to GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START\r\n * @see CompleteGreasedLineColorTable\r\n */\r\n colorDistribution?: GreasedLineMeshColorDistribution;\r\n}\r\n\r\n/**\r\n * Line mesh options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMeshBuilderOptions extends GreasedLineMeshOptions {\r\n /**\r\n * Distribution of the widths if the width table contains fewer entries than needed. Defaults to GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START\r\n * @see CompleteGreasedLineWidthTable\r\n */\r\n widthDistribution?: GreasedLineMeshWidthDistribution;\r\n}\r\n\r\n/**\r\n * Builder functions for creating GreasedLineMeshes\r\n */\r\n\r\n/**\r\n * Creates a new @see GreasedLinePluginMaterial\r\n * @param name name of the material\r\n * @param options material options @see GreasedLineMaterialOptions\r\n * @param scene scene or null to use the last scene\r\n * @returns StandardMaterial or PBRMaterial with the @see GreasedLinePluginMaterial attached to it\r\n */\r\nexport function CreateGreasedLineMaterial(name: string, options: GreasedLineMaterialOptions, scene: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let material;\r\n switch (options.materialType) {\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:\r\n material = new PBRMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:\r\n material = new GreasedLineSimpleMaterial(name, scene, options);\r\n break;\r\n default:\r\n material = new StandardMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n }\r\n\r\n return material;\r\n}\r\n\r\n/**\r\n * Creates a GreasedLine mesh\r\n * @param name name of the mesh\r\n * @param options options for the mesh\r\n * @param materialOptions material options for the mesh\r\n * @param scene scene where the mesh will be created\r\n * @returns instance of GreasedLineMesh\r\n */\r\nexport function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let instance;\r\n const allPoints = GreasedLineTools.ConvertPoints(options.points);\r\n\r\n options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;\r\n if (options.ribbonOptions) {\r\n options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;\r\n options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;\r\n options.ribbonOptions.directionsAutoMode =\r\n options.ribbonOptions.directionsAutoMode ??\r\n (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);\r\n }\r\n\r\n materialOptions = materialOptions ?? {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;\r\n materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;\r\n materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;\r\n\r\n let length = 0;\r\n if (Array.isArray(allPoints[0])) {\r\n allPoints.forEach((points) => {\r\n length += points.length / 3;\r\n });\r\n }\r\n\r\n const widths = CompleteGreasedLineWidthTable(length, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(length, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)\r\n : undefined;\r\n\r\n // create new mesh if instance is not defined\r\n const initialGreasedLineOptions: GreasedLineMeshOptions = {\r\n points: allPoints,\r\n updatable: options.updatable,\r\n widths,\r\n lazy: options.lazy,\r\n ribbonOptions: options.ribbonOptions,\r\n uvs: options.uvs,\r\n colorPointers: options.colorPointers,\r\n };\r\n\r\n if (initialGreasedLineOptions.ribbonOptions) {\r\n if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n }\r\n }\r\n\r\n if (!options.instance) {\r\n instance = initialGreasedLineOptions.ribbonOptions\r\n ? new GreasedLineRibbonMesh(name, scene, initialGreasedLineOptions)\r\n : new GreasedLineMesh(name, scene, initialGreasedLineOptions);\r\n\r\n if (materialOptions) {\r\n const initialMaterialOptions: GreasedLineMaterialOptions = {\r\n materialType: materialOptions.materialType,\r\n dashCount: materialOptions.dashCount,\r\n dashOffset: materialOptions.dashOffset,\r\n dashRatio: materialOptions.dashRatio,\r\n resolution: materialOptions.resolution,\r\n sizeAttenuation: materialOptions.sizeAttenuation,\r\n useColors: materialOptions.useColors,\r\n useDash: materialOptions.useDash,\r\n visibility: materialOptions.visibility,\r\n width: materialOptions.width,\r\n color: materialOptions.color,\r\n colorMode: materialOptions.colorMode,\r\n colorsSampling: materialOptions.colorsSampling,\r\n colorDistributionType: materialOptions.colorDistributionType,\r\n colors,\r\n cameraFacing: !options.ribbonOptions,\r\n colorsTexture: materialOptions.colorsTexture,\r\n };\r\n\r\n if (materialOptions.createAndAssignMaterial) {\r\n const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);\r\n instance.material = material;\r\n\r\n if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {\r\n material.backFaceCulling = false;\r\n }\r\n }\r\n }\r\n } else {\r\n // update the data on the mesh instance\r\n instance = options.instance;\r\n if (instance instanceof GreasedLineRibbonMesh) {\r\n instance.addPoints(allPoints, initialGreasedLineOptions);\r\n } else {\r\n const currentWidths = instance.widths;\r\n\r\n if (currentWidths) {\r\n const newWidths = currentWidths.slice();\r\n for (const w of widths) {\r\n newWidths.push(w);\r\n }\r\n instance.widths = newWidths;\r\n } else {\r\n instance.widths = widths;\r\n }\r\n instance.addPoints(allPoints);\r\n }\r\n }\r\n\r\n // add colors\r\n // it will merge if any colors already on the instance\r\n if (colors && options.instance) {\r\n if (options.instance.greasedLineMaterial) {\r\n const currentColors = options.instance.greasedLineMaterial.colors;\r\n if (currentColors) {\r\n const newColors = currentColors.concat(colors);\r\n options.instance.greasedLineMaterial.setColors(newColors, instance.isLazy());\r\n }\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\n/**\r\n * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.\r\n * You can provide more points the widths when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMeshWidthDistribution.REPEAT - the width table will be repeatedly copied to the empty values [wL, wU] = [wL, wU, wL, wU, wL, wU, wL, wU, ...]\r\n * GreasedLineMeshWidthDistribution.EVEN - the width table will be evenly copied to the empty values [wL, wU] = [wL, wL, wL, wL, wU, wU, wU, wU]\r\n * GreasedLineMeshWidthDistribution.START - the width table will be copied at the start of the empty values\r\n * and rest will be filled width the default width upper and default width lower values [wU, wL] = [wL, wU, dwL, dwU, dwL, dwU, dwL, dwU]\r\n * GreasedLineMeshWidthDistribution.END - the width table will be copied at the end of the empty values\r\n * and rest will be filled width the default values [wL, wU] = [wL, wU, dwL, dwU, dwL, dwU, wL, wU]\r\n * @param pointCount number of points of the line mesh\r\n * @param widths array of widths [widhtLower, widthUpper, widthLower, widthUpper ...]. Two widths (lower/upper) per point.\r\n * @param widthsDistribution how to distribute widths if the widths array has fewer entries than pointCount\r\n * @param defaultWidthUpper the default value which will be used to fill empty width entries - upper width\r\n * @param defaultWidthLower the default value which will be used to fill empty width entries - lower width\r\n * @returns completed width table.\r\n */\r\nexport function CompleteGreasedLineWidthTable(\r\n pointCount: number,\r\n widths: number[],\r\n widthsDistribution: GreasedLineMeshWidthDistribution,\r\n defaultWidthUpper = 1,\r\n defaultWidthLower = 1\r\n): number[] {\r\n const missingCount = pointCount - widths.length / 2;\r\n\r\n const widthsData: number[] = [];\r\n if (missingCount < 0) {\r\n return widths.slice(0, pointCount * 2);\r\n }\r\n\r\n // is the width table shorter than the point table?\r\n if (missingCount > 0) {\r\n if (widths.length % 2 != 0) {\r\n widths.push(defaultWidthUpper);\r\n }\r\n // it is, fill in the missing elements\r\n if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(widths.length / 2);\r\n\r\n // start sector\r\n for (let i = 0, j = 0; i < halfCount - 1; i++) {\r\n widthsData.push(widths[j++]);\r\n widthsData.push(widths[j++]);\r\n }\r\n\r\n // middle sector\r\n const widthL = widths[halfCount / 2];\r\n const widthU = widths[halfCount / 2 + 1];\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(widthU);\r\n widthsData.push(widthL);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n widthsData.push(widths[i++]);\r\n widthsData.push(widths[i++]);\r\n\r\n if (i === widths.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const widthsectorLength = widths.length / ((pointCount - 1) * 2);\r\n for (let x = 0; x < pointCount; x++) {\r\n const i = Math.floor(j);\r\n\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n\r\n j += widthsectorLength;\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < widths.length; i++) {\r\n widthsData.push(widths[i]);\r\n }\r\n }\r\n\r\n return widthsData;\r\n}\r\n\r\n/**\r\n * Completes the color table/fill the missing color entries. It means it creates a color entry for every point of the line mesh.\r\n * You can provide more points the colors when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMesColorhDistribution.REPEAT - the color table will be repeatedly copied to the empty values [c1, c2] = [c1, c2, c1, c2, c1, c2, c1, c2]\r\n * GreasedLineMesColorhDistribution.EVEN - the color table will be evenly copied to the empty values [c1, c2] = [c1, c1, c1, c1, c2, c2, c2, c2]\r\n * GreasedLineMesColorhDistribution.START - the color table will be copied at the start of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, dc, dc]\r\n * GreasedLineMesColorhDistribution.START_END - the color table will be copied at the start and the end of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, c1, c2]\r\n * @param pointCount number of points of the line mesh\r\n * @param colors array of Color3 for the color table\r\n * @param colorDistribution how to distribute colors if the colors array has fewer entries than pointCount\r\n * @param defaultColor default color to be used to fill empty entries in the color table\r\n * @returns completed array of Color3s\r\n */\r\nexport function CompleteGreasedLineColorTable(pointCount: number, colors: Color3[], colorDistribution: GreasedLineMeshColorDistribution, defaultColor: Color3): Color3[] {\r\n pointCount = Math.max(colors.length, pointCount);\r\n const missingCount = pointCount - colors.length;\r\n if (missingCount < 0) {\r\n return colors.slice(0, pointCount);\r\n }\r\n\r\n const colorsData: Color3[] = [];\r\n // is the color table shorter than the point table?\r\n if (missingCount > 0) {\r\n // it is, fill in the missing elements\r\n if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(colors.length / 2);\r\n\r\n // start sector\r\n for (let i = 0; i < halfCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // middle sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n colorsData.push(colors[i]);\r\n\r\n i++;\r\n\r\n if (i === colors.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const colorSectorLength = colors.length / (pointCount - 1);\r\n for (let x = 0; x < pointCount - 1; x++) {\r\n const i = Math.floor(j);\r\n\r\n colorsData.push(colors[i]);\r\n\r\n j += colorSectorLength;\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < pointCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n\r\n return colorsData;\r\n}\r\n"]}
@@ -63,6 +63,7 @@ export declare function CreateTiledGroundVertexData(options: {
63
63
  * @param options.bufferWidth the width of image
64
64
  * @param options.bufferHeight the height of image
65
65
  * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)
66
+ * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.
66
67
  * @returns the VertexData of the Ground designed from a heightmap
67
68
  */
68
69
  export declare function CreateGroundFromHeightMapVertexData(options: {
@@ -76,6 +77,7 @@ export declare function CreateGroundFromHeightMapVertexData(options: {
76
77
  bufferWidth: number;
77
78
  bufferHeight: number;
78
79
  alphaFilter: number;
80
+ heightBuffer?: Float32Array;
79
81
  }): VertexData;
80
82
  /**
81
83
  * Creates a ground mesh
@@ -150,6 +152,7 @@ export declare function CreateTiledGround(name: string, options: {
150
152
  * @param options.updatable defines if the mesh must be flagged as updatable
151
153
  * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)
152
154
  * @param options.onError is a javascript callback function that will be called if there is an error
155
+ * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.
153
156
  * @param scene defines the hosting scene
154
157
  * @returns the ground mesh
155
158
  * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map
@@ -168,8 +171,9 @@ export declare function CreateGroundFromHeightMap(name: string, url: string | {
168
171
  colorFilter?: Color3;
169
172
  alphaFilter?: number;
170
173
  updatable?: boolean;
171
- onReady?: (mesh: GroundMesh) => void;
174
+ onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;
172
175
  onError?: (message?: string, exception?: any) => void;
176
+ passHeightBufferInCallback?: boolean;
173
177
  }, scene?: Nullable<Scene>): GroundMesh;
174
178
  /**
175
179
  * Class containing static functions to help procedurally build meshes
@@ -144,6 +144,7 @@ export function CreateTiledGroundVertexData(options) {
144
144
  * @param options.bufferWidth the width of image
145
145
  * @param options.bufferHeight the height of image
146
146
  * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)
147
+ * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.
147
148
  * @returns the VertexData of the Ground designed from a heightmap
148
149
  */
149
150
  export function CreateGroundFromHeightMapVertexData(options) {
@@ -187,6 +188,10 @@ export function CreateGroundFromHeightMapVertexData(options) {
187
188
  else {
188
189
  position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.
189
190
  }
191
+ if (options.heightBuffer) {
192
+ // set the height buffer information in row major order.
193
+ options.heightBuffer[row * (options.subdivisions + 1) + col] = position.y;
194
+ }
190
195
  // Add vertex
191
196
  positions.push(position.x, position.y, position.z);
192
197
  normals.push(0, 0, 0);
@@ -302,6 +307,7 @@ export function CreateTiledGround(name, options, scene = null) {
302
307
  * @param options.updatable defines if the mesh must be flagged as updatable
303
308
  * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)
304
309
  * @param options.onError is a javascript callback function that will be called if there is an error
310
+ * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.
305
311
  * @param scene defines the hosting scene
306
312
  * @returns the ground mesh
307
313
  * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map
@@ -328,6 +334,10 @@ export function CreateGroundFromHeightMap(name, url, options = {}, scene = null)
328
334
  ground._minX = -ground._maxX;
329
335
  ground._minZ = -ground._maxZ;
330
336
  ground._setReady(false);
337
+ let heightBuffer;
338
+ if (options.passHeightBufferInCallback) {
339
+ heightBuffer = new Float32Array((subdivisions + 1) * (subdivisions + 1));
340
+ }
331
341
  const onBufferLoaded = (buffer, bufferWidth, bufferHeight) => {
332
342
  const vertexData = CreateGroundFromHeightMapVertexData({
333
343
  width: width,
@@ -340,11 +350,12 @@ export function CreateGroundFromHeightMap(name, url, options = {}, scene = null)
340
350
  bufferWidth: bufferWidth,
341
351
  bufferHeight: bufferHeight,
342
352
  alphaFilter: alphaFilter,
353
+ heightBuffer,
343
354
  });
344
355
  vertexData.applyToMesh(ground, updatable);
345
356
  //execute ready callback, if set
346
357
  if (onReady) {
347
- onReady(ground);
358
+ onReady(ground, heightBuffer);
348
359
  }
349
360
  ground._setReady(true);
350
361
  };
@@ -355,7 +366,7 @@ export function CreateGroundFromHeightMap(name, url, options = {}, scene = null)
355
366
  if (scene.isDisposed) {
356
367
  return;
357
368
  }
358
- const buffer = scene === null || scene === void 0 ? void 0 : scene.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);
369
+ const buffer = scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);
359
370
  onBufferLoaded(buffer, bufferWidth, bufferHeight);
360
371
  };
361
372
  Tools.LoadImage(url, onload, options.onError ? options.onError : () => { }, scene.offlineProvider);
@@ -1 +1 @@
1
- {"version":3,"file":"groundBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/groundBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAmH;IACtJ,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,IAAI,GAAW,EAAE,GAAW,CAAC;IAE7B,MAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IACzC,MAAM,MAAM,GAAW,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAW,CAAC,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACvF,MAAM,aAAa,GAAW,CAA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AoB,EAAE,KAAa,EAAE,SAAmB,EAAQ,EAAE;IAChI,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;KACZ,CAAC;IAEF,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,IAAI,CAAC,iBAAiB,GAAG,CACrB,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,IAAY,EACZ,YAAsC,EACtC,SAAmC,EACnC,KAAY,EACZ,SAAmB,EACf,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,SAAS;KACZ,CAAC;IAEF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAI,CAAC,yBAAyB,GAAG,CAC7B,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,KAAY,EACZ,SAAmB,EACnB,OAAoC,EACpC,WAAoB,EACV,EAAE;IACZ,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;QACT,SAAS;QACT,SAAS;QACT,OAAO;QACP,WAAW;KACd,CAAC;IAEF,OAAO,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { GroundMesh } from \"../groundMesh\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * @param options.width the width (x direction) of the ground, optional, default 1\r\n * @param options.height the height (z direction) of the ground, optional, default 1\r\n * @param options.subdivisions the number of subdivisions per side, optional, default 1\r\n * @param options.subdivisionsX the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined\r\n * @param options.subdivisionsY the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number }): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row: number, col: number;\r\n\r\n const width: number = options.width || 1;\r\n const height: number = options.height || 1;\r\n const subdivisionsX: number = (options.subdivisionsX || options.subdivisions || 1) | 0;\r\n const subdivisionsY: number = (options.subdivisionsY || options.subdivisions || 1) | 0;\r\n\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\r\n const normal = new Vector3(0, 1.0, 0);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, CompatibilityOptions.UseOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground\r\n * @param options.xmin ground minimum X coordinate, default -1\r\n * @param options.zmin ground minimum Z coordinate, default -1\r\n * @param options.xmax ground maximum X coordinate, default 1\r\n * @param options.zmax ground maximum Z coordinate, default 1\r\n * @param options.subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @returns the VertexData of the TiledGround\r\n */\r\nexport function CreateTiledGroundVertexData(options: {\r\n xmin: number;\r\n zmin: number;\r\n xmax: number;\r\n zmax: number;\r\n subdivisions?: { w: number; h: number };\r\n precision?: { w: number; h: number };\r\n}): VertexData {\r\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\r\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\r\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\r\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\r\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n const precision = options.precision || { w: 1, h: 1 };\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n let row: number, col: number, tileRow: number, tileCol: number;\r\n\r\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\r\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\r\n precision.w = precision.w < 1 ? 1 : precision.w;\r\n precision.h = precision.h < 1 ? 1 : precision.h;\r\n\r\n const tileSize = {\r\n w: (xmax - xmin) / subdivisions.w,\r\n h: (zmax - zmin) / subdivisions.h,\r\n };\r\n\r\n function applyTile(xTileMin: number, zTileMin: number, xTileMax: number, zTileMax: number) {\r\n // Indices\r\n const base = positions.length / 3;\r\n const rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\r\n\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n\r\n // Position, normals and uvs\r\n const position = Vector3.Zero();\r\n const normal = new Vector3(0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\r\n * @param options.width the width (x direction) of the ground\r\n * @param options.height the height (z direction) of the ground\r\n * @param options.subdivisions the number of subdivisions per side\r\n * @param options.minHeight the minimum altitude on the ground, optional, default 0\r\n * @param options.maxHeight the maximum altitude on the ground, optional default 1\r\n * @param options.colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * @param options.buffer the array holding the image color data\r\n * @param options.bufferWidth the width of image\r\n * @param options.bufferHeight the height of image\r\n * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\nexport function CreateGroundFromHeightMapVertexData(options: {\r\n width: number;\r\n height: number;\r\n subdivisions: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n colorFilter: Color3;\r\n buffer: Uint8Array;\r\n bufferWidth: number;\r\n bufferHeight: number;\r\n alphaFilter: number;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row, col;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n let invert = false;\r\n\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n const temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n const position = new Vector3(\r\n (col * options.width) / options.subdivisions - options.width / 2.0,\r\n 0,\r\n ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0\r\n );\r\n\r\n // Compute height\r\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n\r\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n let r = options.buffer[pos] / 255.0;\r\n let g = options.buffer[pos + 1] / 255.0;\r\n let b = options.buffer[pos + 2] / 255.0;\r\n const a = options.buffer[pos + 3] / 255.0;\r\n\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n\r\n const gradient = r * filter.r + g * filter.g + b * filter.b;\r\n\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n } else {\r\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\r\n }\r\n\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\r\n const idx2 = col + 1 + row * (options.subdivisions + 1);\r\n const idx3 = col + row * (options.subdivisions + 1);\r\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\r\n\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n\r\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.width set the width size (float, default 1)\r\n * @param options.height set the height size (float, default 1)\r\n * @param options.subdivisions sets the number of subdivision per side (default 1)\r\n * @param options.subdivisionsX sets the number of subdivision on the X axis (overrides subdivisions)\r\n * @param options.subdivisionsY sets the number of subdivision on the Y axis (overrides subdivisions)\r\n * @param options.updatable defines if the mesh must be flagged as updatable (default false)\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\r\n */\r\nexport function CreateGround(\r\n name: string,\r\n options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean } = {},\r\n scene?: Scene\r\n): GroundMesh {\r\n const ground = new GroundMesh(name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(ground, options.updatable);\r\n\r\n ground._setReady(true);\r\n\r\n return ground;\r\n}\r\n\r\n/**\r\n * Creates a tiled ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.xmin ground minimum X coordinate (float, default -1)\r\n * @param options.zmin ground minimum Z coordinate (float, default -1)\r\n * @param options.xmax ground maximum X coordinate (float, default 1)\r\n * @param options.zmax ground maximum Z coordinate (float, default 1)\r\n * @param options.subdivisions a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @param options.updatable boolean, default false, true if the mesh must be flagged as updatable\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\r\n */\r\nexport function CreateTiledGround(\r\n name: string,\r\n options: { xmin: number; zmin: number; xmax: number; zmax: number; subdivisions?: { w: number; h: number }; precision?: { w: number; h: number }; updatable?: boolean },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const tiledGround = new Mesh(name, scene);\r\n\r\n const vertexData = CreateTiledGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n\r\n return tiledGround;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh from a height map. The height map download can take some frames,\r\n * so the mesh is not immediately ready. To wait for the mesh to be completely built,\r\n * you should use the `onReady` callback option.\r\n * @param name defines the name of the mesh\r\n * @param url sets the URL of the height map image resource.\r\n * @param options defines the options used to create the mesh\r\n * @param options.width sets the ground width size (positive float, default 10)\r\n * @param options.height sets the ground height size (positive float, default 10)\r\n * @param options.subdivisions sets the number of subdivision per side (positive integer, default 1)\r\n * @param options.minHeight is the minimum altitude on the ground (float, default 0)\r\n * @param options.maxHeight is the maximum altitude on the ground (float, default 1)\r\n * @param options.colorFilter is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )\r\n * @param options.alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.updatable defines if the mesh must be flagged as updatable\r\n * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)\r\n * @param options.onError is a javascript callback function that will be called if there is an error\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\r\n */\r\nexport function CreateGroundFromHeightMap(\r\n name: string,\r\n url: string | { data: Uint8Array; width: number; height: number },\r\n options: {\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n minHeight?: number;\r\n maxHeight?: number;\r\n colorFilter?: Color3;\r\n alphaFilter?: number;\r\n updatable?: boolean;\r\n onReady?: (mesh: GroundMesh) => void;\r\n onError?: (message?: string, exception?: any) => void;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): GroundMesh {\r\n const width = options.width || 10.0;\r\n const height = options.height || 10.0;\r\n const subdivisions = options.subdivisions || 1 | 0;\r\n const minHeight = options.minHeight || 0.0;\r\n const maxHeight = options.maxHeight || 1.0;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n const updatable = options.updatable;\r\n const onReady = options.onReady;\r\n\r\n scene = scene || EngineStore.LastCreatedScene!;\r\n\r\n const ground = new GroundMesh(name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n ground._setReady(false);\r\n\r\n const onBufferLoaded = (buffer: Uint8Array, bufferWidth: number, bufferHeight: number) => {\r\n const vertexData = CreateGroundFromHeightMapVertexData({\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n colorFilter: filter,\r\n buffer: buffer,\r\n bufferWidth: bufferWidth,\r\n bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter,\r\n });\r\n\r\n vertexData.applyToMesh(ground, updatable);\r\n\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n if (typeof url === \"string\") {\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n const bufferWidth = img.width;\r\n const bufferHeight = img.height;\r\n\r\n if (scene!.isDisposed) {\r\n return;\r\n }\r\n\r\n const buffer = <Uint8Array>scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\r\n onBufferLoaded(buffer, bufferWidth, bufferHeight);\r\n };\r\n\r\n Tools.LoadImage(url, onload, options.onError ? options.onError : () => {}, scene.offlineProvider);\r\n } else {\r\n onBufferLoaded(url.data, url.width, url.height);\r\n }\r\n\r\n return ground;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const GroundBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGround,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGroundFromHeightMap,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledGround,\r\n};\r\n\r\nVertexData.CreateGround = CreateGroundVertexData;\r\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\r\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\r\n\r\nMesh.CreateGround = (name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n updatable,\r\n };\r\n\r\n return CreateGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateTiledGround = (\r\n name: string,\r\n xmin: number,\r\n zmin: number,\r\n xmax: number,\r\n zmax: number,\r\n subdivisions: { w: number; h: number },\r\n precision: { w: number; h: number },\r\n scene: Scene,\r\n updatable?: boolean\r\n): Mesh => {\r\n const options = {\r\n xmin,\r\n zmin,\r\n xmax,\r\n zmax,\r\n subdivisions,\r\n precision,\r\n updatable,\r\n };\r\n\r\n return CreateTiledGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateGroundFromHeightMap = (\r\n name: string,\r\n url: string,\r\n width: number,\r\n height: number,\r\n subdivisions: number,\r\n minHeight: number,\r\n maxHeight: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n onReady?: (mesh: GroundMesh) => void,\r\n alphaFilter?: number\r\n): GroundMesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n minHeight,\r\n maxHeight,\r\n updatable,\r\n onReady,\r\n alphaFilter,\r\n };\r\n\r\n return CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n"]}
1
+ {"version":3,"file":"groundBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/groundBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD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EACZ,YAAsC,EACtC,SAAmC,EACnC,KAAY,EACZ,SAAmB,EACf,EAAE;IACN,MAAM,OAAO,GAAG;QACZ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,SAAS;KACZ,CAAC;IAEF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAI,CAAC,yBAAyB,GAAG,CAC7B,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,KAAY,EACZ,SAAmB,EACnB,OAAoC,EACpC,WAAoB,EACV,EAAE;IACZ,MAAM,OAAO,GAAG;QACZ,KAAK;QACL,MAAM;QACN,YAAY;QACZ,SAAS;QACT,SAAS;QACT,SAAS;QACT,OAAO;QACP,WAAW;KACd,CAAC;IAEF,OAAO,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { GroundMesh } from \"../groundMesh\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\n\r\n/**\r\n * Creates the VertexData for a Ground\r\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\r\n * @param options.width the width (x direction) of the ground, optional, default 1\r\n * @param options.height the height (z direction) of the ground, optional, default 1\r\n * @param options.subdivisions the number of subdivisions per side, optional, default 1\r\n * @param options.subdivisionsX the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined\r\n * @param options.subdivisionsY the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined\r\n * @returns the VertexData of the Ground\r\n */\r\nexport function CreateGroundVertexData(options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number }): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row: number, col: number;\r\n\r\n const width: number = options.width || 1;\r\n const height: number = options.height || 1;\r\n const subdivisionsX: number = (options.subdivisionsX || options.subdivisions || 1) | 0;\r\n const subdivisionsY: number = (options.subdivisionsY || options.subdivisions || 1) | 0;\r\n\r\n for (row = 0; row <= subdivisionsY; row++) {\r\n for (col = 0; col <= subdivisionsX; col++) {\r\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\r\n const normal = new Vector3(0, 1.0, 0);\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / subdivisionsX, CompatibilityOptions.UseOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\r\n }\r\n }\r\n\r\n for (row = 0; row < subdivisionsY; row++) {\r\n for (col = 0; col < subdivisionsX; col++) {\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + row * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n\r\n indices.push(col + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\r\n indices.push(col + row * (subdivisionsX + 1));\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\r\n * @param options an object used to set the following optional parameters for the Ground\r\n * @param options.xmin ground minimum X coordinate, default -1\r\n * @param options.zmin ground minimum Z coordinate, default -1\r\n * @param options.xmax ground maximum X coordinate, default 1\r\n * @param options.zmax ground maximum Z coordinate, default 1\r\n * @param options.subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @returns the VertexData of the TiledGround\r\n */\r\nexport function CreateTiledGroundVertexData(options: {\r\n xmin: number;\r\n zmin: number;\r\n xmax: number;\r\n zmax: number;\r\n subdivisions?: { w: number; h: number };\r\n precision?: { w: number; h: number };\r\n}): VertexData {\r\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\r\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\r\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\r\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\r\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\r\n const precision = options.precision || { w: 1, h: 1 };\r\n\r\n const indices: number[] = [];\r\n const positions: number[] = [];\r\n const normals: number[] = [];\r\n const uvs: number[] = [];\r\n let row: number, col: number, tileRow: number, tileCol: number;\r\n\r\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\r\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\r\n precision.w = precision.w < 1 ? 1 : precision.w;\r\n precision.h = precision.h < 1 ? 1 : precision.h;\r\n\r\n const tileSize = {\r\n w: (xmax - xmin) / subdivisions.w,\r\n h: (zmax - zmin) / subdivisions.h,\r\n };\r\n\r\n function applyTile(xTileMin: number, zTileMin: number, xTileMax: number, zTileMax: number) {\r\n // Indices\r\n const base = positions.length / 3;\r\n const rowLength = precision.w + 1;\r\n for (row = 0; row < precision.h; row++) {\r\n for (col = 0; col < precision.w; col++) {\r\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\r\n\r\n indices.push(square[1]);\r\n indices.push(square[2]);\r\n indices.push(square[3]);\r\n indices.push(square[0]);\r\n indices.push(square[1]);\r\n indices.push(square[3]);\r\n }\r\n }\r\n\r\n // Position, normals and uvs\r\n const position = Vector3.Zero();\r\n const normal = new Vector3(0, 1.0, 0);\r\n for (row = 0; row <= precision.h; row++) {\r\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\r\n for (col = 0; col <= precision.w; col++) {\r\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\r\n position.y = 0;\r\n\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(normal.x, normal.y, normal.z);\r\n uvs.push(col / precision.w, row / precision.h);\r\n }\r\n }\r\n }\r\n\r\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\r\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\r\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\r\n }\r\n }\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the VertexData of the Ground designed from a heightmap\r\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\r\n * @param options.width the width (x direction) of the ground\r\n * @param options.height the height (z direction) of the ground\r\n * @param options.subdivisions the number of subdivisions per side\r\n * @param options.minHeight the minimum altitude on the ground, optional, default 0\r\n * @param options.maxHeight the maximum altitude on the ground, optional default 1\r\n * @param options.colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\r\n * @param options.buffer the array holding the image color data\r\n * @param options.bufferWidth the width of image\r\n * @param options.bufferHeight the height of image\r\n * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.\r\n * @returns the VertexData of the Ground designed from a heightmap\r\n */\r\nexport function CreateGroundFromHeightMapVertexData(options: {\r\n width: number;\r\n height: number;\r\n subdivisions: number;\r\n minHeight: number;\r\n maxHeight: number;\r\n colorFilter: Color3;\r\n buffer: Uint8Array;\r\n bufferWidth: number;\r\n bufferHeight: number;\r\n alphaFilter: number;\r\n heightBuffer?: Float32Array;\r\n}): VertexData {\r\n const indices = [];\r\n const positions = [];\r\n const normals = [];\r\n const uvs = [];\r\n let row, col;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n let invert = false;\r\n\r\n if (options.minHeight > options.maxHeight) {\r\n invert = true;\r\n const temp = options.maxHeight;\r\n options.maxHeight = options.minHeight;\r\n options.minHeight = temp;\r\n }\r\n\r\n // Vertices\r\n for (row = 0; row <= options.subdivisions; row++) {\r\n for (col = 0; col <= options.subdivisions; col++) {\r\n const position = new Vector3(\r\n (col * options.width) / options.subdivisions - options.width / 2.0,\r\n 0,\r\n ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0\r\n );\r\n\r\n // Compute height\r\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\r\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\r\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\r\n let r = options.buffer[pos] / 255.0;\r\n let g = options.buffer[pos + 1] / 255.0;\r\n let b = options.buffer[pos + 2] / 255.0;\r\n const a = options.buffer[pos + 3] / 255.0;\r\n\r\n if (invert) {\r\n r = 1.0 - r;\r\n g = 1.0 - g;\r\n b = 1.0 - b;\r\n }\r\n\r\n const gradient = r * filter.r + g * filter.g + b * filter.b;\r\n\r\n // If our alpha channel is not within our filter then we will assign a 'special' height\r\n // Then when building the indices, we will ignore any vertex that is using the special height\r\n if (a >= alphaFilter) {\r\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\r\n } else {\r\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\r\n }\r\n if (options.heightBuffer) {\r\n // set the height buffer information in row major order.\r\n options.heightBuffer[row * (options.subdivisions + 1) + col] = position.y;\r\n }\r\n\r\n // Add vertex\r\n positions.push(position.x, position.y, position.z);\r\n normals.push(0, 0, 0);\r\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\r\n }\r\n }\r\n\r\n // Indices\r\n for (row = 0; row < options.subdivisions; row++) {\r\n for (col = 0; col < options.subdivisions; col++) {\r\n // Calculate Indices\r\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\r\n const idx2 = col + 1 + row * (options.subdivisions + 1);\r\n const idx3 = col + row * (options.subdivisions + 1);\r\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\r\n\r\n // Check that all indices are visible (based on our special height)\r\n // Only display the vertex if all Indices are visible\r\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\r\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\r\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\r\n indices.push(idx1);\r\n indices.push(idx2);\r\n indices.push(idx3);\r\n }\r\n\r\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\r\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\r\n indices.push(idx4);\r\n indices.push(idx1);\r\n indices.push(idx3);\r\n }\r\n }\r\n }\r\n\r\n // Normals\r\n VertexData.ComputeNormals(positions, indices, normals);\r\n\r\n // Result\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.width set the width size (float, default 1)\r\n * @param options.height set the height size (float, default 1)\r\n * @param options.subdivisions sets the number of subdivision per side (default 1)\r\n * @param options.subdivisionsX sets the number of subdivision on the X axis (overrides subdivisions)\r\n * @param options.subdivisionsY sets the number of subdivision on the Y axis (overrides subdivisions)\r\n * @param options.updatable defines if the mesh must be flagged as updatable (default false)\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\r\n */\r\nexport function CreateGround(\r\n name: string,\r\n options: { width?: number; height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean } = {},\r\n scene?: Scene\r\n): GroundMesh {\r\n const ground = new GroundMesh(name, scene);\r\n ground._setReady(false);\r\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\r\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\r\n ground._width = options.width || 1;\r\n ground._height = options.height || 1;\r\n ground._maxX = ground._width / 2;\r\n ground._maxZ = ground._height / 2;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n const vertexData = CreateGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(ground, options.updatable);\r\n\r\n ground._setReady(true);\r\n\r\n return ground;\r\n}\r\n\r\n/**\r\n * Creates a tiled ground mesh\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param options.xmin ground minimum X coordinate (float, default -1)\r\n * @param options.zmin ground minimum Z coordinate (float, default -1)\r\n * @param options.xmax ground maximum X coordinate (float, default 1)\r\n * @param options.zmax ground maximum Z coordinate (float, default 1)\r\n * @param options.subdivisions a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\r\n * @param options.subdivisions.w positive integer, default 6\r\n * @param options.subdivisions.h positive integer, default 6\r\n * @param options.precision a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\r\n * @param options.precision.w positive integer, default 2\r\n * @param options.precision.h positive integer, default 2\r\n * @param options.updatable boolean, default false, true if the mesh must be flagged as updatable\r\n * @param scene defines the hosting scene\r\n * @returns the tiled ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\r\n */\r\nexport function CreateTiledGround(\r\n name: string,\r\n options: { xmin: number; zmin: number; xmax: number; zmax: number; subdivisions?: { w: number; h: number }; precision?: { w: number; h: number }; updatable?: boolean },\r\n scene: Nullable<Scene> = null\r\n): Mesh {\r\n const tiledGround = new Mesh(name, scene);\r\n\r\n const vertexData = CreateTiledGroundVertexData(options);\r\n\r\n vertexData.applyToMesh(tiledGround, options.updatable);\r\n\r\n return tiledGround;\r\n}\r\n\r\n/**\r\n * Creates a ground mesh from a height map. The height map download can take some frames,\r\n * so the mesh is not immediately ready. To wait for the mesh to be completely built,\r\n * you should use the `onReady` callback option.\r\n * @param name defines the name of the mesh\r\n * @param url sets the URL of the height map image resource.\r\n * @param options defines the options used to create the mesh\r\n * @param options.width sets the ground width size (positive float, default 10)\r\n * @param options.height sets the ground height size (positive float, default 10)\r\n * @param options.subdivisions sets the number of subdivision per side (positive integer, default 1)\r\n * @param options.minHeight is the minimum altitude on the ground (float, default 0)\r\n * @param options.maxHeight is the maximum altitude on the ground (float, default 1)\r\n * @param options.colorFilter is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )\r\n * @param options.alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\r\n * @param options.updatable defines if the mesh must be flagged as updatable\r\n * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)\r\n * @param options.onError is a javascript callback function that will be called if there is an error\r\n * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.\r\n * @param scene defines the hosting scene\r\n * @returns the ground mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\r\n */\r\nexport function CreateGroundFromHeightMap(\r\n name: string,\r\n url: string | { data: Uint8Array; width: number; height: number },\r\n options: {\r\n width?: number;\r\n height?: number;\r\n subdivisions?: number;\r\n minHeight?: number;\r\n maxHeight?: number;\r\n colorFilter?: Color3;\r\n alphaFilter?: number;\r\n updatable?: boolean;\r\n onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;\r\n onError?: (message?: string, exception?: any) => void;\r\n passHeightBufferInCallback?: boolean;\r\n } = {},\r\n scene: Nullable<Scene> = null\r\n): GroundMesh {\r\n const width = options.width || 10.0;\r\n const height = options.height || 10.0;\r\n const subdivisions = options.subdivisions || 1 | 0;\r\n const minHeight = options.minHeight || 0.0;\r\n const maxHeight = options.maxHeight || 1.0;\r\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\r\n const alphaFilter = options.alphaFilter || 0.0;\r\n const updatable = options.updatable;\r\n const onReady = options.onReady;\r\n\r\n scene = scene || EngineStore.LastCreatedScene!;\r\n\r\n const ground = new GroundMesh(name, scene);\r\n ground._subdivisionsX = subdivisions;\r\n ground._subdivisionsY = subdivisions;\r\n ground._width = width;\r\n ground._height = height;\r\n ground._maxX = ground._width / 2.0;\r\n ground._maxZ = ground._height / 2.0;\r\n ground._minX = -ground._maxX;\r\n ground._minZ = -ground._maxZ;\r\n\r\n ground._setReady(false);\r\n\r\n let heightBuffer: Float32Array;\r\n if (options.passHeightBufferInCallback) {\r\n heightBuffer = new Float32Array((subdivisions + 1) * (subdivisions + 1));\r\n }\r\n\r\n const onBufferLoaded = (buffer: Uint8Array, bufferWidth: number, bufferHeight: number) => {\r\n const vertexData = CreateGroundFromHeightMapVertexData({\r\n width: width,\r\n height: height,\r\n subdivisions: subdivisions,\r\n minHeight: minHeight,\r\n maxHeight: maxHeight,\r\n colorFilter: filter,\r\n buffer: buffer,\r\n bufferWidth: bufferWidth,\r\n bufferHeight: bufferHeight,\r\n alphaFilter: alphaFilter,\r\n heightBuffer,\r\n });\r\n\r\n vertexData.applyToMesh(ground, updatable);\r\n\r\n //execute ready callback, if set\r\n if (onReady) {\r\n onReady(ground, heightBuffer);\r\n }\r\n\r\n ground._setReady(true);\r\n };\r\n\r\n if (typeof url === \"string\") {\r\n const onload = (img: HTMLImageElement | ImageBitmap) => {\r\n const bufferWidth = img.width;\r\n const bufferHeight = img.height;\r\n\r\n if (scene!.isDisposed) {\r\n return;\r\n }\r\n\r\n const buffer = <Uint8Array>scene?.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\r\n\r\n onBufferLoaded(buffer, bufferWidth, bufferHeight);\r\n };\r\n\r\n Tools.LoadImage(url, onload, options.onError ? options.onError : () => {}, scene.offlineProvider);\r\n } else {\r\n onBufferLoaded(url.data, url.width, url.height);\r\n }\r\n\r\n return ground;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const GroundBuilder = {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGround,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateGroundFromHeightMap,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n CreateTiledGround,\r\n};\r\n\r\nVertexData.CreateGround = CreateGroundVertexData;\r\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\r\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\r\n\r\nMesh.CreateGround = (name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n updatable,\r\n };\r\n\r\n return CreateGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateTiledGround = (\r\n name: string,\r\n xmin: number,\r\n zmin: number,\r\n xmax: number,\r\n zmax: number,\r\n subdivisions: { w: number; h: number },\r\n precision: { w: number; h: number },\r\n scene: Scene,\r\n updatable?: boolean\r\n): Mesh => {\r\n const options = {\r\n xmin,\r\n zmin,\r\n xmax,\r\n zmax,\r\n subdivisions,\r\n precision,\r\n updatable,\r\n };\r\n\r\n return CreateTiledGround(name, options, scene);\r\n};\r\n\r\nMesh.CreateGroundFromHeightMap = (\r\n name: string,\r\n url: string,\r\n width: number,\r\n height: number,\r\n subdivisions: number,\r\n minHeight: number,\r\n maxHeight: number,\r\n scene: Scene,\r\n updatable?: boolean,\r\n onReady?: (mesh: GroundMesh) => void,\r\n alphaFilter?: number\r\n): GroundMesh => {\r\n const options = {\r\n width,\r\n height,\r\n subdivisions,\r\n minHeight,\r\n maxHeight,\r\n updatable,\r\n onReady,\r\n alphaFilter,\r\n };\r\n\r\n return CreateGroundFromHeightMap(name, url, options, scene);\r\n};\r\n"]}
@@ -176,7 +176,6 @@ export function CreateText(name, text, fontData, options = {
176
176
  resolution: 8,
177
177
  depth: 1.0,
178
178
  }, scene = null, earcutInjection = earcut) {
179
- var _a, _b;
180
179
  // First we need to generate the paths
181
180
  const shapePaths = CreateTextShapePaths(text, options.size || 50, options.resolution || 8, fontData);
182
181
  // And extrude them
@@ -232,8 +231,8 @@ export function CreateText(name, text, fontData, options = {
232
231
  shape: shapeVectors,
233
232
  holes: holeVectors.length ? holeVectors : undefined,
234
233
  depth: options.depth || 1.0,
235
- faceUV: options.faceUV || ((_a = options.perLetterFaceUV) === null || _a === void 0 ? void 0 : _a.call(options, letterIndex)),
236
- faceColors: options.faceColors || ((_b = options.perLetterFaceColors) === null || _b === void 0 ? void 0 : _b.call(options, letterIndex)),
234
+ faceUV: options.faceUV || options.perLetterFaceUV?.(letterIndex),
235
+ faceColors: options.faceColors || options.perLetterFaceColors?.(letterIndex),
237
236
  sideOrientation: Mesh._GetDefaultSideOrientation(options.sideOrientation || Mesh.DOUBLESIDE),
238
237
  }, scene, earcutInjection);
239
238
  meshes.push(mesh);
@@ -1 +1 @@
1
- {"version":3,"file":"textBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/textBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIlD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwClD,kBAAkB;AAClB,MAAM,SAAS;IAOX;;OAEG;IACH,YAAY,UAAkB;QATtB,WAAM,GAAY,EAAE,CAAC;QACrB,eAAU,GAAY,EAAE,CAAC;QACzB,WAAM,GAAY,EAAE,CAAC;QAQzB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,YAAY,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,GAAW,EAAE,GAAW,E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GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,6BAA6B;QACzH,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAEpB,gBAAgB;QAChB,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChD,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAChC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;QAEvB,OAAO,CAAC,gCAAgC,EAAE,CAAC;QAE3C,mBAAmB;QACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,OAAO,EAAE,CAAC;KACnB;IAED,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import type { Color4 } from \"../../Maths/math.color\";\r\nimport { Path2 } from \"../../Maths/math.path\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { TransformNode } from \"../transformNode\";\r\nimport { ExtrudePolygon } from \"./polygonBuilder\";\r\n\r\ndeclare let earcut: any;\r\n\r\n/**\r\n * Parser inspired by https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FontLoader.js\r\n */\r\n\r\n// Interfaces\r\n\r\n/**\r\n * Represents glyph data generated by http://gero3.github.io/facetype.js/\r\n */\r\nexport interface IGlyphData {\r\n /** Commands used to draw (line, move, curve, etc..) */\r\n o: string;\r\n\r\n /** Width */\r\n ha: number;\r\n}\r\n\r\n/**\r\n * Represents font data generated by http://gero3.github.io/facetype.js/\r\n */\r\nexport interface IFontData {\r\n /**\r\n * Font resolution\r\n */\r\n resolution: number;\r\n /** Underline tickness */\r\n underlineThickness: number;\r\n /** Bounding box */\r\n boundingBox: {\r\n yMax: number;\r\n yMin: number;\r\n };\r\n /** List of supported glyphs */\r\n glyphs: { [key: string]: IGlyphData };\r\n}\r\n\r\n// Shape functions\r\nclass ShapePath {\r\n private _paths: Path2[] = [];\r\n private _tempPaths: Path2[] = [];\r\n private _holes: Path2[] = [];\r\n private _currentPath: Path2;\r\n private _resolution: number;\r\n\r\n /** Create the ShapePath used to support glyphs\r\n * @param resolution defines the resolution used to determine the number of points per curve (default is 4)\r\n */\r\n constructor(resolution: number) {\r\n this._resolution = resolution;\r\n }\r\n\r\n /** Move the virtual cursor to a coordinate\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n */\r\n moveTo(x: number, y: number) {\r\n this._currentPath = new Path2(x, y);\r\n this._tempPaths.push(this._currentPath);\r\n }\r\n\r\n /** Draw a line from the virtual cursor to a given coordinate\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n */\r\n lineTo(x: number, y: number) {\r\n this._currentPath.addLineTo(x, y);\r\n }\r\n\r\n /** Create a quadratic curve from the virtual cursor to a given coordinate\r\n * @param cpx defines the x coordinate of the control point\r\n * @param cpy defines the y coordinate of the control point\r\n * @param x defines the x coordinate of the end point\r\n * @param y defines the y coordinate of the end point\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number) {\r\n this._currentPath.addQuadraticCurveTo(cpx, cpy, x, y, this._resolution);\r\n }\r\n\r\n /**\r\n * Create a bezier curve from the virtual cursor to a given coordinate\r\n * @param cpx1 defines the x coordinate of the first control point\r\n * @param cpy1 defines the y coordinate of the first control point\r\n * @param cpx2 defines the x coordinate of the second control point\r\n * @param cpy2 defines the y coordinate of the second control point\r\n * @param x defines the x coordinate of the end point\r\n * @param y defines the y coordinate of the end point\r\n */\r\n bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number) {\r\n this._currentPath.addBezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y, this._resolution);\r\n }\r\n\r\n /** Extract holes based on CW / CCW */\r\n extractHoles() {\r\n for (const path of this._tempPaths) {\r\n if (path.area() > 0) {\r\n this._holes.push(path);\r\n } else {\r\n this._paths.push(path);\r\n }\r\n }\r\n\r\n if (!this._paths.length && this._holes.length) {\r\n const temp = this._holes;\r\n this._holes = this._paths;\r\n this._paths = temp;\r\n }\r\n\r\n this._tempPaths.length = 0;\r\n }\r\n\r\n /** Gets the list of paths */\r\n get paths() {\r\n return this._paths;\r\n }\r\n\r\n /** Gets the list of holes */\r\n get holes() {\r\n return this._holes;\r\n }\r\n}\r\n\r\n// Utility functions\r\nfunction CreateShapePath(\r\n char: string,\r\n scale: number,\r\n offsetX: number,\r\n offsetY: number,\r\n resolution: number,\r\n fontData: IFontData\r\n): Nullable<{\r\n offsetX: number;\r\n shapePath: ShapePath;\r\n}> {\r\n const glyph = fontData.glyphs[char] || fontData.glyphs[\"?\"];\r\n\r\n if (!glyph) {\r\n // return if there is no glyph data\r\n return null;\r\n }\r\n\r\n const shapePath = new ShapePath(resolution);\r\n\r\n if (glyph.o) {\r\n const outline = glyph.o.split(\" \");\r\n\r\n for (let i = 0, l = outline.length; i < l; ) {\r\n const action = outline[i++];\r\n\r\n switch (action) {\r\n case \"m\": {\r\n // moveTo\r\n const x = parseInt(outline[i++]) * scale + offsetX;\r\n const y = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.moveTo(x, y);\r\n break;\r\n }\r\n case \"l\": {\r\n // lineTo\r\n const x = parseInt(outline[i++]) * scale + offsetX;\r\n const y = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.lineTo(x, y);\r\n break;\r\n }\r\n case \"q\": {\r\n // quadraticCurveTo\r\n const cpx = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.quadraticCurveTo(cpx1, cpy1, cpx, cpy);\r\n break;\r\n }\r\n case \"b\": {\r\n // bezierCurveTo\r\n const cpx = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx2 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy2 = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Extract holes (based on clockwise data)\r\n shapePath.extractHoles();\r\n\r\n return { offsetX: glyph.ha * scale, shapePath: shapePath };\r\n}\r\n\r\n/**\r\n * Creates shape paths from a text and font\r\n * @param text the 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 * @returns array of ShapePath objects\r\n */\r\nexport function CreateTextShapePaths(text: string, size: number, resolution: number, fontData: IFontData) {\r\n const chars = Array.from(text);\r\n const scale = size / fontData.resolution;\r\n const line_height = (fontData.boundingBox.yMax - fontData.boundingBox.yMin + fontData.underlineThickness) * scale;\r\n\r\n const shapePaths: ShapePath[] = [];\r\n\r\n let offsetX = 0,\r\n offsetY = 0;\r\n\r\n for (let i = 0; i < chars.length; i++) {\r\n const char = chars[i];\r\n\r\n if (char === \"\\n\") {\r\n offsetX = 0;\r\n offsetY -= line_height;\r\n } else {\r\n const ret = CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData);\r\n\r\n if (ret) {\r\n offsetX += ret.offsetX;\r\n shapePaths.push(ret.shapePath);\r\n }\r\n }\r\n }\r\n\r\n return shapePaths;\r\n}\r\n\r\n/**\r\n * Create a text mesh\r\n * @param name defines the name of the mesh\r\n * @param text defines the text to use to build the mesh\r\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\r\n * @param options defines options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/text\r\n */\r\nexport function CreateText(\r\n name: string,\r\n text: string,\r\n fontData: IFontData,\r\n options: {\r\n size?: number;\r\n resolution?: number;\r\n depth?: number;\r\n sideOrientation?: number;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n perLetterFaceUV?: (letterIndex: number) => Vector4[];\r\n perLetterFaceColors?: (letterIndex: number) => Color4[];\r\n } = {\r\n size: 50,\r\n resolution: 8,\r\n depth: 1.0,\r\n },\r\n scene: Nullable<Scene> = null,\r\n earcutInjection = earcut\r\n): Nullable<Mesh> {\r\n // First we need to generate the paths\r\n const shapePaths = CreateTextShapePaths(text, options.size || 50, options.resolution || 8, fontData);\r\n\r\n // And extrude them\r\n const meshes: Mesh[] = [];\r\n let letterIndex = 0;\r\n for (const shapePath of shapePaths) {\r\n if (!shapePath.paths.length) {\r\n continue;\r\n }\r\n\r\n const holes = shapePath.holes.slice(); // Copy it as we will update the copy\r\n for (const path of shapePath.paths) {\r\n const holeVectors: Vector3[][] = [];\r\n const shapeVectors: Vector3[] = [];\r\n const points = path.getPoints();\r\n for (const point of points) {\r\n shapeVectors.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n\r\n // Holes\r\n const localHolesCopy = holes.slice();\r\n for (const hole of localHolesCopy) {\r\n const points = hole.getPoints();\r\n\r\n let found = false;\r\n for (const point of points) {\r\n if (path.isPointInside(point)) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n continue;\r\n }\r\n\r\n const holePoints: Vector3[] = [];\r\n for (const point of points) {\r\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n holeVectors.push(holePoints);\r\n\r\n // Remove the hole as it was already used\r\n holes.splice(holes.indexOf(hole), 1);\r\n }\r\n\r\n // There is at least a hole but it was unaffected\r\n if (!holeVectors.length && holes.length) {\r\n for (const hole of holes) {\r\n const points = hole.getPoints();\r\n const holePoints: Vector3[] = [];\r\n for (const point of points) {\r\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n holeVectors.push(holePoints);\r\n }\r\n }\r\n\r\n // Extrusion!\r\n const mesh = ExtrudePolygon(\r\n name,\r\n {\r\n shape: shapeVectors,\r\n holes: holeVectors.length ? holeVectors : undefined,\r\n depth: options.depth || 1.0,\r\n faceUV: options.faceUV || options.perLetterFaceUV?.(letterIndex),\r\n faceColors: options.faceColors || options.perLetterFaceColors?.(letterIndex),\r\n sideOrientation: Mesh._GetDefaultSideOrientation(options.sideOrientation || Mesh.DOUBLESIDE),\r\n },\r\n scene,\r\n earcutInjection\r\n );\r\n meshes.push(mesh);\r\n letterIndex++;\r\n }\r\n }\r\n\r\n // Then we can merge everyone into one single mesh\r\n const newMesh = Mesh.MergeMeshes(meshes, true, true);\r\n\r\n if (newMesh) {\r\n // Move pivot to desired center / bottom / center position\r\n const bbox = newMesh.getBoundingInfo().boundingBox;\r\n newMesh.position.x += -(bbox.minimumWorld.x + bbox.maximumWorld.x) / 2; // Mid X\r\n newMesh.position.y += -(bbox.minimumWorld.y + bbox.maximumWorld.y) / 2; // Mid Z as it will rotate\r\n newMesh.position.z += -(bbox.minimumWorld.z + bbox.maximumWorld.z) / 2 + bbox.extendSize.z; // Bottom Y as it will rotate\r\n newMesh.name = name;\r\n\r\n // Rotate 90° Up\r\n const pivot = new TransformNode(\"pivot\", scene);\r\n pivot.rotation.x = -Math.PI / 2;\r\n newMesh.parent = pivot;\r\n\r\n newMesh.bakeCurrentTransformIntoVertices();\r\n\r\n // Remove the pivot\r\n newMesh.parent = null;\r\n pivot.dispose();\r\n }\r\n\r\n return newMesh;\r\n}\r\n"]}
1
+ {"version":3,"file":"textBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/textBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,K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,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,OAAO,EAAE,CAAC;KACnB;IAED,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import type { Color4 } from \"../../Maths/math.color\";\r\nimport { Path2 } from \"../../Maths/math.path\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Vector4 } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { TransformNode } from \"../transformNode\";\r\nimport { ExtrudePolygon } from \"./polygonBuilder\";\r\n\r\ndeclare let earcut: any;\r\n\r\n/**\r\n * Parser inspired by https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FontLoader.js\r\n */\r\n\r\n// Interfaces\r\n\r\n/**\r\n * Represents glyph data generated by http://gero3.github.io/facetype.js/\r\n */\r\nexport interface IGlyphData {\r\n /** Commands used to draw (line, move, curve, etc..) */\r\n o: string;\r\n\r\n /** Width */\r\n ha: number;\r\n}\r\n\r\n/**\r\n * Represents font data generated by http://gero3.github.io/facetype.js/\r\n */\r\nexport interface IFontData {\r\n /**\r\n * Font resolution\r\n */\r\n resolution: number;\r\n /** Underline tickness */\r\n underlineThickness: number;\r\n /** Bounding box */\r\n boundingBox: {\r\n yMax: number;\r\n yMin: number;\r\n };\r\n /** List of supported glyphs */\r\n glyphs: { [key: string]: IGlyphData };\r\n}\r\n\r\n// Shape functions\r\nclass ShapePath {\r\n private _paths: Path2[] = [];\r\n private _tempPaths: Path2[] = [];\r\n private _holes: Path2[] = [];\r\n private _currentPath: Path2;\r\n private _resolution: number;\r\n\r\n /** Create the ShapePath used to support glyphs\r\n * @param resolution defines the resolution used to determine the number of points per curve (default is 4)\r\n */\r\n constructor(resolution: number) {\r\n this._resolution = resolution;\r\n }\r\n\r\n /** Move the virtual cursor to a coordinate\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n */\r\n moveTo(x: number, y: number) {\r\n this._currentPath = new Path2(x, y);\r\n this._tempPaths.push(this._currentPath);\r\n }\r\n\r\n /** Draw a line from the virtual cursor to a given coordinate\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n */\r\n lineTo(x: number, y: number) {\r\n this._currentPath.addLineTo(x, y);\r\n }\r\n\r\n /** Create a quadratic curve from the virtual cursor to a given coordinate\r\n * @param cpx defines the x coordinate of the control point\r\n * @param cpy defines the y coordinate of the control point\r\n * @param x defines the x coordinate of the end point\r\n * @param y defines the y coordinate of the end point\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number) {\r\n this._currentPath.addQuadraticCurveTo(cpx, cpy, x, y, this._resolution);\r\n }\r\n\r\n /**\r\n * Create a bezier curve from the virtual cursor to a given coordinate\r\n * @param cpx1 defines the x coordinate of the first control point\r\n * @param cpy1 defines the y coordinate of the first control point\r\n * @param cpx2 defines the x coordinate of the second control point\r\n * @param cpy2 defines the y coordinate of the second control point\r\n * @param x defines the x coordinate of the end point\r\n * @param y defines the y coordinate of the end point\r\n */\r\n bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number) {\r\n this._currentPath.addBezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y, this._resolution);\r\n }\r\n\r\n /** Extract holes based on CW / CCW */\r\n extractHoles() {\r\n for (const path of this._tempPaths) {\r\n if (path.area() > 0) {\r\n this._holes.push(path);\r\n } else {\r\n this._paths.push(path);\r\n }\r\n }\r\n\r\n if (!this._paths.length && this._holes.length) {\r\n const temp = this._holes;\r\n this._holes = this._paths;\r\n this._paths = temp;\r\n }\r\n\r\n this._tempPaths.length = 0;\r\n }\r\n\r\n /** Gets the list of paths */\r\n get paths() {\r\n return this._paths;\r\n }\r\n\r\n /** Gets the list of holes */\r\n get holes() {\r\n return this._holes;\r\n }\r\n}\r\n\r\n// Utility functions\r\nfunction CreateShapePath(\r\n char: string,\r\n scale: number,\r\n offsetX: number,\r\n offsetY: number,\r\n resolution: number,\r\n fontData: IFontData\r\n): Nullable<{\r\n offsetX: number;\r\n shapePath: ShapePath;\r\n}> {\r\n const glyph = fontData.glyphs[char] || fontData.glyphs[\"?\"];\r\n\r\n if (!glyph) {\r\n // return if there is no glyph data\r\n return null;\r\n }\r\n\r\n const shapePath = new ShapePath(resolution);\r\n\r\n if (glyph.o) {\r\n const outline = glyph.o.split(\" \");\r\n\r\n for (let i = 0, l = outline.length; i < l; ) {\r\n const action = outline[i++];\r\n\r\n switch (action) {\r\n case \"m\": {\r\n // moveTo\r\n const x = parseInt(outline[i++]) * scale + offsetX;\r\n const y = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.moveTo(x, y);\r\n break;\r\n }\r\n case \"l\": {\r\n // lineTo\r\n const x = parseInt(outline[i++]) * scale + offsetX;\r\n const y = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.lineTo(x, y);\r\n break;\r\n }\r\n case \"q\": {\r\n // quadraticCurveTo\r\n const cpx = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.quadraticCurveTo(cpx1, cpy1, cpx, cpy);\r\n break;\r\n }\r\n case \"b\": {\r\n // bezierCurveTo\r\n const cpx = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\r\n const cpx2 = parseInt(outline[i++]) * scale + offsetX;\r\n const cpy2 = parseInt(outline[i++]) * scale + offsetY;\r\n\r\n shapePath.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Extract holes (based on clockwise data)\r\n shapePath.extractHoles();\r\n\r\n return { offsetX: glyph.ha * scale, shapePath: shapePath };\r\n}\r\n\r\n/**\r\n * Creates shape paths from a text and font\r\n * @param text the 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 * @returns array of ShapePath objects\r\n */\r\nexport function CreateTextShapePaths(text: string, size: number, resolution: number, fontData: IFontData) {\r\n const chars = Array.from(text);\r\n const scale = size / fontData.resolution;\r\n const line_height = (fontData.boundingBox.yMax - fontData.boundingBox.yMin + fontData.underlineThickness) * scale;\r\n\r\n const shapePaths: ShapePath[] = [];\r\n\r\n let offsetX = 0,\r\n offsetY = 0;\r\n\r\n for (let i = 0; i < chars.length; i++) {\r\n const char = chars[i];\r\n\r\n if (char === \"\\n\") {\r\n offsetX = 0;\r\n offsetY -= line_height;\r\n } else {\r\n const ret = CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData);\r\n\r\n if (ret) {\r\n offsetX += ret.offsetX;\r\n shapePaths.push(ret.shapePath);\r\n }\r\n }\r\n }\r\n\r\n return shapePaths;\r\n}\r\n\r\n/**\r\n * Create a text mesh\r\n * @param name defines the name of the mesh\r\n * @param text defines the text to use to build the mesh\r\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\r\n * @param options defines options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @param earcutInjection can be used to inject your own earcut reference\r\n * @returns a new Mesh\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/text\r\n */\r\nexport function CreateText(\r\n name: string,\r\n text: string,\r\n fontData: IFontData,\r\n options: {\r\n size?: number;\r\n resolution?: number;\r\n depth?: number;\r\n sideOrientation?: number;\r\n faceUV?: Vector4[];\r\n faceColors?: Color4[];\r\n perLetterFaceUV?: (letterIndex: number) => Vector4[];\r\n perLetterFaceColors?: (letterIndex: number) => Color4[];\r\n } = {\r\n size: 50,\r\n resolution: 8,\r\n depth: 1.0,\r\n },\r\n scene: Nullable<Scene> = null,\r\n earcutInjection = earcut\r\n): Nullable<Mesh> {\r\n // First we need to generate the paths\r\n const shapePaths = CreateTextShapePaths(text, options.size || 50, options.resolution || 8, fontData);\r\n\r\n // And extrude them\r\n const meshes: Mesh[] = [];\r\n let letterIndex = 0;\r\n for (const shapePath of shapePaths) {\r\n if (!shapePath.paths.length) {\r\n continue;\r\n }\r\n\r\n const holes = shapePath.holes.slice(); // Copy it as we will update the copy\r\n for (const path of shapePath.paths) {\r\n const holeVectors: Vector3[][] = [];\r\n const shapeVectors: Vector3[] = [];\r\n const points = path.getPoints();\r\n for (const point of points) {\r\n shapeVectors.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n\r\n // Holes\r\n const localHolesCopy = holes.slice();\r\n for (const hole of localHolesCopy) {\r\n const points = hole.getPoints();\r\n\r\n let found = false;\r\n for (const point of points) {\r\n if (path.isPointInside(point)) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n continue;\r\n }\r\n\r\n const holePoints: Vector3[] = [];\r\n for (const point of points) {\r\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n holeVectors.push(holePoints);\r\n\r\n // Remove the hole as it was already used\r\n holes.splice(holes.indexOf(hole), 1);\r\n }\r\n\r\n // There is at least a hole but it was unaffected\r\n if (!holeVectors.length && holes.length) {\r\n for (const hole of holes) {\r\n const points = hole.getPoints();\r\n const holePoints: Vector3[] = [];\r\n for (const point of points) {\r\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\r\n }\r\n holeVectors.push(holePoints);\r\n }\r\n }\r\n\r\n // Extrusion!\r\n const mesh = ExtrudePolygon(\r\n name,\r\n {\r\n shape: shapeVectors,\r\n holes: holeVectors.length ? holeVectors : undefined,\r\n depth: options.depth || 1.0,\r\n faceUV: options.faceUV || options.perLetterFaceUV?.(letterIndex),\r\n faceColors: options.faceColors || options.perLetterFaceColors?.(letterIndex),\r\n sideOrientation: Mesh._GetDefaultSideOrientation(options.sideOrientation || Mesh.DOUBLESIDE),\r\n },\r\n scene,\r\n earcutInjection\r\n );\r\n meshes.push(mesh);\r\n letterIndex++;\r\n }\r\n }\r\n\r\n // Then we can merge everyone into one single mesh\r\n const newMesh = Mesh.MergeMeshes(meshes, true, true);\r\n\r\n if (newMesh) {\r\n // Move pivot to desired center / bottom / center position\r\n const bbox = newMesh.getBoundingInfo().boundingBox;\r\n newMesh.position.x += -(bbox.minimumWorld.x + bbox.maximumWorld.x) / 2; // Mid X\r\n newMesh.position.y += -(bbox.minimumWorld.y + bbox.maximumWorld.y) / 2; // Mid Z as it will rotate\r\n newMesh.position.z += -(bbox.minimumWorld.z + bbox.maximumWorld.z) / 2 + bbox.extendSize.z; // Bottom Y as it will rotate\r\n newMesh.name = name;\r\n\r\n // Rotate 90° Up\r\n const pivot = new TransformNode(\"pivot\", scene);\r\n pivot.rotation.x = -Math.PI / 2;\r\n newMesh.parent = pivot;\r\n\r\n newMesh.bakeCurrentTransformIntoVertices();\r\n\r\n // Remove the pivot\r\n newMesh.parent = null;\r\n pivot.dispose();\r\n }\r\n\r\n return newMesh;\r\n}\r\n"]}