@babylonjs/core 5.0.0-beta.2 → 5.0.0-beta.6

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 (692) hide show
  1. package/Actions/actionManager.d.ts +1 -1
  2. package/Actions/actionManager.js +5 -1
  3. package/Actions/actionManager.js.map +1 -1
  4. package/Audio/analyser.d.ts +2 -1
  5. package/Audio/analyser.js +5 -0
  6. package/Audio/analyser.js.map +1 -1
  7. package/Audio/audioSceneComponent.d.ts +1 -1
  8. package/Audio/audioSceneComponent.js +5 -0
  9. package/Audio/audioSceneComponent.js.map +1 -1
  10. package/Audio/sound.d.ts +1 -1
  11. package/Audio/sound.js +8 -1
  12. package/Audio/sound.js.map +1 -1
  13. package/Audio/soundTrack.d.ts +2 -1
  14. package/Audio/soundTrack.js +5 -0
  15. package/Audio/soundTrack.js.map +1 -1
  16. package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +1 -1
  17. package/BakedVertexAnimation/bakedVertexAnimationManager.js +5 -0
  18. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  19. package/Behaviors/Meshes/baseSixDofDragBehavior.js +29 -26
  20. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  21. package/Behaviors/Meshes/pointerDragBehavior.js +2 -0
  22. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  23. package/Bones/bone.d.ts +2 -1
  24. package/Bones/bone.js +28 -18
  25. package/Bones/bone.js.map +1 -1
  26. package/Bones/skeleton.js +3 -3
  27. package/Bones/skeleton.js.map +1 -1
  28. package/Buffers/buffer.d.ts +4 -0
  29. package/Buffers/buffer.js +13 -3
  30. package/Buffers/buffer.js.map +1 -1
  31. package/Cameras/Inputs/freeCameraMouseInput.d.ts +1 -0
  32. package/Cameras/Inputs/freeCameraMouseInput.js +6 -3
  33. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  34. package/Cameras/Inputs/freeCameraTouchInput.js +2 -4
  35. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  36. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
  37. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
  38. package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
  39. package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
  40. package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
  41. package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
  42. package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
  43. package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
  44. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
  45. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
  46. package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
  47. package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
  48. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
  49. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
  50. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.d.ts +1 -1
  51. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  52. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
  53. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
  54. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
  55. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
  56. package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
  57. package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
  58. package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
  59. package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
  60. package/Cameras/VR/vrExperienceHelper.d.ts +1 -0
  61. package/Cameras/VR/vrExperienceHelper.js +1 -0
  62. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  63. package/Cameras/VR/webVRCamera.d.ts +2 -1
  64. package/Cameras/VR/webVRCamera.js +3 -2
  65. package/Cameras/VR/webVRCamera.js.map +1 -1
  66. package/Cameras/arcRotateCamera.d.ts +1 -1
  67. package/Cameras/arcRotateCamera.js.map +1 -1
  68. package/Cameras/camera.d.ts +1 -1
  69. package/Cameras/camera.js +1 -1
  70. package/Cameras/camera.js.map +1 -1
  71. package/Cameras/deviceOrientationCamera.d.ts +1 -1
  72. package/Cameras/deviceOrientationCamera.js.map +1 -1
  73. package/Cameras/flyCamera.d.ts +1 -1
  74. package/Cameras/flyCamera.js.map +1 -1
  75. package/Cameras/followCamera.d.ts +1 -1
  76. package/Cameras/followCamera.js.map +1 -1
  77. package/Cameras/freeCamera.d.ts +1 -1
  78. package/Cameras/freeCamera.js.map +1 -1
  79. package/Cameras/gamepadCamera.d.ts +1 -1
  80. package/Cameras/gamepadCamera.js.map +1 -1
  81. package/Cameras/targetCamera.d.ts +1 -1
  82. package/Cameras/targetCamera.js.map +1 -1
  83. package/Cameras/touchCamera.d.ts +1 -1
  84. package/Cameras/touchCamera.js.map +1 -1
  85. package/Cameras/universalCamera.d.ts +1 -1
  86. package/Cameras/universalCamera.js.map +1 -1
  87. package/Cameras/virtualJoysticksCamera.d.ts +1 -1
  88. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  89. package/Collisions/collider.d.ts +1 -1
  90. package/Collisions/collider.js +48 -2
  91. package/Collisions/collider.js.map +1 -1
  92. package/Compute/computeEffect.js +2 -2
  93. package/Compute/computeEffect.js.map +1 -1
  94. package/Culling/Octrees/octreeSceneComponent.d.ts +1 -1
  95. package/Culling/Octrees/octreeSceneComponent.js +5 -0
  96. package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
  97. package/Culling/ray.d.ts +6 -4
  98. package/Culling/ray.js +33 -11
  99. package/Culling/ray.js.map +1 -1
  100. package/Debug/axesViewer.d.ts +2 -1
  101. package/Debug/axesViewer.js +6 -0
  102. package/Debug/axesViewer.js.map +1 -1
  103. package/Debug/debugLayer.d.ts +1 -1
  104. package/Debug/debugLayer.js +6 -2
  105. package/Debug/debugLayer.js.map +1 -1
  106. package/Debug/physicsViewer.d.ts +1 -1
  107. package/Debug/physicsViewer.js +3 -0
  108. package/Debug/physicsViewer.js.map +1 -1
  109. package/DeviceInput/Helpers/eventFactory.d.ts +1 -1
  110. package/DeviceInput/Helpers/eventFactory.js +1 -1
  111. package/DeviceInput/Helpers/eventFactory.js.map +1 -1
  112. package/DeviceInput/InputDevices/deviceEnums.d.ts +52 -1
  113. package/DeviceInput/InputDevices/deviceEnums.js +52 -0
  114. package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
  115. package/DeviceInput/InputDevices/deviceSource.d.ts +35 -0
  116. package/DeviceInput/InputDevices/deviceSource.js +38 -0
  117. package/DeviceInput/InputDevices/deviceSource.js.map +1 -0
  118. package/DeviceInput/InputDevices/deviceSourceManager.d.ts +14 -72
  119. package/DeviceInput/InputDevices/deviceSourceManager.js +10 -180
  120. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  121. package/DeviceInput/InputDevices/deviceTypes.d.ts +2 -2
  122. package/DeviceInput/InputDevices/deviceTypes.js.map +1 -1
  123. package/DeviceInput/{Interfaces → InputDevices}/inputInterfaces.d.ts +1 -5
  124. package/DeviceInput/{Interfaces → InputDevices}/inputInterfaces.js +0 -0
  125. package/DeviceInput/InputDevices/inputInterfaces.js.map +1 -0
  126. package/DeviceInput/InputDevices/internalDeviceSourceManager.d.ts +46 -0
  127. package/DeviceInput/InputDevices/internalDeviceSourceManager.js +144 -0
  128. package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +1 -0
  129. package/DeviceInput/{Implementations → InputDevices}/nativeDeviceInputSystem.d.ts +3 -7
  130. package/DeviceInput/{Implementations → InputDevices}/nativeDeviceInputSystem.js +9 -15
  131. package/DeviceInput/InputDevices/nativeDeviceInputSystem.js.map +1 -0
  132. package/DeviceInput/{Implementations → InputDevices}/webDeviceInputSystem.d.ts +11 -15
  133. package/DeviceInput/{Implementations → InputDevices}/webDeviceInputSystem.js +116 -95
  134. package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -0
  135. package/DeviceInput/index.d.ts +1 -5
  136. package/DeviceInput/index.js +1 -5
  137. package/DeviceInput/index.js.map +1 -1
  138. package/Engines/Extensions/engine.cubeTexture.d.ts +1 -1
  139. package/Engines/Extensions/engine.cubeTexture.js +5 -2
  140. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  141. package/Engines/Extensions/engine.multiview.d.ts +5 -0
  142. package/Engines/Extensions/engine.multiview.js +4 -1
  143. package/Engines/Extensions/engine.multiview.js.map +1 -1
  144. package/Engines/Native/nativeInterfaces.d.ts +3 -2
  145. package/Engines/Native/nativeInterfaces.js.map +1 -1
  146. package/Engines/Processors/Expressions/shaderDefineExpression.js +1 -1
  147. package/Engines/Processors/Expressions/shaderDefineExpression.js.map +1 -1
  148. package/Engines/Processors/shaderCodeInliner.js +13 -13
  149. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  150. package/Engines/WebGPU/webgpuCacheBindGroups.js +9 -9
  151. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  152. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +5 -7
  153. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  154. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
  155. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  156. package/Engines/WebGPU/webgpuCacheSampler.d.ts +2 -0
  157. package/Engines/WebGPU/webgpuCacheSampler.js +23 -2
  158. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  159. package/Engines/WebGPU/webgpuComputeContext.js +1 -1
  160. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  161. package/Engines/WebGPU/webgpuDrawContext.d.ts +1 -1
  162. package/Engines/WebGPU/webgpuDrawContext.js +3 -3
  163. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  164. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -1
  165. package/Engines/WebGPU/webgpuHardwareTexture.js +0 -3
  166. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  167. package/Engines/WebGPU/webgpuPipelineContext.d.ts +0 -8
  168. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  169. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +13 -13
  170. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  171. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +30 -30
  172. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  173. package/Engines/WebGPU/webgpuTextureHelper.d.ts +0 -1
  174. package/Engines/WebGPU/webgpuTextureHelper.js +8 -30
  175. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  176. package/Engines/engine.d.ts +3 -7
  177. package/Engines/engine.js +2 -6
  178. package/Engines/engine.js.map +1 -1
  179. package/Engines/engineCapabilities.d.ts +4 -0
  180. package/Engines/engineCapabilities.js.map +1 -1
  181. package/Engines/nativeEngine.d.ts +1 -0
  182. package/Engines/nativeEngine.js +39 -12
  183. package/Engines/nativeEngine.js.map +1 -1
  184. package/Engines/nullEngine.js +3 -1
  185. package/Engines/nullEngine.js.map +1 -1
  186. package/Engines/thinEngine.d.ts +11 -2
  187. package/Engines/thinEngine.js +34 -21
  188. package/Engines/thinEngine.js.map +1 -1
  189. package/Engines/webgpuEngine.d.ts +3 -7
  190. package/Engines/webgpuEngine.js +12 -22
  191. package/Engines/webgpuEngine.js.map +1 -1
  192. package/Gamepads/Controllers/daydreamController.js +1 -1
  193. package/Gamepads/Controllers/daydreamController.js.map +1 -1
  194. package/Gamepads/Controllers/oculusTouchController.js +2 -2
  195. package/Gamepads/Controllers/oculusTouchController.js.map +1 -1
  196. package/Gamepads/Controllers/webVRController.d.ts +1 -0
  197. package/Gamepads/Controllers/webVRController.js +1 -0
  198. package/Gamepads/Controllers/webVRController.js.map +1 -1
  199. package/Gamepads/gamepadManager.js +1 -1
  200. package/Gamepads/gamepadManager.js.map +1 -1
  201. package/Gizmos/gizmoManager.d.ts +2 -0
  202. package/Gizmos/gizmoManager.js +28 -24
  203. package/Gizmos/gizmoManager.js.map +1 -1
  204. package/Helpers/sceneHelpers.d.ts +1 -0
  205. package/Helpers/sceneHelpers.js.map +1 -1
  206. package/Inputs/scene.inputManager.d.ts +2 -2
  207. package/Inputs/scene.inputManager.js +10 -9
  208. package/Inputs/scene.inputManager.js.map +1 -1
  209. package/Instrumentation/sceneInstrumentation.js +2 -2
  210. package/Instrumentation/sceneInstrumentation.js.map +1 -1
  211. package/Layers/effectLayer.d.ts +1 -1
  212. package/Layers/effectLayer.js +1 -1
  213. package/Layers/effectLayer.js.map +1 -1
  214. package/Layers/effectLayerSceneComponent.d.ts +1 -1
  215. package/Layers/effectLayerSceneComponent.js +7 -3
  216. package/Layers/effectLayerSceneComponent.js.map +1 -1
  217. package/Layers/glowLayer.d.ts +1 -1
  218. package/Layers/glowLayer.js.map +1 -1
  219. package/Layers/highlightLayer.d.ts +1 -1
  220. package/Layers/highlightLayer.js +2 -1
  221. package/Layers/highlightLayer.js.map +1 -1
  222. package/Layers/layer.d.ts +2 -2
  223. package/Layers/layer.js.map +1 -1
  224. package/Layers/layerSceneComponent.d.ts +1 -1
  225. package/Layers/layerSceneComponent.js +7 -3
  226. package/Layers/layerSceneComponent.js.map +1 -1
  227. package/Lights/Shadows/cascadedShadowGenerator.js +2 -2
  228. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  229. package/Lights/Shadows/shadowGenerator.js +2 -2
  230. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  231. package/Loading/Plugins/babylonFileLoader.js +115 -29
  232. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  233. package/Loading/loadingScreen.js +8 -8
  234. package/Loading/loadingScreen.js.map +1 -1
  235. package/Loading/sceneLoader.js +3 -3
  236. package/Loading/sceneLoader.js.map +1 -1
  237. package/Materials/Background/backgroundMaterial.d.ts +1 -1
  238. package/Materials/Background/backgroundMaterial.js.map +1 -1
  239. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +37 -0
  240. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +117 -0
  241. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -0
  242. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +12 -12
  243. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  244. package/Materials/Node/Blocks/Dual/fogBlock.js +5 -5
  245. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  246. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +13 -13
  247. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  248. package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
  249. package/Materials/Node/Blocks/Dual/index.js +1 -0
  250. package/Materials/Node/Blocks/Dual/index.js.map +1 -1
  251. package/Materials/Node/Blocks/Dual/lightBlock.js +10 -10
  252. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  253. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +28 -28
  254. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  255. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +1 -1
  256. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  257. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -7
  258. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  259. package/Materials/Node/Blocks/Dual/textureBlock.js +32 -32
  260. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  261. package/Materials/Node/Blocks/Fragment/derivativeBlock.js +2 -2
  262. package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
  263. package/Materials/Node/Blocks/Fragment/discardBlock.js +1 -1
  264. package/Materials/Node/Blocks/Fragment/discardBlock.js.map +1 -1
  265. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -1
  266. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  267. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +10 -10
  268. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  269. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +7 -7
  270. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  271. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +12 -12
  272. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  273. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -1
  274. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  275. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +7 -7
  276. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
  277. package/Materials/Node/Blocks/Fragment/twirlBlock.js +4 -4
  278. package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
  279. package/Materials/Node/Blocks/Input/inputBlock.d.ts +2 -1
  280. package/Materials/Node/Blocks/Input/inputBlock.js +29 -24
  281. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  282. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +5 -5
  283. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  284. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +5 -5
  285. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  286. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +33 -33
  287. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  288. package/Materials/Node/Blocks/PBR/reflectionBlock.js +11 -11
  289. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  290. package/Materials/Node/Blocks/PBR/refractionBlock.js +11 -11
  291. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  292. package/Materials/Node/Blocks/PBR/sheenBlock.js +3 -3
  293. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  294. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +1 -1
  295. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  296. package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js +1 -1
  297. package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
  298. package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js +1 -1
  299. package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
  300. package/Materials/Node/Blocks/Particle/particleTextureBlock.js +7 -7
  301. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  302. package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
  303. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  304. package/Materials/Node/Blocks/Vertex/instancesBlock.js +3 -3
  305. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  306. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +5 -5
  307. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  308. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +16 -16
  309. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  310. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -1
  311. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  312. package/Materials/Node/Blocks/addBlock.js +1 -1
  313. package/Materials/Node/Blocks/addBlock.js.map +1 -1
  314. package/Materials/Node/Blocks/arcTan2Block.js +1 -1
  315. package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
  316. package/Materials/Node/Blocks/clampBlock.js +3 -3
  317. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  318. package/Materials/Node/Blocks/cloudBlock.js +7 -7
  319. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  320. package/Materials/Node/Blocks/colorMergerBlock.js +8 -8
  321. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  322. package/Materials/Node/Blocks/colorSplitterBlock.js +5 -5
  323. package/Materials/Node/Blocks/colorSplitterBlock.js.map +1 -1
  324. package/Materials/Node/Blocks/conditionalBlock.js +10 -10
  325. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  326. package/Materials/Node/Blocks/crossBlock.js +1 -1
  327. package/Materials/Node/Blocks/crossBlock.js.map +1 -1
  328. package/Materials/Node/Blocks/customBlock.js +1 -1
  329. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  330. package/Materials/Node/Blocks/desaturateBlock.js +4 -4
  331. package/Materials/Node/Blocks/desaturateBlock.js.map +1 -1
  332. package/Materials/Node/Blocks/distanceBlock.js +1 -1
  333. package/Materials/Node/Blocks/distanceBlock.js.map +1 -1
  334. package/Materials/Node/Blocks/divideBlock.js +1 -1
  335. package/Materials/Node/Blocks/divideBlock.js.map +1 -1
  336. package/Materials/Node/Blocks/dotBlock.js +1 -1
  337. package/Materials/Node/Blocks/dotBlock.js.map +1 -1
  338. package/Materials/Node/Blocks/elbowBlock.d.ts +27 -0
  339. package/Materials/Node/Blocks/elbowBlock.js +60 -0
  340. package/Materials/Node/Blocks/elbowBlock.js.map +1 -0
  341. package/Materials/Node/Blocks/fresnelBlock.js +2 -2
  342. package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
  343. package/Materials/Node/Blocks/gradientBlock.js +8 -8
  344. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  345. package/Materials/Node/Blocks/index.d.ts +1 -0
  346. package/Materials/Node/Blocks/index.js +1 -0
  347. package/Materials/Node/Blocks/index.js.map +1 -1
  348. package/Materials/Node/Blocks/lengthBlock.js +1 -1
  349. package/Materials/Node/Blocks/lengthBlock.js.map +1 -1
  350. package/Materials/Node/Blocks/lerpBlock.js +1 -1
  351. package/Materials/Node/Blocks/lerpBlock.js.map +1 -1
  352. package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -1
  353. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  354. package/Materials/Node/Blocks/maxBlock.js +1 -1
  355. package/Materials/Node/Blocks/maxBlock.js.map +1 -1
  356. package/Materials/Node/Blocks/minBlock.js +1 -1
  357. package/Materials/Node/Blocks/minBlock.js.map +1 -1
  358. package/Materials/Node/Blocks/modBlock.js +1 -1
  359. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  360. package/Materials/Node/Blocks/multiplyBlock.js +1 -1
  361. package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
  362. package/Materials/Node/Blocks/nLerpBlock.js +1 -1
  363. package/Materials/Node/Blocks/nLerpBlock.js.map +1 -1
  364. package/Materials/Node/Blocks/negateBlock.js +1 -1
  365. package/Materials/Node/Blocks/negateBlock.js.map +1 -1
  366. package/Materials/Node/Blocks/normalBlendBlock.js +5 -5
  367. package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
  368. package/Materials/Node/Blocks/normalizeBlock.js +1 -1
  369. package/Materials/Node/Blocks/normalizeBlock.js.map +1 -1
  370. package/Materials/Node/Blocks/oneMinusBlock.js +1 -1
  371. package/Materials/Node/Blocks/oneMinusBlock.js.map +1 -1
  372. package/Materials/Node/Blocks/posterizeBlock.js +1 -1
  373. package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
  374. package/Materials/Node/Blocks/powBlock.js +1 -1
  375. package/Materials/Node/Blocks/powBlock.js.map +1 -1
  376. package/Materials/Node/Blocks/randomNumberBlock.js +2 -2
  377. package/Materials/Node/Blocks/randomNumberBlock.js.map +1 -1
  378. package/Materials/Node/Blocks/reciprocalBlock.js +1 -1
  379. package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
  380. package/Materials/Node/Blocks/reflectBlock.js +1 -1
  381. package/Materials/Node/Blocks/reflectBlock.js.map +1 -1
  382. package/Materials/Node/Blocks/refractBlock.js +1 -1
  383. package/Materials/Node/Blocks/refractBlock.js.map +1 -1
  384. package/Materials/Node/Blocks/remapBlock.js +3 -3
  385. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  386. package/Materials/Node/Blocks/replaceColorBlock.js +3 -3
  387. package/Materials/Node/Blocks/replaceColorBlock.js.map +1 -1
  388. package/Materials/Node/Blocks/rotate2dBlock.js +1 -1
  389. package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
  390. package/Materials/Node/Blocks/scaleBlock.js +1 -1
  391. package/Materials/Node/Blocks/scaleBlock.js.map +1 -1
  392. package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -1
  393. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  394. package/Materials/Node/Blocks/smoothStepBlock.js +1 -1
  395. package/Materials/Node/Blocks/smoothStepBlock.js.map +1 -1
  396. package/Materials/Node/Blocks/stepBlock.js +1 -1
  397. package/Materials/Node/Blocks/stepBlock.js.map +1 -1
  398. package/Materials/Node/Blocks/subtractBlock.js +1 -1
  399. package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
  400. package/Materials/Node/Blocks/transformBlock.js +13 -13
  401. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  402. package/Materials/Node/Blocks/trigonometryBlock.js +2 -2
  403. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  404. package/Materials/Node/Blocks/vectorMergerBlock.js +22 -22
  405. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  406. package/Materials/Node/Blocks/vectorSplitterBlock.js +8 -8
  407. package/Materials/Node/Blocks/vectorSplitterBlock.js.map +1 -1
  408. package/Materials/Node/Blocks/viewDirectionBlock.js +1 -1
  409. package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
  410. package/Materials/Node/Blocks/voronoiNoiseBlock.js +5 -5
  411. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  412. package/Materials/Node/Blocks/waveBlock.js +3 -3
  413. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  414. package/Materials/Node/Blocks/worleyNoise3DBlock.js +5 -5
  415. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  416. package/Materials/Node/Enums/nodeMaterialSystemValues.d.ts +3 -1
  417. package/Materials/Node/Enums/nodeMaterialSystemValues.js +2 -0
  418. package/Materials/Node/Enums/nodeMaterialSystemValues.js.map +1 -1
  419. package/Materials/Node/nodeMaterial.d.ts +4 -0
  420. package/Materials/Node/nodeMaterial.js +22 -11
  421. package/Materials/Node/nodeMaterial.js.map +1 -1
  422. package/Materials/Node/nodeMaterialBlock.js +12 -12
  423. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  424. package/Materials/Node/nodeMaterialBuildState.js +24 -24
  425. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  426. package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -1
  427. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  428. package/Materials/PBR/pbrBaseMaterial.d.ts +2 -1
  429. package/Materials/PBR/pbrBaseMaterial.js +4 -3
  430. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  431. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +1 -1
  432. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  433. package/Materials/PBR/pbrMaterial.d.ts +1 -1
  434. package/Materials/PBR/pbrMaterial.js +2 -3
  435. package/Materials/PBR/pbrMaterial.js.map +1 -1
  436. package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +1 -1
  437. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  438. package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +1 -1
  439. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  440. package/Materials/Textures/Loaders/ddsTextureLoader.js +8 -1
  441. package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
  442. package/Materials/Textures/Loaders/ktxTextureLoader.js +2 -2
  443. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  444. package/Materials/Textures/MultiviewRenderTarget.d.ts +2 -1
  445. package/Materials/Textures/MultiviewRenderTarget.js +10 -2
  446. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  447. package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
  448. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  449. package/Materials/Textures/baseTexture.d.ts +1 -1
  450. package/Materials/Textures/baseTexture.js.map +1 -1
  451. package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
  452. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  453. package/Materials/Textures/mirrorTexture.d.ts +2 -2
  454. package/Materials/Textures/mirrorTexture.js +7 -3
  455. package/Materials/Textures/mirrorTexture.js.map +1 -1
  456. package/Materials/Textures/multiRenderTarget.d.ts +1 -1
  457. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  458. package/Materials/Textures/prePassRenderTarget.d.ts +1 -1
  459. package/Materials/Textures/prePassRenderTarget.js.map +1 -1
  460. package/Materials/Textures/refractionTexture.d.ts +1 -1
  461. package/Materials/Textures/refractionTexture.js +2 -2
  462. package/Materials/Textures/refractionTexture.js.map +1 -1
  463. package/Materials/Textures/renderTargetTexture.d.ts +1 -1
  464. package/Materials/Textures/renderTargetTexture.js +2 -2
  465. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  466. package/Materials/Textures/texture.d.ts +1 -1
  467. package/Materials/Textures/texture.js.map +1 -1
  468. package/Materials/Textures/videoTexture.js +1 -0
  469. package/Materials/Textures/videoTexture.js.map +1 -1
  470. package/Materials/effect.js +3 -3
  471. package/Materials/effect.js.map +1 -1
  472. package/Materials/material.d.ts +3 -1
  473. package/Materials/material.js +11 -3
  474. package/Materials/material.js.map +1 -1
  475. package/Materials/materialHelper.js +4 -1
  476. package/Materials/materialHelper.js.map +1 -1
  477. package/Materials/materialPluginManager.js +3 -3
  478. package/Materials/materialPluginManager.js.map +1 -1
  479. package/Materials/multiMaterial.d.ts +3 -1
  480. package/Materials/multiMaterial.js +13 -11
  481. package/Materials/multiMaterial.js.map +1 -1
  482. package/Materials/pushMaterial.d.ts +1 -1
  483. package/Materials/pushMaterial.js.map +1 -1
  484. package/Materials/shaderMaterial.js +8 -4
  485. package/Materials/shaderMaterial.js.map +1 -1
  486. package/Materials/shadowDepthWrapper.d.ts +1 -1
  487. package/Materials/shadowDepthWrapper.js +3 -3
  488. package/Materials/shadowDepthWrapper.js.map +1 -1
  489. package/Materials/standardMaterial.d.ts +2 -6
  490. package/Materials/standardMaterial.js +5 -10
  491. package/Materials/standardMaterial.js.map +1 -1
  492. package/Maths/math.path.d.ts +1 -0
  493. package/Maths/math.path.js +1 -0
  494. package/Maths/math.path.js.map +1 -1
  495. package/Maths/math.size.js +1 -1
  496. package/Maths/math.size.js.map +1 -1
  497. package/Maths/math.vector.d.ts +5 -2
  498. package/Maths/math.vector.js +35 -32
  499. package/Maths/math.vector.js.map +1 -1
  500. package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
  501. package/Meshes/Builders/cylinderBuilder.js +1 -1
  502. package/Meshes/Builders/cylinderBuilder.js.map +1 -1
  503. package/Meshes/Builders/geodesicBuilder.d.ts +1 -0
  504. package/Meshes/Builders/geodesicBuilder.js +1 -0
  505. package/Meshes/Builders/geodesicBuilder.js.map +1 -1
  506. package/Meshes/Builders/goldbergBuilder.d.ts +1 -0
  507. package/Meshes/Builders/goldbergBuilder.js +1 -0
  508. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  509. package/Meshes/Builders/linesBuilder.js.map +1 -1
  510. package/Meshes/Builders/tiledBoxBuilder.d.ts +30 -11
  511. package/Meshes/Builders/tiledBoxBuilder.js +30 -11
  512. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  513. package/Meshes/Builders/tiledPlaneBuilder.d.ts +21 -16
  514. package/Meshes/Builders/tiledPlaneBuilder.js +21 -16
  515. package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
  516. package/Meshes/Compression/dracoCompression.d.ts +3 -0
  517. package/Meshes/Compression/dracoCompression.js +23 -7
  518. package/Meshes/Compression/dracoCompression.js.map +1 -1
  519. package/Meshes/abstractMesh.d.ts +6 -0
  520. package/Meshes/abstractMesh.js +18 -2
  521. package/Meshes/abstractMesh.js.map +1 -1
  522. package/Meshes/geometry.d.ts +1 -1
  523. package/Meshes/geometry.js +7 -3
  524. package/Meshes/geometry.js.map +1 -1
  525. package/Meshes/groundMesh.d.ts +1 -1
  526. package/Meshes/groundMesh.js.map +1 -1
  527. package/Meshes/mesh.js +21 -6
  528. package/Meshes/mesh.js.map +1 -1
  529. package/Meshes/mesh.lts.d.ts +1 -1
  530. package/Meshes/mesh.lts.js.map +1 -1
  531. package/Meshes/mesh.vertexData.d.ts +1 -1
  532. package/Meshes/mesh.vertexData.js +2 -2
  533. package/Meshes/mesh.vertexData.js.map +1 -1
  534. package/Meshes/polygonMesh.js +2 -2
  535. package/Meshes/polygonMesh.js.map +1 -1
  536. package/Meshes/subMesh.js +1 -2
  537. package/Meshes/subMesh.js.map +1 -1
  538. package/Meshes/subMesh.project.js +1 -2
  539. package/Meshes/subMesh.project.js.map +1 -1
  540. package/Meshes/thinInstanceMesh.js +5 -0
  541. package/Meshes/thinInstanceMesh.js.map +1 -1
  542. package/Meshes/trailMesh.d.ts +1 -1
  543. package/Meshes/trailMesh.js.map +1 -1
  544. package/Meshes/transformNode.js +40 -13
  545. package/Meshes/transformNode.js.map +1 -1
  546. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +5 -0
  547. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +13 -2
  548. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  549. package/Misc/PerformanceViewer/performanceViewerCollector.js +36 -19
  550. package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
  551. package/Misc/assetsManager.d.ts +2 -1
  552. package/Misc/assetsManager.js +15 -1
  553. package/Misc/assetsManager.js.map +1 -1
  554. package/Misc/basis.js +1 -1
  555. package/Misc/basis.js.map +1 -1
  556. package/Misc/brdfTextureTools.js +4 -1
  557. package/Misc/brdfTextureTools.js.map +1 -1
  558. package/Misc/dds.js +7 -0
  559. package/Misc/dds.js.map +1 -1
  560. package/Misc/devTools.js +1 -1
  561. package/Misc/devTools.js.map +1 -1
  562. package/Misc/environmentTextureTools.js +2 -2
  563. package/Misc/environmentTextureTools.js.map +1 -1
  564. package/Misc/fileTools.js +4 -4
  565. package/Misc/fileTools.js.map +1 -1
  566. package/Misc/index.d.ts +1 -0
  567. package/Misc/index.js +1 -0
  568. package/Misc/index.js.map +1 -1
  569. package/Misc/khronosTextureContainer2.js +4 -3
  570. package/Misc/khronosTextureContainer2.js.map +1 -1
  571. package/Misc/reflector.js +6 -6
  572. package/Misc/reflector.js.map +1 -1
  573. package/Misc/tools.js +15 -13
  574. package/Misc/tools.js.map +1 -1
  575. package/Misc/uniqueIdGenerator.js +1 -1
  576. package/Misc/uniqueIdGenerator.js.map +1 -1
  577. package/Offline/database.js +1 -1
  578. package/Offline/database.js.map +1 -1
  579. package/Particles/baseParticleSystem.d.ts +4 -1
  580. package/Particles/baseParticleSystem.js +20 -5
  581. package/Particles/baseParticleSystem.js.map +1 -1
  582. package/Particles/gpuParticleSystem.js +2 -1
  583. package/Particles/gpuParticleSystem.js.map +1 -1
  584. package/Particles/particleHelper.js +2 -2
  585. package/Particles/particleHelper.js.map +1 -1
  586. package/Physics/Plugins/ammoJSPlugin.d.ts +5 -1
  587. package/Physics/Plugins/ammoJSPlugin.js +16 -11
  588. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  589. package/Physics/physicsEngine.d.ts +1 -0
  590. package/Physics/physicsEngine.js +3 -1
  591. package/Physics/physicsEngine.js.map +1 -1
  592. package/Physics/physicsImpostor.d.ts +2 -2
  593. package/Physics/physicsImpostor.js.map +1 -1
  594. package/PostProcesses/blurPostProcess.js +5 -5
  595. package/PostProcesses/blurPostProcess.js.map +1 -1
  596. package/PostProcesses/imageProcessingPostProcess.js +1 -1
  597. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  598. package/PostProcesses/postProcess.js +1 -1
  599. package/PostProcesses/postProcess.js.map +1 -1
  600. package/PostProcesses/postProcessManager.js +2 -2
  601. package/PostProcesses/postProcessManager.js.map +1 -1
  602. package/Probes/reflectionProbe.js +2 -2
  603. package/Probes/reflectionProbe.js.map +1 -1
  604. package/Rendering/depthPeelingRenderer.js +3 -3
  605. package/Rendering/depthPeelingRenderer.js.map +1 -1
  606. package/Rendering/geometryBufferRenderer.js +8 -8
  607. package/Rendering/geometryBufferRenderer.js.map +1 -1
  608. package/Rendering/outlineRenderer.js +1 -1
  609. package/Rendering/outlineRenderer.js.map +1 -1
  610. package/Rendering/utilityLayerRenderer.js +4 -0
  611. package/Rendering/utilityLayerRenderer.js.map +1 -1
  612. package/Shaders/ShadersInclude/instancesDeclaration.js +1 -1
  613. package/Shaders/ShadersInclude/instancesDeclaration.js.map +1 -1
  614. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +1 -1
  615. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  616. package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +1 -1
  617. package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
  618. package/Shaders/ShadersInclude/prePassVertex.js +1 -1
  619. package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
  620. package/Shaders/color.fragment.js +1 -1
  621. package/Shaders/color.fragment.js.map +1 -1
  622. package/Shaders/color.vertex.js +1 -1
  623. package/Shaders/color.vertex.js.map +1 -1
  624. package/Shaders/default.fragment.js +1 -1
  625. package/Shaders/default.fragment.js.map +1 -1
  626. package/Shaders/default.vertex.js +1 -1
  627. package/Shaders/default.vertex.js.map +1 -1
  628. package/Shaders/pbr.vertex.js +1 -1
  629. package/Shaders/pbr.vertex.js.map +1 -1
  630. package/ShadersWGSL/ShadersInclude/instancesDeclaration.js +1 -1
  631. package/ShadersWGSL/ShadersInclude/instancesDeclaration.js.map +1 -1
  632. package/ShadersWGSL/gpuUpdateParticles.compute.js +1 -1
  633. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  634. package/Sprites/spriteManager.js +9 -10
  635. package/Sprites/spriteManager.js.map +1 -1
  636. package/Sprites/spriteMap.js +2 -2
  637. package/Sprites/spriteMap.js.map +1 -1
  638. package/Sprites/spriteRenderer.js +1 -1
  639. package/Sprites/spriteRenderer.js.map +1 -1
  640. package/XR/features/WebXRControllerPointerSelection.js +15 -9
  641. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  642. package/XR/features/WebXRDOMOverlay.js +1 -1
  643. package/XR/features/WebXRDOMOverlay.js.map +1 -1
  644. package/XR/features/WebXRHandTracking.js +30 -30
  645. package/XR/features/WebXRHandTracking.js.map +1 -1
  646. package/XR/features/WebXRImageTracking.js +2 -2
  647. package/XR/features/WebXRImageTracking.js.map +1 -1
  648. package/XR/features/WebXRLayers.d.ts +28 -5
  649. package/XR/features/WebXRLayers.js +54 -20
  650. package/XR/features/WebXRLayers.js.map +1 -1
  651. package/XR/features/WebXRNearInteraction.d.ts +35 -3
  652. package/XR/features/WebXRNearInteraction.js +201 -40
  653. package/XR/features/WebXRNearInteraction.js.map +1 -1
  654. package/XR/motionController/webXRAbstractMotionController.js +1 -1
  655. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  656. package/XR/motionController/webXRMotionControllerManager.js +2 -2
  657. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  658. package/XR/motionController/webXRProfiledMotionController.js +1 -1
  659. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  660. package/XR/webXRCamera.js +17 -4
  661. package/XR/webXRCamera.js.map +1 -1
  662. package/XR/webXRDefaultExperience.js +3 -0
  663. package/XR/webXRDefaultExperience.js.map +1 -1
  664. package/XR/webXREnterExitUI.js +2 -2
  665. package/XR/webXREnterExitUI.js.map +1 -1
  666. package/XR/webXRExperienceHelper.js +3 -2
  667. package/XR/webXRExperienceHelper.js.map +1 -1
  668. package/XR/webXRFeaturesManager.js +6 -6
  669. package/XR/webXRFeaturesManager.js.map +1 -1
  670. package/XR/webXRInputSource.js +3 -3
  671. package/XR/webXRInputSource.js.map +1 -1
  672. package/XR/webXRRenderTargetTextureProvider.d.ts +3 -2
  673. package/XR/webXRRenderTargetTextureProvider.js +37 -18
  674. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  675. package/XR/webXRSessionManager.d.ts +1 -0
  676. package/XR/webXRSessionManager.js +6 -1
  677. package/XR/webXRSessionManager.js.map +1 -1
  678. package/assetContainer.d.ts +1 -1
  679. package/assetContainer.js +4 -0
  680. package/assetContainer.js.map +1 -1
  681. package/node.d.ts +1 -1
  682. package/node.js.map +1 -1
  683. package/package.json +22 -13
  684. package/scene.d.ts +5 -2
  685. package/scene.js +31 -5
  686. package/scene.js.map +1 -1
  687. package/DeviceInput/Implementations/nativeDeviceInputSystem.js.map +0 -1
  688. package/DeviceInput/Implementations/webDeviceInputSystem.js.map +0 -1
  689. package/DeviceInput/Interfaces/inputInterfaces.js.map +0 -1
  690. package/DeviceInput/deviceInputSystem.d.ts +0 -60
  691. package/DeviceInput/deviceInputSystem.js +0 -84
  692. package/DeviceInput/deviceInputSystem.js.map +0 -1
@@ -14,7 +14,7 @@ import { VertexData } from "../mesh.vertexData";
14
14
  * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
15
15
  * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
16
16
  * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
17
- * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false
17
+ * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false
18
18
  * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake
19
19
  * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
20
20
  * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
@@ -16,7 +16,7 @@ import { Axis } from '../../Maths/math.axis.js';
16
16
  * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
17
17
  * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
18
18
  * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
19
- * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false
19
+ * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false
20
20
  * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake
21
21
  * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
22
22
  * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
@@ -1 +1 @@
1
- {"version":3,"file":"cylinderBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/cylinderBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,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CAAC,CAAC","sourcesContent":["import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Nullable } from \"../../types\";\r\nimport { Axis } from '../../Maths/math.axis';\r\n\r\n/**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\nexport function CreateCylinderVertexData(options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }): VertexData {\r\n var height: number = options.height || 2;\r\n var diameterTop: number = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom: number = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation: number = options.tessellation || 24;\r\n var subdivisions: number = options.subdivisions || 1;\r\n var hasRings: boolean = options.hasRings ? true : false;\r\n var enclose: boolean = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;\r\n var arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation: number = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb: number = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb: number = (hasRings) ? subdivisions : 1;\r\n var surfaceNb: number = 2 + (1 + quadNb) * ringNb;\r\n var f: number;\r\n\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n\r\n var indices = new Array<number>();\r\n var positions = new Array<number>();\r\n var normals = new Array<number>();\r\n var uvs = new Array<number>();\r\n var colors = new Array<number>();\r\n\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle: number;\r\n var h: number;\r\n var radius: number;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex: Vector3 = Vector3.Zero();\r\n var ringNormal: Vector3 = Vector3.Zero();\r\n var ringFirstVertex: Vector3 = Vector3.Zero();\r\n var ringFirstNormal: Vector3 = Vector3.Zero();\r\n var quadNormal: Vector3 = Vector3.Zero();\r\n var Y: Vector3 = Axis.Y;\r\n\r\n // positions, normals, uvs\r\n var i: number;\r\n var j: number;\r\n var r: number;\r\n var ringIdx: number = 1;\r\n var s: number = 1; // surface index\r\n var cs: number = 0;\r\n var v: number = 0;\r\n\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n } else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n } else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n } else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n // indices\r\n var e: number = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s: number;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n let i0: number = 0;\r\n let i1: number = 0;\r\n let i2: number = 0;\r\n let i3: number = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n\r\n // Caps\r\n var createCylinderCap = (isTop: boolean) => {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i: number;\r\n var u: Vector4 = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c: Nullable<Color4> = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n\r\n var textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n var textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n\r\n // add caps to geometry based on cap parameter\r\n if ((cap === Mesh.CAP_START)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === Mesh.CAP_END)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n var vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\nexport function CreateCylinder(name: string, options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], updatable?: boolean, hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 } = {}, scene: any): Mesh {\r\n var cylinder = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n var vertexData = CreateCylinderVertexData(options);\r\n\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n\r\n return cylinder;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated Please use CreateCylinder directly\r\n */\r\nexport const CylinderBuilder = {\r\n CreateCylinder\r\n};\r\n\r\nVertexData.CreateCylinder = CreateCylinderVertexData;\r\n\r\nMesh.CreateCylinder = (name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh => {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = <Scene>subdivisions;\r\n subdivisions = 1;\r\n }\r\n\r\n const options = {\r\n height,\r\n diameterTop,\r\n diameterBottom,\r\n tessellation,\r\n subdivisions,\r\n sideOrientation,\r\n updatable\r\n };\r\n\r\n return CreateCylinder(name, options, scene);\r\n};"]}
1
+ {"version":3,"file":"cylinderBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/cylinderBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAA2T;IAChW,IAAI,MAAM,GAAW,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IACzC,IAAI,WAAW,GAAW,CAAC,OAAO,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IACzG,IAAI,cAAc,GAAW,CAAC,OAAO,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IAClH,WAAW,GAAG,WAAW,IAAI,OAAO,CAAC,CAAC,yBAAyB;IAC/D,cAAc,GAAG,cAAc,IAAI,OAAO,CAAC,CAAC,yBAAyB;IACrE,IAAI,YAAY,GAAW,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;IACtD,IAAI,YAAY,GAAW,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC;IACrD,IAAI,QAAQ,GAAY,OAAO,CAAC,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,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE;QAClD,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,eAAe,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC;YAChD,SAAS,GAAG,KAAK,CAAC;SACrB;QACD,KAAK,GAAU,YAAY,CAAC;QAC5B,YAAY,GAAG,CAAC,CAAC;KACpB;IAED,IAAM,OAAO,GAAG;QACZ,MAAM,QAAA;QACN,WAAW,aAAA;QACX,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,eAAe,iBAAA;QACf,SAAS,WAAA;KACZ,CAAC;IAEF,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh, _CreationDataStorage } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Scene } from \"../../scene\";\r\nimport { Nullable } from \"../../types\";\r\nimport { Axis } from '../../Maths/math.axis';\r\n\r\n/**\r\n * Creates the VertexData for a cylinder, cone or prism\r\n * @param options an object used to set the following optional parameters for the box, required but can be empty\r\n * * height sets the height (y direction) of the cylinder, optional, default 2\r\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\r\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\r\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\r\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\r\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\r\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false\r\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @returns the VertexData of the cylinder, cone or prism\r\n */\r\nexport function CreateCylinderVertexData(options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }): VertexData {\r\n var height: number = options.height || 2;\r\n var diameterTop: number = (options.diameterTop === 0) ? 0 : options.diameterTop || options.diameter || 1;\r\n var diameterBottom: number = (options.diameterBottom === 0) ? 0 : options.diameterBottom || options.diameter || 1;\r\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\r\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\r\n var tessellation: number = options.tessellation || 24;\r\n var subdivisions: number = options.subdivisions || 1;\r\n var hasRings: boolean = options.hasRings ? true : false;\r\n var enclose: boolean = options.enclose ? true : false;\r\n var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;\r\n var arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\r\n var sideOrientation: number = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);\r\n var faceColors = options.faceColors;\r\n // default face colors and UV if undefined\r\n var quadNb: number = (arc !== 1 && enclose) ? 2 : 0;\r\n var ringNb: number = (hasRings) ? subdivisions : 1;\r\n var surfaceNb: number = 2 + (1 + quadNb) * ringNb;\r\n var f: number;\r\n\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceColors && faceColors[f] === undefined) {\r\n faceColors[f] = new Color4(1, 1, 1, 1);\r\n }\r\n }\r\n for (f = 0; f < surfaceNb; f++) {\r\n if (faceUV && faceUV[f] === undefined) {\r\n faceUV[f] = new Vector4(0, 0, 1, 1);\r\n }\r\n }\r\n\r\n var indices = new Array<number>();\r\n var positions = new Array<number>();\r\n var normals = new Array<number>();\r\n var uvs = new Array<number>();\r\n var colors = new Array<number>();\r\n\r\n var angle_step = Math.PI * 2 * arc / tessellation;\r\n var angle: number;\r\n var h: number;\r\n var radius: number;\r\n var tan = (diameterBottom - diameterTop) / 2 / height;\r\n var ringVertex: Vector3 = Vector3.Zero();\r\n var ringNormal: Vector3 = Vector3.Zero();\r\n var ringFirstVertex: Vector3 = Vector3.Zero();\r\n var ringFirstNormal: Vector3 = Vector3.Zero();\r\n var quadNormal: Vector3 = Vector3.Zero();\r\n var Y: Vector3 = Axis.Y;\r\n\r\n // positions, normals, uvs\r\n var i: number;\r\n var j: number;\r\n var r: number;\r\n var ringIdx: number = 1;\r\n var s: number = 1; // surface index\r\n var cs: number = 0;\r\n var v: number = 0;\r\n\r\n for (i = 0; i <= subdivisions; i++) {\r\n h = i / subdivisions;\r\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\r\n ringIdx = (hasRings && i !== 0 && i !== subdivisions) ? 2 : 1;\r\n for (r = 0; r < ringIdx; r++) {\r\n if (hasRings) {\r\n s += r;\r\n }\r\n if (enclose) {\r\n s += 2 * r;\r\n }\r\n for (j = 0; j <= tessellation; j++) {\r\n angle = j * angle_step;\r\n\r\n // position\r\n ringVertex.x = Math.cos(-angle) * radius;\r\n ringVertex.y = -height / 2 + h * height;\r\n ringVertex.z = Math.sin(-angle) * radius;\r\n\r\n // normal\r\n if (diameterTop === 0 && i === subdivisions) {\r\n // if no top cap, reuse former normals\r\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\r\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\r\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\r\n }\r\n else {\r\n ringNormal.x = ringVertex.x;\r\n ringNormal.z = ringVertex.z;\r\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\r\n ringNormal.normalize();\r\n }\r\n\r\n // keep first ring vertex values for enclose\r\n if (j === 0) {\r\n ringFirstVertex.copyFrom(ringVertex);\r\n ringFirstNormal.copyFrom(ringNormal);\r\n }\r\n\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s].y : faceUV[s].w;\r\n } else {\r\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\r\n }\r\n uvs.push(faceUV[s].x + (faceUV[s].z - faceUV[s].x) * j / tessellation, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\r\n }\r\n }\r\n\r\n // if enclose, add four vertices and their dedicated normals\r\n if (arc !== 1 && enclose) {\r\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(0, ringVertex.y, 0);\r\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\r\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\r\n quadNormal.normalize();\r\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 1].y : faceUV[s + 1].w;\r\n } else {\r\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\r\n }\r\n uvs.push(faceUV[s + 1].x, v);\r\n uvs.push(faceUV[s + 1].z, v);\r\n if (hasRings) {\r\n v = (cs !== s) ? faceUV[s + 2].y : faceUV[s + 2].w;\r\n } else {\r\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\r\n }\r\n uvs.push(faceUV[s + 2].x, v);\r\n uvs.push(faceUV[s + 2].z, v);\r\n if (faceColors) {\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\r\n }\r\n }\r\n if (cs !== s) {\r\n cs = s;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n // indices\r\n var e: number = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\r\n var s: number;\r\n i = 0;\r\n for (s = 0; s < subdivisions; s++) {\r\n let i0: number = 0;\r\n let i1: number = 0;\r\n let i2: number = 0;\r\n let i3: number = 0;\r\n for (j = 0; j < tessellation; j++) {\r\n i0 = i * (e + 1) + j;\r\n i1 = (i + 1) * (e + 1) + j;\r\n i2 = i * (e + 1) + (j + 1);\r\n i3 = (i + 1) * (e + 1) + (j + 1);\r\n indices.push(i0, i1, i2);\r\n indices.push(i3, i2, i1);\r\n }\r\n if (arc !== 1 && enclose) { // if enclose, add two quads\r\n indices.push(i0 + 2, i1 + 2, i2 + 2);\r\n indices.push(i3 + 2, i2 + 2, i1 + 2);\r\n indices.push(i0 + 4, i1 + 4, i2 + 4);\r\n indices.push(i3 + 4, i2 + 4, i1 + 4);\r\n }\r\n i = (hasRings) ? (i + 2) : (i + 1);\r\n }\r\n\r\n // Caps\r\n var createCylinderCap = (isTop: boolean) => {\r\n var radius = isTop ? diameterTop / 2 : diameterBottom / 2;\r\n if (radius === 0) {\r\n return;\r\n }\r\n\r\n // Cap positions, normals & uvs\r\n var angle;\r\n var circleVector;\r\n var i: number;\r\n var u: Vector4 = (isTop) ? faceUV[surfaceNb - 1] : faceUV[0];\r\n var c: Nullable<Color4> = null;\r\n if (faceColors) {\r\n c = (isTop) ? faceColors[surfaceNb - 1] : faceColors[0];\r\n }\r\n // cap center\r\n var vbase = positions.length / 3;\r\n var offset = isTop ? height / 2 : -height / 2;\r\n var center = new Vector3(0, offset, 0);\r\n positions.push(center.x, center.y, center.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * 0.5, u.y + (u.w - u.y) * 0.5);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n\r\n var textureScale = new Vector2(0.5, 0.5);\r\n for (i = 0; i <= tessellation; i++) {\r\n angle = Math.PI * 2 * i * arc / tessellation;\r\n var cos = Math.cos(-angle);\r\n var sin = Math.sin(-angle);\r\n circleVector = new Vector3(cos * radius, offset, sin * radius);\r\n var textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\r\n positions.push(circleVector.x, circleVector.y, circleVector.z);\r\n normals.push(0, isTop ? 1 : -1, 0);\r\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, u.y + (u.w - u.y) * textureCoordinate.y);\r\n if (c) {\r\n colors.push(c.r, c.g, c.b, c.a);\r\n }\r\n }\r\n // Cap indices\r\n for (i = 0; i < tessellation; i++) {\r\n if (!isTop) {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 1));\r\n indices.push(vbase + (i + 2));\r\n }\r\n else {\r\n indices.push(vbase);\r\n indices.push(vbase + (i + 2));\r\n indices.push(vbase + (i + 1));\r\n }\r\n }\r\n };\r\n\r\n // add caps to geometry based on cap parameter\r\n if ((cap === Mesh.CAP_START)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(false);\r\n }\r\n if ((cap === Mesh.CAP_END)\r\n || (cap === Mesh.CAP_ALL)) {\r\n createCylinderCap(true);\r\n }\r\n\r\n // Sides\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\r\n\r\n var vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n if (faceColors) {\r\n vertexData.colors = colors;\r\n }\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a cylinder or a cone mesh\r\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\r\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\r\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\r\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\r\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\r\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\r\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\r\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\r\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\r\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\r\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\r\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\r\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\r\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\r\n * * If `enclose` is false, a ring surface is one element.\r\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\r\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\r\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\r\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the cylinder mesh\r\n * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone\r\n */\r\nexport function CreateCylinder(name: string, options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], updatable?: boolean, hasRings?: boolean, enclose?: boolean, cap?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 } = {}, scene: any): Mesh {\r\n var cylinder = new Mesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n var vertexData = CreateCylinderVertexData(options);\r\n\r\n vertexData.applyToMesh(cylinder, options.updatable);\r\n\r\n return cylinder;\r\n}\r\n\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated Please use CreateCylinder directly\r\n */\r\nexport const CylinderBuilder = {\r\n CreateCylinder\r\n};\r\n\r\nVertexData.CreateCylinder = CreateCylinderVertexData;\r\n\r\nMesh.CreateCylinder = (name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh => {\r\n if (scene === undefined || !(scene instanceof Scene)) {\r\n if (scene !== undefined) {\r\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\r\n updatable = scene;\r\n }\r\n scene = <Scene>subdivisions;\r\n subdivisions = 1;\r\n }\r\n\r\n const options = {\r\n height,\r\n diameterTop,\r\n diameterBottom,\r\n tessellation,\r\n subdivisions,\r\n sideOrientation,\r\n updatable\r\n };\r\n\r\n return CreateCylinder(name, options, scene);\r\n};"]}
@@ -6,6 +6,7 @@ import { Nullable } from '../../types';
6
6
  /**
7
7
  * Creates the Mesh for a Geodesic Polyhedron
8
8
  * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron
9
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly
9
10
  * @param name defines the name of the mesh
10
11
  * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
11
12
  * * m number of horizontal steps along an isogrid
@@ -4,6 +4,7 @@ import { _PrimaryIsoTriangle, GeodesicData } from "../geodesicMesh.js";
4
4
  /**
5
5
  * Creates the Mesh for a Geodesic Polyhedron
6
6
  * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron
7
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly
7
8
  * @param name defines the name of the mesh
8
9
  * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
9
10
  * * m number of horizontal steps along an isogrid
@@ -1 +1 @@
1
- {"version":3,"file":"geodesicBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/geodesicBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gB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OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KAC3B,CAAC;IACF,IAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { CreatePolyhedron } from \"./polyhedronBuilder\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh\";\r\n\r\n/**\r\n * Creates the Mesh for a Geodesic Polyhedron\r\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * m number of horizontal steps along an isogrid\r\n * * n number of angled steps along an isogrid\r\n * * size the size of the Geodesic, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @param scene defines the hosting scene\r\n * @returns Geodesic mesh\r\n */\r\nexport function CreateGeodesic(name: string, options: { m?: number, n?: number, size?: number, sizeX?: number, sizeY?: number, sizeZ?: number, faceUV?: Vector4[], faceColors?: Color4[], flat?: boolean, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: Nullable<Scene> = null): Mesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n\r\n const geoOptions: object = {\r\n custom: geodesicData,\r\n size: options.size,\r\n sizeX: options.sizeX,\r\n sizeY: options.sizeY,\r\n sizeZ: options.sizeZ,\r\n faceUV: options.faceUV,\r\n faceColors: options.faceColors,\r\n flat: options.flat,\r\n updatable: options.updatable,\r\n sideOrientation: options.sideOrientation,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs\r\n };\r\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\r\n\r\n return geodesic;\r\n}"]}
1
+ {"version":3,"file":"geodesicBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/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QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KAC3B,CAAC;IACF,IAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,QAAQ,CAAC;AACpB,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector4 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { CreatePolyhedron } from \"./polyhedronBuilder\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh\";\r\n\r\n/**\r\n * Creates the Mesh for a Geodesic Polyhedron\r\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/geodesic_poly\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * * m number of horizontal steps along an isogrid\r\n * * n number of angled steps along an isogrid\r\n * * size the size of the Geodesic, optional default 1\r\n * * sizeX allows stretching in the x direction, optional, default size\r\n * * sizeY allows stretching in the y direction, optional, default size\r\n * * sizeZ allows stretching in the z direction, optional, default size\r\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\r\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\r\n * * flat when true creates a flat shaded mesh, optional, default true\r\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\r\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\r\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\r\n * @param scene defines the hosting scene\r\n * @returns Geodesic mesh\r\n */\r\nexport function CreateGeodesic(name: string, options: { m?: number, n?: number, size?: number, sizeX?: number, sizeY?: number, sizeZ?: number, faceUV?: Vector4[], faceColors?: Color4[], flat?: boolean, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: Nullable<Scene> = null): Mesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n\r\n const geoOptions: object = {\r\n custom: geodesicData,\r\n size: options.size,\r\n sizeX: options.sizeX,\r\n sizeY: options.sizeY,\r\n sizeZ: options.sizeZ,\r\n faceUV: options.faceUV,\r\n faceColors: options.faceColors,\r\n flat: options.flat,\r\n updatable: options.updatable,\r\n sideOrientation: options.sideOrientation,\r\n frontUVs: options.frontUVs,\r\n backUVs: options.backUVs\r\n };\r\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\r\n\r\n return geodesic;\r\n}"]}
@@ -56,6 +56,7 @@ export declare function CreateGoldbergVertexData(options: GoldbergVertexDataOpti
56
56
  /**
57
57
  * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
58
58
  * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
59
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly
59
60
  * @param name defines the name of the mesh
60
61
  * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
61
62
  * @param scene defines the hosting scene
@@ -63,6 +63,7 @@ export function CreateGoldbergVertexData(options, goldbergData) {
63
63
  /**
64
64
  * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
65
65
  * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
66
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly
66
67
  * @param name defines the name of the mesh
67
68
  * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty
68
69
  * @param scene defines the hosting scene
@@ -1 +1 @@
1
- {"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/goldbergBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8C/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAiC,EAAE,YAA4B;IAC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,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAC/C,IAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAC9C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACrD,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData, PolyhedronData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\n\r\n/**\r\n * Defines the set of data required to create goldberg vertex data.\r\n */\r\nexport type GoldbergVertexDataOption = {\r\n /**\r\n * the size of the Goldberg, optional default 1\r\n */\r\n size?: number,\r\n /**\r\n * allows stretching in the x direction, optional, default size\r\n */\r\n sizeX?: number,\r\n /**\r\n * allows stretching in the y direction, optional, default size\r\n */\r\n sizeY?: number,\r\n /**\r\n * allows stretching in the z direction, optional, default size\r\n */\r\n sizeZ?: number,\r\n /**\r\n * optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n */\r\n sideOrientation?: number;\r\n};\r\n\r\n/**\r\n * Defines the set of data required to create a goldberg mesh.\r\n */\r\nexport type GoldbergCreationOption = {\r\n /**\r\n * number of horizontal steps along an isogrid\r\n */\r\n m?: number;\r\n /**\r\n * number of angled steps along an isogrid\r\n */\r\n n?: number;\r\n /**\r\n * defines if the mesh must be flagged as updatable\r\n */\r\n updatable?: boolean;\r\n} & GoldbergVertexDataOption;\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param goldBergData polyhedronData defining the Goldberg polyhedron\r\n * @returns GoldbergSphere mesh\r\n */\r\nexport function CreateGoldbergVertexData(options: GoldbergVertexDataOption, goldbergData: PolyhedronData): VertexData {\r\n const size = options.size;\r\n const sizeX: number = options.sizeX || size || 1;\r\n const sizeY: number = options.sizeY || size || 1;\r\n const sizeZ: number = options.sizeZ || size || 1;\r\n const sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const positions = new Array<number>();\r\n const indices = new Array<number>();\r\n const normals = new Array<number>();\r\n const uvs = new Array<number>();\r\n\r\n let minX = Infinity;\r\n let maxX = -Infinity;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n\r\n for (let v = 0; v < goldbergData.vertex.length; v++) {\r\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\r\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\r\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\r\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\r\n }\r\n\r\n let index: number = 0;\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n for (let v = 0; v < verts.length; v++) {\r\n normals.push(norm.x, norm.y, norm.z);\r\n const pdata = goldbergData.vertex[verts[v]];\r\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), (pdata[1] * sizeY - minY) / (maxY - minY));\r\n }\r\n for (let v = 0; v < verts.length - 2; v++) {\r\n indices.push(index, index + v + 2, index + v + 1);\r\n }\r\n index += verts.length;\r\n }\r\n\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n */\r\nexport function CreateGoldberg(name: string, options: GoldbergCreationOption, scene: Nullable<Scene> = null): GoldbergMesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\r\n\r\n const goldberg = new GoldbergMesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\r\n\r\n vertexData.applyToMesh(goldberg, options.updatable);\r\n\r\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\r\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\r\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\r\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\r\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\r\n for (let f = 0; f < geodesicData.vertex.length; f++) {\r\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\r\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\r\n }\r\n\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n const z = Vector3.Cross(ca, norm).normalize();\r\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\r\n goldberg.goldbergData.faceYaxis.push(norm);\r\n goldberg.goldbergData.faceZaxis.push(z);\r\n }\r\n\r\n return goldberg;\r\n}\r\n\r\nMesh.CreateGoldberg = CreateGoldberg;\r\n"]}
1
+ {"version":3,"file":"goldbergBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/goldbergBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8C/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAiC,EAAE,YAA4B;IACpG,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,KAAK,GAAW,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC;IACjD,IAAM,eAAe,GAAG,CAAC,OAAO,CAAC,eAAe,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,IAAI,UAAU,CAAC,WAAW,CAAC;IAEhH,IAAM,SAAS,GAAG,IAAI,KAAK,EAAU,CAAC;IACtC,IAAM,OAAO,GAAG,IAAI,KAAK,EAAU,CAAC;IACpC,IAAM,OAAO,GAAG,IAAI,KAAK,EAAU,CAAC;IACpC,IAAM,GAAG,GAAG,IAAI,KAAK,EAAU,CAAC;IAEhC,IA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AY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC","sourcesContent":["import { Scene } from \"../../scene\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Nullable } from '../../types';\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { _PrimaryIsoTriangle, GeodesicData, PolyhedronData } from \"../geodesicMesh\";\r\nimport { GoldbergMesh } from \"../goldbergMesh\";\r\n\r\n/**\r\n * Defines the set of data required to create goldberg vertex data.\r\n */\r\nexport type GoldbergVertexDataOption = {\r\n /**\r\n * the size of the Goldberg, optional default 1\r\n */\r\n size?: number,\r\n /**\r\n * allows stretching in the x direction, optional, default size\r\n */\r\n sizeX?: number,\r\n /**\r\n * allows stretching in the y direction, optional, default size\r\n */\r\n sizeY?: number,\r\n /**\r\n * allows stretching in the z direction, optional, default size\r\n */\r\n sizeZ?: number,\r\n /**\r\n * optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\r\n */\r\n sideOrientation?: number;\r\n};\r\n\r\n/**\r\n * Defines the set of data required to create a goldberg mesh.\r\n */\r\nexport type GoldbergCreationOption = {\r\n /**\r\n * number of horizontal steps along an isogrid\r\n */\r\n m?: number;\r\n /**\r\n * number of angled steps along an isogrid\r\n */\r\n n?: number;\r\n /**\r\n * defines if the mesh must be flagged as updatable\r\n */\r\n updatable?: boolean;\r\n} & GoldbergVertexDataOption;\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param goldBergData polyhedronData defining the Goldberg polyhedron\r\n * @returns GoldbergSphere mesh\r\n */\r\nexport function CreateGoldbergVertexData(options: GoldbergVertexDataOption, goldbergData: PolyhedronData): VertexData {\r\n const size = options.size;\r\n const sizeX: number = options.sizeX || size || 1;\r\n const sizeY: number = options.sizeY || size || 1;\r\n const sizeZ: number = options.sizeZ || size || 1;\r\n const sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\r\n\r\n const positions = new Array<number>();\r\n const indices = new Array<number>();\r\n const normals = new Array<number>();\r\n const uvs = new Array<number>();\r\n\r\n let minX = Infinity;\r\n let maxX = -Infinity;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n\r\n for (let v = 0; v < goldbergData.vertex.length; v++) {\r\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\r\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\r\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\r\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\r\n }\r\n\r\n let index: number = 0;\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n for (let v = 0; v < verts.length; v++) {\r\n normals.push(norm.x, norm.y, norm.z);\r\n const pdata = goldbergData.vertex[verts[v]];\r\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\r\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), (pdata[1] * sizeY - minY) / (maxY - minY));\r\n }\r\n for (let v = 0; v < verts.length - 2; v++) {\r\n indices.push(index, index + v + 2, index + v + 1);\r\n }\r\n index += verts.length;\r\n }\r\n\r\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\r\n\r\n const vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n vertexData.normals = normals;\r\n vertexData.uvs = uvs;\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\r\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\r\n * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/polyhedra/goldberg_poly\r\n * @param name defines the name of the mesh\r\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\r\n * @param scene defines the hosting scene\r\n * @returns Goldberg mesh\r\n */\r\nexport function CreateGoldberg(name: string, options: GoldbergCreationOption, scene: Nullable<Scene> = null): GoldbergMesh {\r\n let m: number = options.m || 1;\r\n if (m !== Math.floor(m)) {\r\n m === Math.floor(m);\r\n Logger.Warn(\"m not an integer only floor(m) used\");\r\n }\r\n let n: number = options.n || 0;\r\n if (n !== Math.floor(n)) {\r\n n === Math.floor(n);\r\n Logger.Warn(\"n not an integer only floor(n) used\");\r\n }\r\n if (n > m) {\r\n const temp = n;\r\n n = m;\r\n m = temp;\r\n Logger.Warn(\"n > m therefore m and n swapped\");\r\n }\r\n const primTri: _PrimaryIsoTriangle = new _PrimaryIsoTriangle();\r\n primTri.build(m, n);\r\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\r\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\r\n\r\n const goldberg = new GoldbergMesh(name, scene);\r\n\r\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\r\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\r\n\r\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\r\n\r\n vertexData.applyToMesh(goldberg, options.updatable);\r\n\r\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\r\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\r\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\r\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\r\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\r\n for (let f = 0; f < geodesicData.vertex.length; f++) {\r\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\r\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\r\n }\r\n\r\n for (let f = 0; f < goldbergData.face.length; f++) {\r\n const verts = goldbergData.face[f];\r\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\r\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\r\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\r\n const ba = b.subtract(a);\r\n const ca = c.subtract(a);\r\n const norm = Vector3.Cross(ca, ba).normalize();\r\n const z = Vector3.Cross(ca, norm).normalize();\r\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\r\n goldberg.goldbergData.faceYaxis.push(norm);\r\n goldberg.goldbergData.faceZaxis.push(z);\r\n }\r\n\r\n return goldberg;\r\n}\r\n\r\nMesh.CreateGoldberg = CreateGoldberg;\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"linesBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/linesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAA8D;IACrG,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,SAAS,GAAG,EAAE,CA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AAmB,EAAE,QAAoB;IAAxE,sBAAA,EAAA,YAA6B;IACvI,IAAI,OAAO,GAAG;QACV,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE,QAAQ;KACrB,CAAC;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { _CreationDataStorage, Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { FloatArray, Nullable } from \"../../types\";\r\nimport { LinesMesh } from \"../../Meshes/linesMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\ndeclare type Material = import(\"../../Materials/material\").Material;\r\n\r\n/**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\nexport function CreateLineSystemVertexData(options: { lines: Vector3[][], colors?: Nullable<Color4[][]> }): VertexData {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\nexport function CreateDashedLinesVertexData(options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number }): VertexData {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n\r\n var positions = new Array<number>();\r\n var indices = new Array<number>();\r\n\r\n var curvect = Vector3.Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\nexport function CreateLineSystem(name: string, options: { lines: Vector3[][], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Nullable<Color4[][]>, useVertexAlpha?: boolean; material?: Material }, scene: Nullable<Scene>): LinesMesh {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(VertexBuffer.PositionKind)!;\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind)!;\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha, options.material);\r\n var vertexData = CreateLineSystemVertexData(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n}\r\n\r\n/**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\nexport function CreateLines(name: string, options: { points: Vector3[], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Color4[], useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha, material: options.material }, scene);\r\n return lines;\r\n}\r\n\r\n/**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\nexport function CreateDashedLines(name: string, options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number, updatable?: boolean, instance?: LinesMesh, useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n\r\n if (instance) { // dashed lines update\r\n var positionFunction = (positions: FloatArray): void => {\r\n var curvect = Vector3.Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n let dashSize = instance!._creationDataStorage!.dashSize;\r\n let gapSize = instance!._creationDataStorage!.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha, options.material);\r\n var vertexData = CreateDashedLinesVertexData(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n\r\n dashedLines._creationDataStorage = new _CreationDataStorage();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const LinesBuilder = {\r\n CreateDashedLines,\r\n CreateLineSystem,\r\n CreateLines\r\n};\r\n\r\nVertexData.CreateLineSystem = CreateLineSystemVertexData;\r\nVertexData.CreateDashedLines = CreateDashedLinesVertexData;\r\n\r\nMesh.CreateLines = (name: string, points: Vector3[], scene: Nullable<Scene> = null, updatable: boolean = false, instance: Nullable<LinesMesh> = null): LinesMesh => {\r\n var options = {\r\n points: points,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return CreateLines(name, options, scene);\r\n};\r\n\r\nMesh.CreateDashedLines = (name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Nullable<Scene> = null, updatable?: boolean, instance?: LinesMesh): LinesMesh => {\r\n var options = {\r\n points: points,\r\n dashSize: dashSize,\r\n gapSize: gapSize,\r\n dashNb: dashNb,\r\n updatable: updatable,\r\n instance: instance\r\n };\r\n return CreateDashedLines(name, options, scene);\r\n};"]}
1
+ {"version":3,"file":"linesBuilder.js","sourceRoot":"","sources":["../../../../sourceES6/core/Meshes/Builders/linesBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAA8D;IACrG,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC1B,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC5B,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,I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,UAAA;KACX,CAAC;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Color4 } from '../../Maths/math.color';\r\nimport { _CreationDataStorage, Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { FloatArray, Nullable } from \"../../types\";\r\nimport { LinesMesh } from \"../../Meshes/linesMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\ndeclare type Material = import(\"../../Materials/material\").Material;\r\n\r\n/**\r\n * Creates the VertexData of the LineSystem\r\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\r\n * - lines an array of lines, each line being an array of successive Vector3\r\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\r\n * @returns the VertexData of the LineSystem\r\n */\r\nexport function CreateLineSystemVertexData(options: { lines: Vector3[][], colors?: Nullable<Color4[][]> }): VertexData {\r\n var indices = [];\r\n var positions = [];\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n var vertexColors = [];\r\n var idx = 0;\r\n\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var index = 0; index < points.length; index++) {\r\n positions.push(points[index].x, points[index].y, points[index].z);\r\n if (colors) {\r\n var color = colors[l];\r\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\r\n }\r\n if (index > 0) {\r\n indices.push(idx - 1);\r\n indices.push(idx);\r\n }\r\n idx++;\r\n }\r\n }\r\n var vertexData = new VertexData();\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n if (colors) {\r\n vertexData.colors = vertexColors;\r\n }\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Create the VertexData for a DashedLines\r\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\r\n * - points an array successive Vector3\r\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\r\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\r\n * - dashNb the intended total number of dashes, optional, default 200\r\n * @returns the VertexData for the DashedLines\r\n */\r\nexport function CreateDashedLinesVertexData(options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number }): VertexData {\r\n var dashSize = options.dashSize || 3;\r\n var gapSize = options.gapSize || 1;\r\n var dashNb = options.dashNb || 200;\r\n var points = options.points;\r\n\r\n var positions = new Array<number>();\r\n var indices = new Array<number>();\r\n\r\n var curvect = Vector3.Zero();\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var idx = 0;\r\n var i = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / dashNb;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n for (var j = 0; j < nb; j++) {\r\n curshft = shft * j;\r\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\r\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\r\n indices.push(idx, idx + 1);\r\n idx += 2;\r\n }\r\n }\r\n\r\n // Result\r\n var vertexData = new VertexData();\r\n vertexData.positions = positions;\r\n vertexData.indices = indices;\r\n\r\n return vertexData;\r\n}\r\n\r\n/**\r\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\r\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\r\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\r\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#line-system\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line system mesh\r\n */\r\nexport function CreateLineSystem(name: string, options: { lines: Vector3[][], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Nullable<Color4[][]>, useVertexAlpha?: boolean; material?: Material }, scene: Nullable<Scene>): LinesMesh {\r\n var instance = options.instance;\r\n var lines = options.lines;\r\n var colors = options.colors;\r\n\r\n if (instance) { // lines update\r\n var positions = instance.getVerticesData(VertexBuffer.PositionKind)!;\r\n var vertexColor;\r\n var lineColors;\r\n if (colors) {\r\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind)!;\r\n }\r\n var i = 0;\r\n var c = 0;\r\n for (var l = 0; l < lines.length; l++) {\r\n var points = lines[l];\r\n for (var p = 0; p < points.length; p++) {\r\n positions[i] = points[p].x;\r\n positions[i + 1] = points[p].y;\r\n positions[i + 2] = points[p].z;\r\n if (colors && vertexColor) {\r\n lineColors = colors[l];\r\n vertexColor[c] = lineColors[p].r;\r\n vertexColor[c + 1] = lineColors[p].g;\r\n vertexColor[c + 2] = lineColors[p].b;\r\n vertexColor[c + 3] = lineColors[p].a;\r\n c += 4;\r\n }\r\n i += 3;\r\n }\r\n }\r\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\r\n if (colors && vertexColor) {\r\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\r\n }\r\n return instance;\r\n }\r\n\r\n // line system creation\r\n var useVertexColor = (colors) ? true : false;\r\n var lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha, options.material);\r\n var vertexData = CreateLineSystemVertexData(options);\r\n vertexData.applyToMesh(lineSystem, options.updatable);\r\n return lineSystem;\r\n}\r\n\r\n/**\r\n * Creates a line mesh\r\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `colors` is an array of successive Color4, one per line point\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#lines\r\n * @param name defines the name of the new line system\r\n * @param options defines the options used to create the line system\r\n * @param scene defines the hosting scene\r\n * @returns a new line mesh\r\n */\r\nexport function CreateLines(name: string, options: { points: Vector3[], updatable?: boolean, instance?: Nullable<LinesMesh>, colors?: Color4[], useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var colors = (options.colors) ? [options.colors] : null;\r\n var lines = CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha, material: options.material }, scene);\r\n return lines;\r\n}\r\n\r\n/**\r\n * Creates a dashed line mesh\r\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\r\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\r\n * * The parameter `points` is an array successive Vector3\r\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\r\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\r\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\r\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines\r\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\r\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\r\n * * When updating an instance, remember that only point positions can change, not the number of points\r\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\r\n * @param name defines the name of the mesh\r\n * @param options defines the options used to create the mesh\r\n * @param scene defines the hosting scene\r\n * @returns the dashed line mesh\r\n * @see https://doc.babylonjs.com/how_to/parametric_shapes#dashed-lines\r\n */\r\nexport function CreateDashedLines(name: string, options: { points: Vector3[], dashSize?: number, gapSize?: number, dashNb?: number, updatable?: boolean, instance?: LinesMesh, useVertexAlpha?: boolean, material?: Material }, scene: Nullable<Scene> = null): LinesMesh {\r\n var points = options.points;\r\n var instance = options.instance;\r\n var gapSize = options.gapSize || 1;\r\n var dashSize = options.dashSize || 3;\r\n\r\n if (instance) { // dashed lines update\r\n var positionFunction = (positions: FloatArray): void => {\r\n var curvect = Vector3.Zero();\r\n var nbSeg = positions.length / 6;\r\n var lg = 0;\r\n var nb = 0;\r\n var shft = 0;\r\n var dashshft = 0;\r\n var curshft = 0;\r\n var p = 0;\r\n var i = 0;\r\n var j = 0;\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n lg += curvect.length();\r\n }\r\n shft = lg / nbSeg;\r\n let dashSize = instance!._creationDataStorage!.dashSize;\r\n let gapSize = instance!._creationDataStorage!.gapSize;\r\n dashshft = dashSize * shft / (dashSize + gapSize);\r\n for (i = 0; i < points.length - 1; i++) {\r\n points[i + 1].subtractToRef(points[i], curvect);\r\n nb = Math.floor(curvect.length() / shft);\r\n curvect.normalize();\r\n j = 0;\r\n while (j < nb && p < positions.length) {\r\n curshft = shft * j;\r\n positions[p] = points[i].x + curshft * curvect.x;\r\n positions[p + 1] = points[i].y + curshft * curvect.y;\r\n positions[p + 2] = points[i].z + curshft * curvect.z;\r\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\r\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\r\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\r\n p += 6;\r\n j++;\r\n }\r\n }\r\n while (p < positions.length) {\r\n positions[p] = points[i].x;\r\n positions[p + 1] = points[i].y;\r\n positions[p + 2] = points[i].z;\r\n p += 3;\r\n }\r\n };\r\n instance.updateMeshPositions(positionFunction, false);\r\n return instance;\r\n }\r\n // dashed lines creation\r\n var dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha, options.material);\r\n var vertexData = CreateDashedLinesVertexData(options);\r\n vertexData.applyToMesh(dashedLines, options.updatable);\r\n\r\n dashedLines._creationDataStorage = new _CreationDataStorage();\r\n dashedLines._creationDataStorage.dashSize = dashSize;\r\n dashedLines._creationDataStorage.gapSize = gapSize;\r\n return dashedLines;\r\n}\r\n/**\r\n * Class containing static functions to help procedurally build meshes\r\n * @deprecated use the functions directly from the module\r\n */\r\nexport const LinesBuilder = {\r\n CreateDashedLines,\r\n CreateLineSystem,\r\n CreateLines\r\n};\r\n\r\nVertexData.CreateLineSystem = CreateLineSystemVertexData;\r\nVertexData.CreateDashedLines = CreateDashedLinesVertexData;\r\n\r\nMesh.CreateLines = (name: string, points: Vector3[], scene: Nullable<Scene> = null, updatable: boolean = false, instance: Nullable<LinesMesh> = null): LinesMesh => {\r\n var options = {\r\n points,\r\n updatable,\r\n instance\r\n };\r\n return CreateLines(name, options, scene);\r\n};\r\n\r\nMesh.CreateDashedLines = (name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Nullable<Scene> = null, updatable?: boolean, instance?: LinesMesh): LinesMesh => {\r\n var options = {\r\n points,\r\n dashSize,\r\n gapSize,\r\n dashNb,\r\n updatable,\r\n instance\r\n };\r\n return CreateDashedLines(name, options, scene);\r\n};"]}
@@ -6,12 +6,22 @@ import { Mesh } from "../mesh";
6
6
  import { VertexData } from "../mesh.vertexData";
7
7
  /**
8
8
  * Creates the VertexData for a tiled box
9
- * @param options an object used to set the following optional parameters for the box, required but can be empty
10
- * * faceTiles sets the pattern, tile size and number of tiles for a face
9
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
10
+ * @param options an object used to set the following optional parameters for the tiled box, required but can be empty
11
+ * * pattern sets the rotation or reflection pattern for the tiles,
12
+ * * size of the box
13
+ * * width of the box, overwrites size
14
+ * * height of the box, overwrites size
15
+ * * depth of the box, overwrites size
16
+ * * tileSize sets the size of a tile
17
+ * * tileWidth sets the tile width and overwrites tileSize
18
+ * * tileHeight sets the tile width and overwrites tileSize
11
19
  * * faceUV an array of 6 Vector4 elements used to set different images to each box side
12
20
  * * faceColors an array of 6 Color3 elements used to set different colors to each box side
21
+ * * alignHorizontal places whole tiles aligned to the center, left or right of a row
22
+ * * alignVertical places whole tiles aligned to the center, left or right of a column
13
23
  * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
14
- * @returns the VertexData of the box
24
+ * @returns the VertexData of the TiledBox
15
25
  */
16
26
  export declare function CreateTiledBoxVertexData(options: {
17
27
  pattern?: number;
@@ -29,14 +39,23 @@ export declare function CreateTiledBoxVertexData(options: {
29
39
  sideOrientation?: number;
30
40
  }): VertexData;
31
41
  /**
32
- * Creates a box mesh
33
- * faceTiles sets the pattern, tile size and number of tiles for a face * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)
34
- * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
35
- * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
36
- * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
37
- * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
42
+ * Creates a tiled box mesh
43
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
38
44
  * @param name defines the name of the mesh
39
- * @param options defines the options used to create the mesh
45
+ * @param options an object used to set the following optional parameters for the tiled box, required but can be empty
46
+ * * pattern sets the rotation or reflection pattern for the tiles,
47
+ * * size of the box
48
+ * * width of the box, overwrites size
49
+ * * height of the box, overwrites size
50
+ * * depth of the box, overwrites size
51
+ * * tileSize sets the size of a tile
52
+ * * tileWidth sets the tile width and overwrites tileSize
53
+ * * tileHeight sets the tile width and overwrites tileSize
54
+ * * faceUV an array of 6 Vector4 elements used to set different images to each box side
55
+ * * faceColors an array of 6 Color3 elements used to set different colors to each box side
56
+ * * alignHorizontal places whole tiles aligned to the center, left or right of a row
57
+ * * alignVertical places whole tiles aligned to the center, left or right of a column
58
+ * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
40
59
  * @param scene defines the hosting scene
41
60
  * @returns the box mesh
42
61
  */
@@ -57,7 +76,7 @@ export declare function CreateTiledBox(name: string, options: {
57
76
  }, scene?: Nullable<Scene>): Mesh;
58
77
  /**
59
78
  * Class containing static functions to help procedurally build meshes
60
- * @deprecated use CreateTildeBox instead
79
+ * @deprecated use CreateTiledBox instead
61
80
  */
62
81
  export declare const TiledBoxBuilder: {
63
82
  CreateTiledBox: typeof CreateTiledBox;
@@ -5,12 +5,22 @@ import { VertexData } from "../mesh.vertexData.js";
5
5
  import { CreateTiledPlaneVertexData } from "./tiledPlaneBuilder.js";
6
6
  /**
7
7
  * Creates the VertexData for a tiled box
8
- * @param options an object used to set the following optional parameters for the box, required but can be empty
9
- * * faceTiles sets the pattern, tile size and number of tiles for a face
8
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
9
+ * @param options an object used to set the following optional parameters for the tiled box, required but can be empty
10
+ * * pattern sets the rotation or reflection pattern for the tiles,
11
+ * * size of the box
12
+ * * width of the box, overwrites size
13
+ * * height of the box, overwrites size
14
+ * * depth of the box, overwrites size
15
+ * * tileSize sets the size of a tile
16
+ * * tileWidth sets the tile width and overwrites tileSize
17
+ * * tileHeight sets the tile width and overwrites tileSize
10
18
  * * faceUV an array of 6 Vector4 elements used to set different images to each box side
11
19
  * * faceColors an array of 6 Color3 elements used to set different colors to each box side
20
+ * * alignHorizontal places whole tiles aligned to the center, left or right of a row
21
+ * * alignVertical places whole tiles aligned to the center, left or right of a column
12
22
  * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
13
- * @returns the VertexData of the box
23
+ * @returns the VertexData of the TiledBox
14
24
  */
15
25
  export function CreateTiledBoxVertexData(options) {
16
26
  var nbFaces = 6;
@@ -151,14 +161,23 @@ export function CreateTiledBoxVertexData(options) {
151
161
  return vertexData;
152
162
  }
153
163
  /**
154
- * Creates a box mesh
155
- * faceTiles sets the pattern, tile size and number of tiles for a face * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)
156
- * * Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
157
- * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
158
- * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
159
- * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
164
+ * Creates a tiled box mesh
165
+ * @see https://doc.babylonjs.com/divingDeeper/mesh/creation/set/tiled_box
160
166
  * @param name defines the name of the mesh
161
- * @param options defines the options used to create the mesh
167
+ * @param options an object used to set the following optional parameters for the tiled box, required but can be empty
168
+ * * pattern sets the rotation or reflection pattern for the tiles,
169
+ * * size of the box
170
+ * * width of the box, overwrites size
171
+ * * height of the box, overwrites size
172
+ * * depth of the box, overwrites size
173
+ * * tileSize sets the size of a tile
174
+ * * tileWidth sets the tile width and overwrites tileSize
175
+ * * tileHeight sets the tile width and overwrites tileSize
176
+ * * faceUV an array of 6 Vector4 elements used to set different images to each box side
177
+ * * faceColors an array of 6 Color3 elements used to set different colors to each box side
178
+ * * alignHorizontal places whole tiles aligned to the center, left or right of a row
179
+ * * alignVertical places whole tiles aligned to the center, left or right of a column
180
+ * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
162
181
  * @param scene defines the hosting scene
163
182
  * @returns the box mesh
164
183
  */
@@ -173,7 +192,7 @@ export function CreateTiledBox(name, options, scene) {
173
192
  }
174
193
  /**
175
194
  * Class containing static functions to help procedurally build meshes
176
- * @deprecated use CreateTildeBox instead
195
+ * @deprecated use CreateTiledBox instead
177
196
  */
178
197
  export var TiledBoxBuilder = {
179
198
  CreateTiledBox: CreateTiledBox