@babylonjs/core 7.11.4 → 7.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (513) hide show
  1. package/Actions/abstractActionManager.d.ts +1 -1
  2. package/Actions/abstractActionManager.js +1 -1
  3. package/Actions/abstractActionManager.js.map +1 -1
  4. package/Animations/animation.js +1 -2
  5. package/Animations/animation.js.map +1 -1
  6. package/Animations/animationGroupMask.d.ts +1 -1
  7. package/Animations/animationGroupMask.js +2 -2
  8. package/Animations/animationGroupMask.js.map +1 -1
  9. package/Animations/animationKey.d.ts +1 -1
  10. package/Animations/animationKey.js.map +1 -1
  11. package/Behaviors/Meshes/handConstraintBehavior.d.ts +3 -3
  12. package/Behaviors/Meshes/handConstraintBehavior.js +16 -17
  13. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  14. package/Behaviors/Meshes/sixDofDragBehavior.js +2 -3
  15. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  16. package/Bones/bone.js +31 -32
  17. package/Bones/bone.js.map +1 -1
  18. package/Bones/boneIKController.js +5 -6
  19. package/Bones/boneIKController.js.map +1 -1
  20. package/Bones/boneLookController.js +13 -13
  21. package/Bones/boneLookController.js.map +1 -1
  22. package/Cameras/Inputs/freeCameraMouseWheelInput.js +5 -6
  23. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  24. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +5 -5
  25. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
  26. package/Cameras/VR/vrExperienceHelper.js +8 -10
  27. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  28. package/Compute/computeEffect.js +2 -3
  29. package/Compute/computeEffect.js.map +1 -1
  30. package/Compute/computeShader.js +19 -20
  31. package/Compute/computeShader.js.map +1 -1
  32. package/Culling/Helper/IBoundingInfoHelperPlatform.d.ts +4 -0
  33. package/Culling/Helper/IBoundingInfoHelperPlatform.js.map +1 -1
  34. package/Culling/Helper/boundingInfoHelper.d.ts +26 -4
  35. package/Culling/Helper/boundingInfoHelper.js +41 -10
  36. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  37. package/Culling/Helper/computeShaderBoundingHelper.d.ts +12 -3
  38. package/Culling/Helper/computeShaderBoundingHelper.js +164 -76
  39. package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
  40. package/Culling/Helper/transformFeedbackBoundingHelper.d.ts +11 -0
  41. package/Culling/Helper/transformFeedbackBoundingHelper.js +46 -14
  42. package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
  43. package/Debug/debugLayer.d.ts +1 -1
  44. package/Debug/debugLayer.js.map +1 -1
  45. package/Decorators/nodeDecorator.d.ts +1 -1
  46. package/Decorators/nodeDecorator.js +1 -1
  47. package/Decorators/nodeDecorator.js.map +1 -1
  48. package/DeviceInput/InputDevices/deviceEnums.d.ts +5 -5
  49. package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
  50. package/DeviceInput/eventFactory.js +3 -3
  51. package/DeviceInput/eventFactory.js.map +1 -1
  52. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +2 -2
  53. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
  54. package/Engines/Extensions/engine.computeShader.d.ts +1 -1
  55. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  56. package/Engines/Extensions/engine.cubeTexture.js +2 -2
  57. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  58. package/Engines/Extensions/engine.dynamicTexture.js +2 -2
  59. package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
  60. package/Engines/Extensions/engine.multiRender.js +3 -3
  61. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  62. package/Engines/Extensions/engine.multiview.js +2 -2
  63. package/Engines/Extensions/engine.multiview.js.map +1 -1
  64. package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -3
  65. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  66. package/Engines/Extensions/engine.rawTexture.js +4 -4
  67. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  68. package/Engines/Extensions/engine.renderTarget.js +3 -3
  69. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  70. package/Engines/Extensions/engine.renderTargetCube.js +2 -2
  71. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  72. package/Engines/Native/nativeShaderProcessors.js +1 -2
  73. package/Engines/Native/nativeShaderProcessors.js.map +1 -1
  74. package/Engines/Processors/shaderProcessor.js +2 -3
  75. package/Engines/Processors/shaderProcessor.js.map +1 -1
  76. package/Engines/WebGL/webGL2ShaderProcessors.js +1 -2
  77. package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
  78. package/Engines/WebGL/webGLShaderProcessors.js +1 -2
  79. package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
  80. package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -2
  81. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  82. package/Engines/WebGPU/Extensions/engine.cubeTexture.js +2 -2
  83. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  84. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -2
  85. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  86. package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -2
  87. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  88. package/Engines/WebGPU/Extensions/engine.rawTexture.js +5 -5
  89. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  90. package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
  91. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  92. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +2 -2
  93. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  94. package/Engines/WebGPU/webgpuBufferManager.js +1 -1
  95. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  96. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +81 -82
  97. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  98. package/Engines/WebGPU/webgpuCacheSampler.js +60 -64
  99. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  100. package/Engines/WebGPU/webgpuClearQuad.js +1 -2
  101. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  102. package/Engines/WebGPU/webgpuComputeContext.js +13 -15
  103. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  104. package/Engines/WebGPU/webgpuConstants.d.ts +39 -39
  105. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  106. package/Engines/WebGPU/webgpuHardwareTexture.js +6 -8
  107. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  108. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -2
  109. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  110. package/Engines/WebGPU/webgpuQuerySet.js +3 -3
  111. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  112. package/Engines/WebGPU/webgpuShaderProcessor.js +15 -19
  113. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  114. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +8 -10
  115. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  116. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +26 -28
  117. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  118. package/Engines/WebGPU/webgpuTextureHelper.js +413 -416
  119. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  120. package/Engines/WebGPU/webgpuTextureManager.js +50 -51
  121. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  122. package/Engines/WebGPU/webgpuTimestampQuery.js +1 -2
  123. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  124. package/Engines/abstractEngine.js +4 -4
  125. package/Engines/abstractEngine.js.map +1 -1
  126. package/Engines/engine.js +2 -2
  127. package/Engines/engine.js.map +1 -1
  128. package/Engines/nativeEngine.js +9 -9
  129. package/Engines/nativeEngine.js.map +1 -1
  130. package/Engines/nullEngine.js +5 -5
  131. package/Engines/nullEngine.js.map +1 -1
  132. package/Engines/renderTargetWrapper.js +1 -2
  133. package/Engines/renderTargetWrapper.js.map +1 -1
  134. package/Engines/shaderStore.js +6 -7
  135. package/Engines/shaderStore.js.map +1 -1
  136. package/Engines/thinEngine.js +4 -5
  137. package/Engines/thinEngine.js.map +1 -1
  138. package/Engines/webgpuEngine.d.ts +11 -0
  139. package/Engines/webgpuEngine.js +91 -72
  140. package/Engines/webgpuEngine.js.map +1 -1
  141. package/Events/deviceInputEvents.d.ts +1 -1
  142. package/Events/deviceInputEvents.js.map +1 -1
  143. package/FlowGraph/flowGraph.d.ts +1 -1
  144. package/FlowGraph/flowGraph.js +5 -5
  145. package/FlowGraph/flowGraph.js.map +1 -1
  146. package/FlowGraph/flowGraphBlock.js +2 -3
  147. package/FlowGraph/flowGraphBlock.js.map +1 -1
  148. package/FlowGraph/flowGraphConnection.d.ts +1 -1
  149. package/FlowGraph/flowGraphConnection.js.map +1 -1
  150. package/FlowGraph/flowGraphDataConnection.js +3 -3
  151. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  152. package/FlowGraph/flowGraphExecutionBlock.js +2 -3
  153. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  154. package/FlowGraph/flowGraphSignalConnection.js +3 -3
  155. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  156. package/Gamepads/dualShockGamepad.d.ts +2 -2
  157. package/Gamepads/dualShockGamepad.js +14 -14
  158. package/Gamepads/dualShockGamepad.js.map +1 -1
  159. package/Gamepads/xboxGamepad.d.ts +2 -2
  160. package/Gamepads/xboxGamepad.js +14 -14
  161. package/Gamepads/xboxGamepad.js.map +1 -1
  162. package/Gizmos/gizmo.d.ts +2 -2
  163. package/Gizmos/gizmo.js +4 -4
  164. package/Gizmos/gizmo.js.map +1 -1
  165. package/Gizmos/gizmoManager.js +2 -2
  166. package/Gizmos/gizmoManager.js.map +1 -1
  167. package/Gizmos/scaleGizmo.js +3 -3
  168. package/Gizmos/scaleGizmo.js.map +1 -1
  169. package/Loading/sceneLoader.d.ts +1 -1
  170. package/Loading/sceneLoader.js +6 -6
  171. package/Loading/sceneLoader.js.map +1 -1
  172. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +3 -3
  173. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
  174. package/Materials/GreasedLine/greasedLinePluginMaterial.js +10 -11
  175. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  176. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +8 -9
  177. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  178. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +3 -4
  179. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  180. package/Materials/Node/Blocks/Dual/fogBlock.js +2 -3
  181. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  182. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
  183. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  184. package/Materials/Node/Blocks/Dual/lightBlock.js +5 -6
  185. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  186. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -5
  187. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  188. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -8
  189. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  190. package/Materials/Node/Blocks/Dual/textureBlock.js +4 -6
  191. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  192. package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -4
  193. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  194. package/Materials/Node/Blocks/Fragment/derivativeBlock.js +1 -2
  195. package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
  196. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -2
  197. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  198. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +1 -2
  199. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +5 -6
  201. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  202. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -2
  203. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  204. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +5 -6
  205. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +3 -4
  207. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  208. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +7 -9
  209. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  210. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -2
  211. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/Input/inputBlock.js +19 -21
  213. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  214. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +3 -4
  215. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  216. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -3
  217. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  218. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +4 -5
  219. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  220. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
  221. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  222. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -29
  223. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  224. package/Materials/Node/Blocks/PBR/reflectionBlock.js +4 -5
  225. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  226. package/Materials/Node/Blocks/PBR/refractionBlock.js +5 -6
  227. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  228. package/Materials/Node/Blocks/PBR/sheenBlock.js +4 -5
  229. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  230. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +2 -3
  231. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  232. package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -2
  233. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  234. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -2
  235. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  236. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +1 -2
  237. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  238. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -2
  239. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  240. package/Materials/Node/Blocks/arcTan2Block.js +1 -2
  241. package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
  242. package/Materials/Node/Blocks/biPlanarBlock.js +3 -4
  243. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  244. package/Materials/Node/Blocks/clampBlock.js +4 -5
  245. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  246. package/Materials/Node/Blocks/cloudBlock.js +3 -4
  247. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  248. package/Materials/Node/Blocks/curveBlock.js +1 -2
  249. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  250. package/Materials/Node/Blocks/customBlock.js +1 -2
  251. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  252. package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -2
  253. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  254. package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +1 -1
  255. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +35 -35
  256. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  257. package/Materials/Node/Blocks/modBlock.js +1 -2
  258. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  259. package/Materials/Node/Blocks/remapBlock.js +3 -3
  260. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  261. package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -2
  262. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  263. package/Materials/Node/Blocks/transformBlock.js +1 -2
  264. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  265. package/Materials/Node/Blocks/triPlanarBlock.js +10 -12
  266. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  267. package/Materials/Node/Blocks/voronoiNoiseBlock.js +3 -4
  268. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  269. package/Materials/Node/Blocks/waveBlock.d.ts +1 -1
  270. package/Materials/Node/Blocks/waveBlock.js +4 -4
  271. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  272. package/Materials/Node/Blocks/worleyNoise3DBlock.js +3 -4
  273. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  274. package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.d.ts +1 -1
  275. package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js.map +1 -1
  276. package/Materials/Node/nodeMaterial.js +3 -4
  277. package/Materials/Node/nodeMaterial.js.map +1 -1
  278. package/Materials/Node/nodeMaterialBlock.js +5 -6
  279. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  280. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -2
  281. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +10 -10
  282. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  283. package/Materials/Node/nodeMaterialBuildState.js +18 -19
  284. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  285. package/Materials/Node/nodeMaterialConnectionPointCustomObject.js +3 -3
  286. package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
  287. package/Materials/PBR/pbrBaseMaterial.js +3 -4
  288. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  289. package/Materials/Textures/internalTexture.d.ts +1 -1
  290. package/Materials/Textures/internalTexture.js +13 -13
  291. package/Materials/Textures/internalTexture.js.map +1 -1
  292. package/Materials/Textures/ktx2decoderTypes.d.ts +1 -1
  293. package/Materials/Textures/ktx2decoderTypes.js.map +1 -1
  294. package/Materials/Textures/rawCubeTexture.js +1 -2
  295. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  296. package/Materials/effect.functions.js +2 -3
  297. package/Materials/effect.functions.js.map +1 -1
  298. package/Materials/effect.js +3 -4
  299. package/Materials/effect.js.map +1 -1
  300. package/Materials/effect.webgl.functions.js +1 -2
  301. package/Materials/effect.webgl.functions.js.map +1 -1
  302. package/Materials/material.js +7 -9
  303. package/Materials/material.js.map +1 -1
  304. package/Materials/materialPluginEvent.d.ts +1 -1
  305. package/Materials/materialPluginEvent.js.map +1 -1
  306. package/Materials/materialPluginManager.js +9 -11
  307. package/Materials/materialPluginManager.js.map +1 -1
  308. package/Materials/meshDebugPluginMaterial.d.ts +1 -1
  309. package/Materials/meshDebugPluginMaterial.js +2 -2
  310. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  311. package/Materials/shaderLanguage.d.ts +1 -1
  312. package/Materials/shaderLanguage.js.map +1 -1
  313. package/Materials/shadowDepthWrapper.js +1 -2
  314. package/Materials/shadowDepthWrapper.js.map +1 -1
  315. package/Materials/standardMaterial.js +2 -3
  316. package/Materials/standardMaterial.js.map +1 -1
  317. package/Maths/math.axis.d.ts +2 -2
  318. package/Maths/math.axis.js.map +1 -1
  319. package/Maths/math.path.d.ts +1 -1
  320. package/Maths/math.path.js +3 -3
  321. package/Maths/math.path.js.map +1 -1
  322. package/Meshes/Builders/greasedLineBuilder.d.ts +2 -2
  323. package/Meshes/Builders/greasedLineBuilder.js +21 -23
  324. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  325. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +3 -3
  326. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  327. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +14 -14
  328. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  329. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +2 -2
  330. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  331. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +2 -2
  332. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  333. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +3 -3
  334. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  335. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +3 -3
  336. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  337. package/Meshes/Node/Blocks/Set/setColorsBlock.js +2 -2
  338. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  339. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +2 -2
  340. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  341. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +2 -2
  342. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  343. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +2 -2
  344. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  345. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +2 -2
  346. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  347. package/Meshes/Node/Blocks/Set/setUVsBlock.js +3 -3
  348. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  349. package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -2
  350. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  351. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -2
  352. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  353. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -2
  354. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  355. package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
  356. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  357. package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -2
  358. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  359. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -2
  360. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  361. package/Meshes/Node/Blocks/Sources/meshBlock.js +2 -2
  362. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  363. package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -2
  364. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  365. package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -2
  366. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  367. package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
  368. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  369. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +2 -2
  370. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  371. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +2 -2
  372. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  373. package/Meshes/Node/Blocks/booleanGeometryBlock.js +3 -3
  374. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  375. package/Meshes/Node/Blocks/conditionBlock.js +2 -2
  376. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  377. package/Meshes/Node/Blocks/geometryClampBlock.js +3 -3
  378. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  379. package/Meshes/Node/Blocks/geometryCollectionBlock.js +2 -2
  380. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  381. package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -2
  382. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  383. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
  384. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  385. package/Meshes/Node/Blocks/geometryTransformBlock.js +2 -2
  386. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  387. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -2
  388. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  389. package/Meshes/Node/Blocks/mappingBlock.js +2 -2
  390. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  391. package/Meshes/Node/Blocks/mathBlock.js +2 -2
  392. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  393. package/Meshes/Node/Blocks/mergeGeometryBlock.js +2 -2
  394. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  395. package/Meshes/Node/Blocks/randomBlock.js +2 -2
  396. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  397. package/Meshes/Node/nodeGeometryBlock.js +3 -3
  398. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  399. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -2
  400. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -7
  401. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  402. package/Meshes/abstractMesh.js +4 -5
  403. package/Meshes/abstractMesh.js.map +1 -1
  404. package/Meshes/mesh.js +1 -2
  405. package/Meshes/mesh.js.map +1 -1
  406. package/Meshes/meshSimplification.d.ts +1 -1
  407. package/Meshes/meshSimplification.js +1 -1
  408. package/Meshes/meshSimplification.js.map +1 -1
  409. package/Meshes/meshSimplificationSceneComponent.js +2 -2
  410. package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
  411. package/Meshes/transformNode.js +7 -8
  412. package/Meshes/transformNode.js.map +1 -1
  413. package/Misc/assetsManager.d.ts +1 -1
  414. package/Misc/assetsManager.js +9 -9
  415. package/Misc/assetsManager.js.map +1 -1
  416. package/Misc/basis.js +2 -2
  417. package/Misc/basis.js.map +1 -1
  418. package/Misc/copyTextureToTexture.d.ts +1 -1
  419. package/Misc/copyTextureToTexture.js +1 -1
  420. package/Misc/copyTextureToTexture.js.map +1 -1
  421. package/Misc/environmentTextureTools.js +3 -3
  422. package/Misc/environmentTextureTools.js.map +1 -1
  423. package/Misc/iInspectable.d.ts +1 -1
  424. package/Misc/iInspectable.js.map +1 -1
  425. package/Misc/khronosTextureContainer2.js +2 -2
  426. package/Misc/khronosTextureContainer2.js.map +1 -1
  427. package/Misc/timer.d.ts +1 -1
  428. package/Misc/timer.js +5 -5
  429. package/Misc/timer.js.map +1 -1
  430. package/Misc/virtualJoystick.d.ts +1 -1
  431. package/Misc/virtualJoystick.js +16 -16
  432. package/Misc/virtualJoystick.js.map +1 -1
  433. package/Particles/particleSystem.js +3 -3
  434. package/Particles/particleSystem.js.map +1 -1
  435. package/Particles/particleSystemComponent.js +1 -2
  436. package/Particles/particleSystemComponent.js.map +1 -1
  437. package/Particles/pointsCloudSystem.d.ts +1 -1
  438. package/Particles/pointsCloudSystem.js +14 -14
  439. package/Particles/pointsCloudSystem.js.map +1 -1
  440. package/Particles/subEmitter.d.ts +1 -1
  441. package/Particles/subEmitter.js +1 -1
  442. package/Particles/subEmitter.js.map +1 -1
  443. package/Physics/physicsHelper.d.ts +2 -2
  444. package/Physics/physicsHelper.js +6 -7
  445. package/Physics/physicsHelper.js.map +1 -1
  446. package/Physics/v1/physicsImpostor.js +4 -5
  447. package/Physics/v1/physicsImpostor.js.map +1 -1
  448. package/Physics/v2/IPhysicsEnginePlugin.d.ts +16 -8
  449. package/Physics/v2/IPhysicsEnginePlugin.js +9 -0
  450. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  451. package/Physics/v2/Plugins/havokPlugin.js +96 -79
  452. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  453. package/Physics/v2/physicsAggregate.js +8 -9
  454. package/Physics/v2/physicsAggregate.js.map +1 -1
  455. package/Physics/v2/physicsBody.d.ts +14 -2
  456. package/Physics/v2/physicsBody.js +30 -11
  457. package/Physics/v2/physicsBody.js.map +1 -1
  458. package/Physics/v2/physicsConstraint.js +8 -9
  459. package/Physics/v2/physicsConstraint.js.map +1 -1
  460. package/Physics/v2/physicsMaterial.d.ts +1 -1
  461. package/Physics/v2/physicsMaterial.js.map +1 -1
  462. package/Physics/v2/physicsShape.js +9 -10
  463. package/Physics/v2/physicsShape.js.map +1 -1
  464. package/Physics/v2/ragdoll.js +11 -12
  465. package/Physics/v2/ragdoll.js.map +1 -1
  466. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -2
  467. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  468. package/PostProcesses/depthOfFieldEffect.d.ts +1 -1
  469. package/PostProcesses/depthOfFieldEffect.js +3 -3
  470. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  471. package/PostProcesses/postProcess.js +2 -3
  472. package/PostProcesses/postProcess.js.map +1 -1
  473. package/PostProcesses/tonemapPostProcess.d.ts +1 -1
  474. package/PostProcesses/tonemapPostProcess.js +4 -4
  475. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  476. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +1 -1
  477. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +10 -10
  478. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  479. package/Shaders/spriteMap.fragment.js +3 -2
  480. package/Shaders/spriteMap.fragment.js.map +1 -1
  481. package/ShadersWGSL/boundingInfo.compute.js +8 -8
  482. package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
  483. package/XR/features/WebXRDepthSensing.js +2 -2
  484. package/XR/features/WebXRDepthSensing.js.map +1 -1
  485. package/XR/features/WebXRHandTracking.d.ts +2 -2
  486. package/XR/features/WebXRHandTracking.js +76 -76
  487. package/XR/features/WebXRHandTracking.js.map +1 -1
  488. package/XR/features/WebXRLightEstimation.js +2 -2
  489. package/XR/features/WebXRLightEstimation.js.map +1 -1
  490. package/XR/features/WebXRNearInteraction.d.ts +1 -1
  491. package/XR/features/WebXRNearInteraction.js +5 -5
  492. package/XR/features/WebXRNearInteraction.js.map +1 -1
  493. package/XR/features/WebXRRawCameraAccess.js +2 -2
  494. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  495. package/XR/motionController/webXRProfiledMotionController.js +2 -2
  496. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  497. package/XR/webXRCamera.js +3 -4
  498. package/XR/webXRCamera.js.map +1 -1
  499. package/XR/webXREnterExitUI.js +3 -4
  500. package/XR/webXREnterExitUI.js.map +1 -1
  501. package/XR/webXRExperienceHelper.js +12 -13
  502. package/XR/webXRExperienceHelper.js.map +1 -1
  503. package/XR/webXRManagedOutputCanvas.d.ts +1 -1
  504. package/XR/webXRManagedOutputCanvas.js +15 -6
  505. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  506. package/XR/webXRRenderTargetTextureProvider.js +2 -2
  507. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  508. package/XR/webXRTypes.d.ts +2 -2
  509. package/XR/webXRTypes.js.map +1 -1
  510. package/package.json +1 -1
  511. package/scene.d.ts +1 -1
  512. package/scene.js +4 -4
  513. package/scene.js.map +1 -1
@@ -4,9 +4,7 @@ import { GreasedLineMesh } from "../GreasedLine/greasedLineMesh.js";
4
4
  import { EngineStore } from "../../Engines/engineStore.js";
5
5
  import { GreasedLineSimpleMaterial } from "../../Materials/GreasedLine/greasedLineSimpleMaterial.js";
6
6
  import { GreasedLineTools } from "../../Misc/greasedLineTools.js";
7
- import { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from "../GreasedLine/greasedLineBaseMesh.js";
8
7
  import { GreasedLineRibbonMesh } from "../GreasedLine/greasedLineRibbonMesh.js";
9
- import { GreasedLineMeshMaterialType } from "../../Materials/GreasedLine/greasedLineMaterialInterfaces.js";
10
8
  import { GreasedLinePluginMaterial } from "../../Materials/GreasedLine/greasedLinePluginMaterial.js";
11
9
  import { GreasedLineMaterialDefaults } from "../../Materials/GreasedLine/greasedLineMaterialDefaults.js";
12
10
  /**
@@ -85,11 +83,11 @@ export function CreateGreasedLineMaterial(name, options, scene) {
85
83
  scene = (scene ?? EngineStore.LastCreatedScene);
86
84
  let material;
87
85
  switch (options.materialType) {
88
- case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:
86
+ case 1 /* GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR */:
89
87
  material = new PBRMaterial(name, scene);
90
88
  new GreasedLinePluginMaterial(material, scene, options);
91
89
  break;
92
- case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:
90
+ case 2 /* GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE */:
93
91
  material = new GreasedLineSimpleMaterial(name, scene, options);
94
92
  break;
95
93
  default:
@@ -111,20 +109,20 @@ export function CreateGreasedLine(name, options, materialOptions, scene) {
111
109
  scene = (scene ?? EngineStore.LastCreatedScene);
112
110
  let instance;
113
111
  const allPoints = GreasedLineTools.ConvertPoints(options.points);
114
- options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;
112
+ options.widthDistribution = options.widthDistribution ?? 3 /* GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START */;
115
113
  if (options.ribbonOptions) {
116
- options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;
117
- options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;
114
+ options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? 1 /* GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING */;
115
+ options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? 0 /* GreasedLineRibbonPointsMode.POINTS_MODE_POINTS */;
118
116
  options.ribbonOptions.directionsAutoMode =
119
117
  options.ribbonOptions.directionsAutoMode ??
120
- (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);
118
+ (options.ribbonOptions.directions ? 99 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE */ : 0 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT */);
121
119
  }
122
120
  materialOptions = materialOptions ?? {
123
121
  color: GreasedLineMaterialDefaults.DEFAULT_COLOR,
124
122
  };
125
123
  materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;
126
- materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;
127
- materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;
124
+ materialOptions.colorDistribution = materialOptions?.colorDistribution ?? 3 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START */;
125
+ materialOptions.materialType = materialOptions.materialType ?? 0 /* GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD */;
128
126
  const pointsCount = GetPointsCount(allPoints);
129
127
  const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);
130
128
  const colors = materialOptions?.colors
@@ -141,7 +139,7 @@ export function CreateGreasedLine(name, options, materialOptions, scene) {
141
139
  colorPointers: options.colorPointers,
142
140
  };
143
141
  if (initialGreasedLineOptions.ribbonOptions) {
144
- if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {
142
+ if (initialGreasedLineOptions.ribbonOptions.pointsMode === 0 /* GreasedLineRibbonPointsMode.POINTS_MODE_POINTS */) {
145
143
  initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;
146
144
  }
147
145
  }
@@ -172,7 +170,7 @@ export function CreateGreasedLine(name, options, materialOptions, scene) {
172
170
  if (materialOptions.createAndAssignMaterial) {
173
171
  const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);
174
172
  instance.material = material;
175
- if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {
173
+ if (options.ribbonOptions?.facesMode === 1 /* GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING */) {
176
174
  material.backFaceCulling = false;
177
175
  }
178
176
  }
@@ -267,7 +265,7 @@ export function CompleteGreasedLineWidthTable(pointCount, widths, widthsDistribu
267
265
  widths.push(defaultWidthUpper);
268
266
  }
269
267
  // it is, fill in the missing elements
270
- if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {
268
+ if (widthsDistribution === 5 /* GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END */) {
271
269
  const halfCount = Math.floor(widths.length / 2);
272
270
  // start sector
273
271
  for (let i = 0, j = 0; i < halfCount - 1; i++) {
@@ -287,7 +285,7 @@ export function CompleteGreasedLineWidthTable(pointCount, widths, widthsDistribu
287
285
  widthsData.push(widths[i + 1]);
288
286
  }
289
287
  }
290
- else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {
288
+ else if (widthsDistribution === 3 /* GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START */) {
291
289
  // start sector
292
290
  for (let i = 0; i < widths.length; i += 2) {
293
291
  widthsData.push(widths[i]);
@@ -299,7 +297,7 @@ export function CompleteGreasedLineWidthTable(pointCount, widths, widthsDistribu
299
297
  widthsData.push(defaultWidthLower);
300
298
  }
301
299
  }
302
- else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {
300
+ else if (widthsDistribution === 4 /* GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END */) {
303
301
  // start sector
304
302
  for (let i = 0; i < missingCount; i++) {
305
303
  widthsData.push(defaultWidthUpper);
@@ -311,7 +309,7 @@ export function CompleteGreasedLineWidthTable(pointCount, widths, widthsDistribu
311
309
  widthsData.push(widths[i + 1]);
312
310
  }
313
311
  }
314
- else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {
312
+ else if (widthsDistribution === 1 /* GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT */) {
315
313
  let i = 0;
316
314
  for (let x = 0; x < pointCount; x++) {
317
315
  widthsData.push(widths[i++]);
@@ -321,7 +319,7 @@ export function CompleteGreasedLineWidthTable(pointCount, widths, widthsDistribu
321
319
  }
322
320
  }
323
321
  }
324
- else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {
322
+ else if (widthsDistribution === 2 /* GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN */) {
325
323
  let j = 0;
326
324
  const widthsectorLength = widths.length / ((pointCount - 1) * 2);
327
325
  for (let x = 0; x < pointCount; x++) {
@@ -365,7 +363,7 @@ export function CompleteGreasedLineColorTable(pointCount, colors, colorDistribut
365
363
  // is the color table shorter than the point table?
366
364
  if (missingCount > 0) {
367
365
  // it is, fill in the missing elements
368
- if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {
366
+ if (colorDistribution === 5 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END */) {
369
367
  const halfCount = Math.floor(colors.length / 2);
370
368
  // start sector
371
369
  for (let i = 0; i < halfCount; i++) {
@@ -380,7 +378,7 @@ export function CompleteGreasedLineColorTable(pointCount, colors, colorDistribut
380
378
  colorsData.push(colors[i]);
381
379
  }
382
380
  }
383
- else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {
381
+ else if (colorDistribution === 3 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START */) {
384
382
  // start sector
385
383
  for (let i = 0; i < colors.length; i++) {
386
384
  colorsData.push(colors[i]);
@@ -390,7 +388,7 @@ export function CompleteGreasedLineColorTable(pointCount, colors, colorDistribut
390
388
  colorsData.push(defaultColor);
391
389
  }
392
390
  }
393
- else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {
391
+ else if (colorDistribution === 4 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END */) {
394
392
  // start sector
395
393
  for (let i = 0; i < missingCount - 1; i++) {
396
394
  colorsData.push(defaultColor);
@@ -400,7 +398,7 @@ export function CompleteGreasedLineColorTable(pointCount, colors, colorDistribut
400
398
  colorsData.push(colors[i]);
401
399
  }
402
400
  }
403
- else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {
401
+ else if (colorDistribution === 1 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT */) {
404
402
  let i = 0;
405
403
  for (let x = 0; x < pointCount; x++) {
406
404
  colorsData.push(colors[i]);
@@ -410,7 +408,7 @@ export function CompleteGreasedLineColorTable(pointCount, colors, colorDistribut
410
408
  }
411
409
  }
412
410
  }
413
- else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {
411
+ else if (colorDistribution === 2 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN */) {
414
412
  let j = 0;
415
413
  const colorSectorLength = colors.length / (pointCount - 1);
416
414
  for (let x = 0; x < pointCount - 1; x++) {
@@ -419,7 +417,7 @@ export function CompleteGreasedLineColorTable(pointCount, colors, colorDistribut
419
417
  j += colorSectorLength;
420
418
  }
421
419
  }
422
- else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {
420
+ else if (colorDistribution === 0 /* GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE */) {
423
421
  for (let i = 0; i < colors.length; i++) {
424
422
  colorsData.push(colors[i]);
425
423
  }
@@ -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,2B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AAM,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 const pointsCount = GetPointsCount(allPoints);\r\n const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(pointsCount, 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 // add widths\r\n const currentWidths = instance.widths;\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\r\n instance.addPoints(allPoints);\r\n\r\n // add UVs\r\n if (options.uvs) {\r\n const currentUVs = instance.uvs;\r\n if (currentUVs) {\r\n const newUVs = new Float32Array(currentUVs.length + options.uvs.length);\r\n newUVs.set(currentUVs, 0);\r\n newUVs.set(options.uvs, currentUVs.length);\r\n instance.uvs = newUVs;\r\n } else {\r\n instance.uvs = options.uvs;\r\n }\r\n }\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 * Counts the number of points\r\n * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]\r\n * @returns total number of points\r\n */\r\nexport function GetPointsCount(allPoints: number[][]) {\r\n let pointCount = 0;\r\n for (const points of allPoints) {\r\n pointCount += (<number[]>points).length / 3;\r\n }\r\n return pointCount;\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;AAG/D,OAA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AM,CAAC,MAAM,EAAE;oBACrB,CAAC,GAAG,CAAC,CAAC;iBACT;aACJ;SACJ;aAAM,IAAI,iBAAiB,qEAA6D,EAAE;YACvF,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,MAAM,iBAAiB,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,qEAA6D,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 const 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 const 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 const pointsCount = GetPointsCount(allPoints);\r\n const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(pointsCount, 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 // add widths\r\n const currentWidths = instance.widths;\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\r\n instance.addPoints(allPoints);\r\n\r\n // add UVs\r\n if (options.uvs) {\r\n const currentUVs = instance.uvs;\r\n if (currentUVs) {\r\n const newUVs = new Float32Array(currentUVs.length + options.uvs.length);\r\n newUVs.set(currentUVs, 0);\r\n newUVs.set(options.uvs, currentUVs.length);\r\n instance.uvs = newUVs;\r\n } else {\r\n instance.uvs = options.uvs;\r\n }\r\n }\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 * Counts the number of points\r\n * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]\r\n * @returns total number of points\r\n */\r\nexport function GetPointsCount(allPoints: number[][]) {\r\n let pointCount = 0;\r\n for (const points of allPoints) {\r\n pointCount += (<number[]>points).length / 3;\r\n }\r\n return pointCount;\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"]}
@@ -10,7 +10,7 @@ import type { FloatArray, IndicesArray } from "../../types";
10
10
  * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.
11
11
  * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.
12
12
  */
13
- export declare enum GreasedLineRibbonPointsMode {
13
+ export declare const enum GreasedLineRibbonPointsMode {
14
14
  POINTS_MODE_POINTS = 0,
15
15
  POINTS_MODE_PATHS = 1
16
16
  }
@@ -19,7 +19,7 @@ export declare enum GreasedLineRibbonPointsMode {
19
19
  * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.
20
20
  * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.
21
21
  */
22
- export declare enum GreasedLineRibbonFacesMode {
22
+ export declare const enum GreasedLineRibbonFacesMode {
23
23
  FACES_MODE_SINGLE_SIDED = 0,
24
24
  FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,
25
25
  FACES_MODE_DOUBLE_SIDED = 2
@@ -32,7 +32,7 @@ export declare enum GreasedLineRibbonFacesMode {
32
32
  * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.
33
33
  * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.
34
34
  */
35
- export declare enum GreasedLineRibbonAutoDirectionMode {
35
+ export declare const enum GreasedLineRibbonAutoDirectionMode {
36
36
  AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,
37
37
  AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,
38
38
  AUTO_DIRECTIONS_ENHANCED = 2,
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAIlG;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACnC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,kCAMX;AAND,WAAY,kCAAkC;IAC1C,uJAAsC,CAAA;IACtC,qJAAqC,CAAA;IACrC,mIAA4B,CAAA;IAC5B,iIAA2B,CAAA;IAC3B,4HAAyB,CAAA;AAC7B,CAAC,EANW,kCAAkC,KAAlC,kCAAkC,QAM7C;AAsFD;;GAEG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,IAAI;IAkBlD,YAC6B,IAAY,EACr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CAAC;QAE/C,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAChE,CAAC;IAES,oBAAoB,CAAC,cAAc,GAAG,KAAK;QACjD,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QACpC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QACnC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,cAAc,EAAE;YAChB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;SACvF;QACD,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAEvC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { FloatArray, IndicesArray } from \"../../types\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_FACE_TO = 3,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: FloatArray;\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: FloatArray;\r\n protected _indices: IndicesArray;\r\n protected _uvs: FloatArray;\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: AbstractEngine;\r\n\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false) {\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Returns the UVs\r\n */\r\n get uvs() {\r\n return this._uvs;\r\n }\r\n\r\n /**\r\n * Sets the UVs\r\n * @param uvs the UVs\r\n */\r\n set uvs(uvs: FloatArray) {\r\n this._uvs = uvs instanceof Float32Array ? uvs : new Float32Array(uvs);\r\n this._createVertexBuffers();\r\n }\r\n\r\n /**\r\n * Returns the points offsets\r\n * Return the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public setPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n this._points = points;\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineBaseMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineBaseMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAIlG;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAGjB;AAHD,WAAkB,2BAA2B;IACzC,yGAAsB,CAAA;IACtB,uGAAqB,CAAA;AACzB,CAAC,EAHiB,2BAA2B,KAA3B,2BAA2B,QAG5C;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,0BAIjB;AAJD,WAAkB,0BAA0B;IACxC,iHAA2B,CAAA;IAC3B,yJAA+C,CAAA;IAC/C,iHAA2B,CAAA;AAC/B,CAAC,EAJiB,0BAA0B,KAA1B,0BAA0B,QAI3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAkB,kCAMjB;AAND,WAAkB,kCAAkC;IAChD,uJAAsC,CAAA;IACtC,qJAAqC,CAAA;IACrC,mIAA4B,CAAA;IAC5B,iIAA2B,CAAA;IAC3B,4HAAyB,CAAA;AAC7B,CAAC,EANiB,kCAAkC,KAAlC,kCAAkC,QAMnD;AAsFD;;GAEG;AACH,MAAM,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rC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAE/C,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAChE,CAAC;IAES,oBAAoB,CAAC,cAAc,GAAG,KAAK;QACjD,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QACpC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QACnC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,IAAI,cAAc,EAAE;YAChB,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;SACvF;QACD,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,oBAAoB,CAAC,OAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAEvC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { IGreasedLineMaterial } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { Buffer } from \"../../Buffers/buffer\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport type { FloatArray, IndicesArray } from \"../../types\";\r\n\r\n/**\r\n * In POINTS_MODE_POINTS every array of points will become the center (backbone) of the ribbon. The ribbon will be expanded by `width / 2` to `+direction` and `-direction` as well.\r\n * In POINTS_MODE_PATHS every array of points specifies an edge. These will be used to build one ribbon.\r\n */\r\nexport const enum GreasedLineRibbonPointsMode {\r\n POINTS_MODE_POINTS = 0,\r\n POINTS_MODE_PATHS = 1,\r\n}\r\n\r\n/**\r\n * FACES_MODE_SINGLE_SIDED single sided with back face culling. Default value.\r\n * FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING single sided without back face culling. Sets backFaceCulling = false on the material so it affects all line ribbons added to the line ribbon instance.\r\n * FACES_MODE_DOUBLE_SIDED extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\nexport const enum GreasedLineRibbonFacesMode {\r\n FACES_MODE_SINGLE_SIDED = 0,\r\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\r\n FACES_MODE_DOUBLE_SIDED = 2,\r\n}\r\n\r\n/**\r\n * Only with POINTS_MODE_PATHS.\r\n * AUTO_DIRECTIONS_FROM_FIRST_SEGMENT sets the direction (slope) of the ribbon from the direction of the first line segment. Recommended.\r\n * AUTO_DIRECTIONS_FROM_ALL_SEGMENTS in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments. Slow method.\r\n * AUTO_DIRECTIONS_ENHANCED in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments using a more sophisitcaed algorithm. Slowest method.\r\n * AUTO_DIRECTIONS_FACE_TO in this mode the direction (slope) will be calculated for each line segment according to the direction vector between each point of the line segments and a direction (face-to) vector specified in direction. The resulting line will face to the direction of this face-to vector.\r\n * AUTO_DIRECTIONS_NONE you have to set the direction (slope) manually. Recommended.\r\n */\r\nexport const enum GreasedLineRibbonAutoDirectionMode {\r\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\r\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\r\n AUTO_DIRECTIONS_ENHANCED = 2,\r\n AUTO_DIRECTIONS_FACE_TO = 3,\r\n AUTO_DIRECTIONS_NONE = 99,\r\n}\r\n\r\nexport type GreasedLineRibbonOptions = {\r\n /**\r\n * Defines how the points are processed.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_POINTS every array of points will become the center of the ribbon. The ribbon will be expanded by width/2 to +direction and -direction as well.\r\n * In GreasedLineRibbonPointsMode.POINTS_MODE_PATHS every array of points is one path. These will be used to buuid one ribbon.\r\n */\r\n pointsMode?: GreasedLineRibbonPointsMode;\r\n /**\r\n * Normalized directions of the slopes of the non camera facing lines.\r\n */\r\n directions?: Vector3[] | Vector3;\r\n /**\r\n * Defines the calculation mode of the directions which the line will be thickened to.\r\n */\r\n directionsAutoMode?: GreasedLineRibbonAutoDirectionMode;\r\n /**\r\n * Width of the ribbon.\r\n */\r\n width?: number;\r\n /**\r\n * Controls how the faces are created.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED = single sided with back face culling. Default value.\r\n * GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = single sided without back face culling\r\n * GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED = extra back faces are created. This doubles the amount of faces of the mesh.\r\n */\r\n facesMode?: GreasedLineRibbonFacesMode;\r\n /**\r\n * If true, the path will be closed.\r\n */\r\n closePath?: boolean;\r\n /**\r\n * If true, normals will be computed when creating the vertex buffers.\r\n * This results to smooth shading of the mesh.\r\n */\r\n smoothShading?: boolean;\r\n};\r\n\r\nexport type GreasedLinePoints = Vector3[] | Vector3[][] | Float32Array | Float32Array[] | number[][] | number[];\r\n\r\n/**\r\n * Options for creating a GreasedLineMesh\r\n */\r\nexport interface GreasedLineMeshOptions {\r\n /**\r\n * Points of the line.\r\n */\r\n points: GreasedLinePoints;\r\n /**\r\n * Each line segment (from point to point) can have it's width multiplier. Final width = widths[segmentIdx] * width.\r\n * Defaults to empty array.\r\n */\r\n widths?: number[];\r\n /**\r\n * If instance is specified, lines are added to the specified instance.\r\n * Defaults to undefined.\r\n */\r\n instance?: GreasedLineBaseMesh;\r\n /**\r\n * You can manually set the color pointers so you can control which segment/part\r\n * will use which color from the colors material option\r\n */\r\n colorPointers?: number[];\r\n /**\r\n * UVs for the mesh\r\n */\r\n uvs?: FloatArray;\r\n /**\r\n * If true, offsets and widths are updatable.\r\n * Defaults to false.\r\n */\r\n updatable?: boolean;\r\n /**\r\n * Use when @see instance is specified.\r\n * If true, the line will be rendered only after calling instance.updateLazy(). If false, line will be rerendered after every call to @see CreateGreasedLine\r\n * Defaults to false.\r\n */\r\n lazy?: boolean;\r\n /**\r\n * The options for the ribbon which will be used as a line.\r\n * If this option is set the line switches automatically to a non camera facing mode.\r\n */\r\n ribbonOptions?: GreasedLineRibbonOptions;\r\n}\r\n\r\n/**\r\n * GreasedLineBaseMesh\r\n */\r\nexport abstract class GreasedLineBaseMesh extends Mesh {\r\n protected _vertexPositions: FloatArray;\r\n protected _indices: IndicesArray;\r\n protected _uvs: FloatArray;\r\n protected _points: number[][];\r\n protected _offsets: number[];\r\n protected _colorPointers: number[];\r\n protected _widths: number[];\r\n\r\n protected _offsetsBuffer?: Buffer;\r\n protected _widthsBuffer?: Buffer;\r\n protected _colorPointersBuffer?: Buffer;\r\n\r\n protected _lazy = false;\r\n protected _updatable = false;\r\n\r\n protected _engine: AbstractEngine;\r\n\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n protected _options: GreasedLineMeshOptions\r\n ) {\r\n super(name, scene, null, null, false, false);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this._lazy = _options.lazy ?? false;\r\n this._updatable = _options.updatable ?? false;\r\n\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n this._points = [];\r\n this._colorPointers = _options.colorPointers ?? [];\r\n this._widths = _options.widths ?? new Array(_options.points.length).fill(1);\r\n }\r\n\r\n /**\r\n * \"GreasedLineMesh\"\r\n * @returns \"GreasedLineMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineMesh\";\r\n }\r\n\r\n protected abstract _setPoints(points: number[][], options?: GreasedLineMeshOptions): void;\r\n protected abstract _updateColorPointers(): void;\r\n protected abstract _updateWidths(): void;\r\n\r\n protected _updateWidthsWithValue(defaulValue: number) {\r\n let pointCount = 0;\r\n for (const points of this._points) {\r\n pointCount += points.length;\r\n }\r\n const countDiff = (pointCount / 3) * 2 - this._widths.length;\r\n for (let i = 0; i < countDiff; i++) {\r\n this._widths.push(defaulValue);\r\n }\r\n }\r\n\r\n /**\r\n * Updated a lazy line. Rerenders the line and updates boundinfo as well.\r\n */\r\n public updateLazy() {\r\n this._setPoints(this._points);\r\n if (!this._options.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n this.refreshBoundingInfo();\r\n\r\n this.greasedLineMaterial?.updateLazy();\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public addPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n for (const p of points) {\r\n this._points.push(p);\r\n }\r\n\r\n if (!this._lazy) {\r\n this.setPoints(this._points, options);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the line and it's resources\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\r\n */\r\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false) {\r\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\r\n }\r\n\r\n /**\r\n * @returns true if the mesh was created in lazy mode\r\n */\r\n public isLazy(): boolean {\r\n return this._lazy;\r\n }\r\n\r\n /**\r\n * Returns the UVs\r\n */\r\n get uvs() {\r\n return this._uvs;\r\n }\r\n\r\n /**\r\n * Sets the UVs\r\n * @param uvs the UVs\r\n */\r\n set uvs(uvs: FloatArray) {\r\n this._uvs = uvs instanceof Float32Array ? uvs : new Float32Array(uvs);\r\n this._createVertexBuffers();\r\n }\r\n\r\n /**\r\n * Returns the points offsets\r\n * Return the points offsets\r\n */\r\n get offsets() {\r\n return this._offsets;\r\n }\r\n\r\n /**\r\n * Sets point offests\r\n * @param offsets offset table [x,y,z, x,y,z, ....]\r\n */\r\n set offsets(offsets: number[]) {\r\n this._offsets = offsets;\r\n if (!this._offsetsBuffer) {\r\n this._createOffsetsBuffer(offsets);\r\n } else {\r\n this._offsetsBuffer.update(offsets);\r\n }\r\n }\r\n\r\n /**\r\n * Gets widths at each line point like [widthLower, widthUpper, widthLower, widthUpper, ...]\r\n */\r\n get widths() {\r\n return this._widths;\r\n }\r\n\r\n /**\r\n * Sets widths at each line point\r\n * @param widths width table [widthLower, widthUpper, widthLower, widthUpper ...]\r\n */\r\n set widths(widths: number[]) {\r\n this._widths = widths;\r\n if (!this._lazy) {\r\n this._widthsBuffer && this._widthsBuffer.update(widths);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the color pointer. Each vertex need a color pointer. These color pointers points to the colors in the color table @see colors\r\n */\r\n get colorPointers() {\r\n return this._colorPointers;\r\n }\r\n\r\n /**\r\n * Sets the color pointer\r\n * @param colorPointers array of color pointer in the colors array. One pointer for every vertex is needed.\r\n */\r\n set colorPointers(colorPointers: number[]) {\r\n this._colorPointers = colorPointers;\r\n if (!this._lazy) {\r\n this._colorPointersBuffer && this._colorPointersBuffer.update(colorPointers);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the pluginMaterial associated with line\r\n */\r\n get greasedLineMaterial(): IGreasedLineMaterial | undefined {\r\n if (this.material && this.material instanceof GreasedLineSimpleMaterial) {\r\n return this.material;\r\n }\r\n const materialPlugin = this.material?.pluginManager?.getPlugin(GreasedLinePluginMaterial.GREASED_LINE_MATERIAL_NAME);\r\n if (materialPlugin) {\r\n return <GreasedLinePluginMaterial>materialPlugin;\r\n }\r\n return;\r\n }\r\n\r\n /**\r\n * Return copy the points.\r\n */\r\n get points() {\r\n const pointsCopy: number[][] = [];\r\n DeepCopier.DeepCopy(this._points, pointsCopy);\r\n return pointsCopy;\r\n }\r\n\r\n /**\r\n * Sets line points and rerenders the line.\r\n * @param points points table\r\n * @param options optional options\r\n */\r\n public setPoints(points: number[][], options?: GreasedLineMeshOptions) {\r\n this._points = points;\r\n this._updateWidths();\r\n if (!options?.colorPointers) {\r\n this._updateColorPointers();\r\n }\r\n this._setPoints(points, options);\r\n }\r\n\r\n protected _initGreasedLine() {\r\n this._vertexPositions = [];\r\n this._indices = [];\r\n this._uvs = [];\r\n }\r\n\r\n protected _createLineOptions() {\r\n const lineOptions: GreasedLineMeshOptions = {\r\n points: this._points,\r\n colorPointers: this._colorPointers,\r\n lazy: this._lazy,\r\n updatable: this._updatable,\r\n uvs: this._uvs,\r\n widths: this._widths,\r\n ribbonOptions: this._options.ribbonOptions,\r\n };\r\n return lineOptions;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n }\r\n\r\n protected _createVertexBuffers(computeNormals = false) {\r\n const vertexData = new VertexData();\r\n vertexData.positions = this._vertexPositions;\r\n vertexData.indices = this._indices;\r\n vertexData.uvs = this._uvs;\r\n if (computeNormals) {\r\n vertexData.normals = [];\r\n VertexData.ComputeNormals(this._vertexPositions, this._indices, vertexData.normals);\r\n }\r\n vertexData.applyToMesh(this, this._options.updatable);\r\n return vertexData;\r\n }\r\n\r\n protected _createOffsetsBuffer(offsets: number[]) {\r\n const engine = this._scene.getEngine();\r\n\r\n const offsetBuffer = new Buffer(engine, offsets, this._updatable, 3);\r\n this.setVerticesBuffer(offsetBuffer.createVertexBuffer(\"grl_offsets\", 0, 3));\r\n this._offsetsBuffer = offsetBuffer;\r\n }\r\n}\r\n"]}
@@ -3,7 +3,7 @@ import { Mesh } from "../mesh.js";
3
3
  import { Buffer } from "../../Buffers/buffer.js";
4
4
  import { DeepCopier } from "../../Misc/deepCopier.js";
5
5
  import { GreasedLineTools } from "../../Misc/greasedLineTools.js";
6
- import { GreasedLineBaseMesh, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from "./greasedLineBaseMesh.js";
6
+ import { GreasedLineBaseMesh } from "./greasedLineBaseMesh.js";
7
7
  Mesh._GreasedLineRibbonMeshParser = (parsedMesh, scene) => {
8
8
  return GreasedLineRibbonMesh.Parse(parsedMesh, scene);
9
9
  };
@@ -87,7 +87,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
87
87
  for (let i = 0; i < this._pathsOptions.length; i++) {
88
88
  const { options: pathOptions, pathCount } = this._pathsOptions[i];
89
89
  const points = this._points[i];
90
- if (pathOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {
90
+ if (pathOptions.ribbonOptions.pointsMode === 0 /* GreasedLineRibbonPointsMode.POINTS_MODE_POINTS */) {
91
91
  for (let k = 0; k < pathCount; k++) {
92
92
  for (let j = 0; j < points.length; j += 3) {
93
93
  this._colorPointers.push(colorPointer);
@@ -122,11 +122,11 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
122
122
  const { options: pathOptions, pathCount } = this._pathsOptions[i];
123
123
  const subPoints = points.slice(c, c + pathCount);
124
124
  c += pathCount;
125
- if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {
125
+ if (pathOptions.ribbonOptions?.pointsMode === 1 /* GreasedLineRibbonPointsMode.POINTS_MODE_PATHS */) {
126
126
  indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints), indiceOffset, pathOptions);
127
127
  }
128
128
  else {
129
- if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {
129
+ if (pathOptions.ribbonOptions?.directionsAutoMode === 99 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE */) {
130
130
  if (!pathOptions.ribbonOptions.directions) {
131
131
  // eslint-disable-next-line no-throw-literal
132
132
  throw "In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.";
@@ -166,8 +166,8 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
166
166
  }
167
167
  }
168
168
  const v = [1, 0, numOfPaths];
169
- const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED ?? false;
170
- const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;
169
+ const doubleSided = options.ribbonOptions?.facesMode === 2 /* GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED */ ?? false;
170
+ const closePath = options.ribbonOptions?.pointsMode === 1 /* GreasedLineRibbonPointsMode.POINTS_MODE_PATHS */ && options.ribbonOptions.closePath;
171
171
  if (numOfPaths > 2) {
172
172
  for (let i = 0; i < path.length - 1; i++) {
173
173
  v[0] = 1 + numOfPaths * i;
@@ -233,7 +233,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
233
233
  vertexPositions.push(p);
234
234
  }
235
235
  let pathArrayCopy = pathArray;
236
- if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {
236
+ if (options.ribbonOptions?.pointsMode === 1 /* GreasedLineRibbonPointsMode.POINTS_MODE_PATHS */ && options.ribbonOptions.closePath) {
237
237
  pathArrayCopy = [];
238
238
  for (let i = 0; i < pathArray.length; i++) {
239
239
  const pathCopy = pathArray[i].slice();
@@ -263,7 +263,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
263
263
  }
264
264
  this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);
265
265
  }
266
- const slopes = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS
266
+ const slopes = options.ribbonOptions?.pointsMode === 1 /* GreasedLineRibbonPointsMode.POINTS_MODE_PATHS */
267
267
  ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)
268
268
  : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);
269
269
  for (const s of slopes) {
@@ -278,22 +278,22 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
278
278
  return indiceOffset;
279
279
  }
280
280
  static _ConvertToRibbonPath(points, ribbonInfo, rightHandedSystem, directionPlane) {
281
- if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {
281
+ if (ribbonInfo.pointsMode === 0 /* GreasedLineRibbonPointsMode.POINTS_MODE_POINTS */ && !ribbonInfo.width) {
282
282
  // eslint-disable-next-line no-throw-literal
283
283
  throw "'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.";
284
284
  }
285
285
  const path1 = [];
286
286
  const path2 = [];
287
- if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {
287
+ if (ribbonInfo.pointsMode === 0 /* GreasedLineRibbonPointsMode.POINTS_MODE_POINTS */) {
288
288
  const width = ribbonInfo.width / 2;
289
289
  const pointVectors = GreasedLineTools.ToVector3Array(points);
290
290
  let direction = null;
291
291
  let fatDirection = null;
292
- if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {
292
+ if (ribbonInfo.directionsAutoMode === 0 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT */) {
293
293
  // set the direction plane from the first line segment for the whole line
294
294
  directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);
295
295
  }
296
- if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {
296
+ if (ribbonInfo.directionsAutoMode === 3 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO */ && !(ribbonInfo.directions instanceof Vector3)) {
297
297
  // eslint-disable-next-line no-throw-literal
298
298
  throw "In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.";
299
299
  }
@@ -304,11 +304,11 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
304
304
  if (directionPlane) {
305
305
  direction = directionPlane;
306
306
  }
307
- else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {
307
+ else if (ribbonInfo.directionsAutoMode === 3 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO */) {
308
308
  p2.subtractToRef(p1, TmpVectors.Vector3[0]);
309
309
  direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();
310
310
  }
311
- else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {
311
+ else if (ribbonInfo.directionsAutoMode === 1 /* GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS */) {
312
312
  direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);
313
313
  }
314
314
  else {