@babylonjs/core 6.29.0 → 6.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/Actions/abstractActionManager.js +1 -1
  2. package/Actions/abstractActionManager.js.map +1 -1
  3. package/Actions/actionManager.js +3 -3
  4. package/Actions/actionManager.js.map +1 -1
  5. package/Animations/animatable.js +1 -1
  6. package/Animations/animatable.js.map +1 -1
  7. package/Animations/animation.js +2 -2
  8. package/Animations/animation.js.map +1 -1
  9. package/Animations/pathCursor.js +1 -1
  10. package/Animations/pathCursor.js.map +1 -1
  11. package/Audio/audioSceneComponent.js +2 -2
  12. package/Audio/audioSceneComponent.js.map +1 -1
  13. package/Audio/soundTrack.js +1 -1
  14. package/Audio/soundTrack.js.map +1 -1
  15. package/Behaviors/Meshes/fadeInOutBehavior.js +1 -2
  16. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  17. package/Bones/bone.js +2 -2
  18. package/Bones/bone.js.map +1 -1
  19. package/Bones/skeleton.js +2 -2
  20. package/Bones/skeleton.js.map +1 -1
  21. package/Cameras/arcRotateCamera.js +13 -37
  22. package/Cameras/arcRotateCamera.js.map +1 -1
  23. package/Cameras/camera.d.ts +0 -21
  24. package/Cameras/camera.js +1 -36
  25. package/Cameras/camera.js.map +1 -1
  26. package/Cameras/targetCamera.js +30 -51
  27. package/Cameras/targetCamera.js.map +1 -1
  28. package/Culling/Octrees/octree.js +1 -1
  29. package/Culling/Octrees/octree.js.map +1 -1
  30. package/Culling/Octrees/octreeBlock.js +1 -1
  31. package/Culling/Octrees/octreeBlock.js.map +1 -1
  32. package/Culling/ray.js +1 -1
  33. package/Culling/ray.js.map +1 -1
  34. package/Debug/axesViewer.d.ts +3 -1
  35. package/Debug/axesViewer.js +14 -11
  36. package/Debug/axesViewer.js.map +1 -1
  37. package/Engines/Extensions/engine.multiRender.js +8 -8
  38. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  39. package/Engines/Extensions/engine.textureSelector.js +1 -1
  40. package/Engines/Extensions/engine.textureSelector.js.map +1 -1
  41. package/Engines/Processors/shaderCodeInliner.js +1 -1
  42. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  43. package/Engines/WebGPU/Extensions/engine.computeShader.js +2 -10
  44. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  45. package/Engines/WebGPU/Extensions/engine.debugging.js +3 -6
  46. package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
  47. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -1
  48. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  49. package/Engines/WebGPU/Extensions/engine.multiRender.js +9 -14
  50. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  51. package/Engines/WebGPU/Extensions/engine.query.js +2 -6
  52. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  53. package/Engines/WebGPU/Extensions/engine.renderTarget.js +6 -10
  54. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  55. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +1 -1
  56. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  57. package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -2
  58. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  59. package/Engines/WebGPU/webgpuBundleList.js +2 -1
  60. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  61. package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -1
  62. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  63. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -1
  64. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -7
  65. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  66. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
  67. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +2 -2
  68. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  69. package/Engines/WebGPU/webgpuCacheSampler.d.ts +1 -1
  70. package/Engines/WebGPU/webgpuCacheSampler.js +5 -5
  71. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  72. package/Engines/WebGPU/webgpuClearQuad.js +2 -2
  73. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  74. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -12
  75. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  76. package/Engines/WebGPU/webgpuMaterialContext.d.ts +3 -3
  77. package/Engines/WebGPU/webgpuMaterialContext.js +14 -10
  78. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  79. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -12
  80. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  81. package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +5 -8
  82. package/Engines/WebGPU/webgpuSnapshotRendering.js +24 -33
  83. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  84. package/Engines/WebGPU/webgpuTextureHelper.d.ts +2 -1
  85. package/Engines/WebGPU/webgpuTextureHelper.js +11 -16
  86. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  87. package/Engines/constants.d.ts +2 -2
  88. package/Engines/constants.js +2 -2
  89. package/Engines/constants.js.map +1 -1
  90. package/Engines/engine.js +2 -2
  91. package/Engines/engine.js.map +1 -1
  92. package/Engines/engineCapabilities.d.ts +2 -0
  93. package/Engines/engineCapabilities.js.map +1 -1
  94. package/Engines/engineStore.js +1 -1
  95. package/Engines/engineStore.js.map +1 -1
  96. package/Engines/nativeEngine.js +1 -0
  97. package/Engines/nativeEngine.js.map +1 -1
  98. package/Engines/nullEngine.js +1 -0
  99. package/Engines/nullEngine.js.map +1 -1
  100. package/Engines/thinEngine.js +6 -2
  101. package/Engines/thinEngine.js.map +1 -1
  102. package/Engines/webgpuEngine.d.ts +27 -32
  103. package/Engines/webgpuEngine.js +237 -317
  104. package/Engines/webgpuEngine.js.map +1 -1
  105. package/Gizmos/boundingBoxGizmo.js +1 -1
  106. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  107. package/Gizmos/cameraGizmo.d.ts +3 -1
  108. package/Gizmos/cameraGizmo.js +11 -8
  109. package/Gizmos/cameraGizmo.js.map +1 -1
  110. package/Layers/effectLayerSceneComponent.js +2 -2
  111. package/Layers/effectLayerSceneComponent.js.map +1 -1
  112. package/Layers/layerSceneComponent.js +1 -1
  113. package/Layers/layerSceneComponent.js.map +1 -1
  114. package/LensFlares/lensFlareSystem.js +1 -1
  115. package/LensFlares/lensFlareSystem.js.map +1 -1
  116. package/LensFlares/lensFlareSystemSceneComponent.js +2 -2
  117. package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
  118. package/Lights/Shadows/shadowGenerator.js +1 -1
  119. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  120. package/Lights/light.js +2 -2
  121. package/Lights/light.js.map +1 -1
  122. package/Loading/Plugins/babylonFileLoader.js +1 -1
  123. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  124. package/Loading/sceneLoader.js +3 -3
  125. package/Loading/sceneLoader.js.map +1 -1
  126. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +2 -2
  127. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -1
  128. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +4 -1
  129. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  130. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  131. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  132. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
  133. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  134. package/Materials/Node/nodeMaterial.js +1 -1
  135. package/Materials/Node/nodeMaterial.js.map +1 -1
  136. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +2 -2
  137. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  138. package/Materials/Node/nodeMaterialBuildState.js +4 -4
  139. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  140. package/Materials/Node/nodeMaterialBuildStateSharedData.js +12 -12
  141. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  142. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js +1 -1
  143. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  144. package/Materials/Textures/baseTexture.js +1 -1
  145. package/Materials/Textures/baseTexture.js.map +1 -1
  146. package/Materials/Textures/dynamicTexture.d.ts +4 -3
  147. package/Materials/Textures/dynamicTexture.js +10 -6
  148. package/Materials/Textures/dynamicTexture.js.map +1 -1
  149. package/Materials/Textures/externalTexture.d.ts +4 -0
  150. package/Materials/Textures/externalTexture.js +4 -0
  151. package/Materials/Textures/externalTexture.js.map +1 -1
  152. package/Materials/Textures/internalTexture.d.ts +0 -4
  153. package/Materials/Textures/internalTexture.js.map +1 -1
  154. package/Materials/Textures/renderTargetTexture.js +1 -1
  155. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  156. package/Materials/Textures/textureSampler.d.ts +4 -0
  157. package/Materials/Textures/textureSampler.js.map +1 -1
  158. package/Materials/material.js +1 -1
  159. package/Materials/material.js.map +1 -1
  160. package/Materials/multiMaterial.js +1 -1
  161. package/Materials/multiMaterial.js.map +1 -1
  162. package/Materials/shaderMaterial.js +1 -1
  163. package/Materials/shaderMaterial.js.map +1 -1
  164. package/Maths/math.path.d.ts +9 -1
  165. package/Maths/math.path.js +23 -7
  166. package/Maths/math.path.js.map +1 -1
  167. package/Maths/math.vector.d.ts +93 -0
  168. package/Maths/math.vector.js +157 -26
  169. package/Maths/math.vector.js.map +1 -1
  170. package/Meshes/Builders/cylinderBuilder.js +5 -5
  171. package/Meshes/Builders/cylinderBuilder.js.map +1 -1
  172. package/Meshes/Builders/decalBuilder.js +1 -1
  173. package/Meshes/Builders/decalBuilder.js.map +1 -1
  174. package/Meshes/Builders/discBuilder.js +4 -4
  175. package/Meshes/Builders/discBuilder.js.map +1 -1
  176. package/Meshes/Builders/goldbergBuilder.js +4 -4
  177. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  178. package/Meshes/Builders/groundBuilder.js +4 -4
  179. package/Meshes/Builders/groundBuilder.js.map +1 -1
  180. package/Meshes/Builders/icoSphereBuilder.js +4 -4
  181. package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
  182. package/Meshes/Builders/latheBuilder.js +1 -1
  183. package/Meshes/Builders/latheBuilder.js.map +1 -1
  184. package/Meshes/Builders/linesBuilder.js +2 -2
  185. package/Meshes/Builders/linesBuilder.js.map +1 -1
  186. package/Meshes/Builders/polyhedronBuilder.js +6 -6
  187. package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
  188. package/Meshes/Builders/shapeBuilder.js +1 -1
  189. package/Meshes/Builders/shapeBuilder.js.map +1 -1
  190. package/Meshes/Builders/textBuilder.js +13 -5
  191. package/Meshes/Builders/textBuilder.js.map +1 -1
  192. package/Meshes/Builders/torusKnotBuilder.js +4 -4
  193. package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
  194. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -1
  195. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  196. package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -0
  197. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  198. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -0
  199. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  200. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -0
  201. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  202. package/Meshes/Node/Blocks/Sources/discBlock.js +1 -0
  203. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  204. package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -0
  205. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  206. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -0
  207. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  208. package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -0
  209. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  210. package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -0
  211. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  212. package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -0
  213. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  214. package/Meshes/Node/nodeGeometry.js +1 -1
  215. package/Meshes/Node/nodeGeometry.js.map +1 -1
  216. package/Meshes/Node/nodeGeometryBlock.js +1 -0
  217. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  218. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +14 -0
  219. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +32 -5
  220. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  221. package/Meshes/abstractMesh.js +5 -5
  222. package/Meshes/abstractMesh.js.map +1 -1
  223. package/Meshes/csg.js +5 -5
  224. package/Meshes/csg.js.map +1 -1
  225. package/Meshes/geodesicMesh.js +1 -1
  226. package/Meshes/geodesicMesh.js.map +1 -1
  227. package/Meshes/mesh.js +14 -10
  228. package/Meshes/mesh.js.map +1 -1
  229. package/Meshes/mesh.vertexData.js +1 -1
  230. package/Meshes/mesh.vertexData.js.map +1 -1
  231. package/Meshes/meshSimplification.js +2 -2
  232. package/Meshes/meshSimplification.js.map +1 -1
  233. package/Meshes/polygonMesh.js +7 -7
  234. package/Meshes/polygonMesh.js.map +1 -1
  235. package/Meshes/thinInstanceMesh.js +1 -1
  236. package/Meshes/thinInstanceMesh.js.map +1 -1
  237. package/Misc/codeStringParsingTools.d.ts +2 -1
  238. package/Misc/codeStringParsingTools.js +3 -2
  239. package/Misc/codeStringParsingTools.js.map +1 -1
  240. package/Misc/dds.js +1 -1
  241. package/Misc/dds.js.map +1 -1
  242. package/Misc/filesInput.js +1 -1
  243. package/Misc/filesInput.js.map +1 -1
  244. package/Misc/greasedLineTools.d.ts +2 -1
  245. package/Misc/greasedLineTools.js +2 -0
  246. package/Misc/greasedLineTools.js.map +1 -1
  247. package/Misc/precisionDate.js +4 -2
  248. package/Misc/precisionDate.js.map +1 -1
  249. package/Misc/sceneOptimizer.js +2 -2
  250. package/Misc/sceneOptimizer.js.map +1 -1
  251. package/Morph/morphTarget.js +1 -1
  252. package/Morph/morphTarget.js.map +1 -1
  253. package/Particles/gpuParticleSystem.js +1 -1
  254. package/Particles/gpuParticleSystem.js.map +1 -1
  255. package/Particles/particleSystem.js +2 -2
  256. package/Particles/particleSystem.js.map +1 -1
  257. package/Particles/particleSystemComponent.js +2 -2
  258. package/Particles/particleSystemComponent.js.map +1 -1
  259. package/Particles/particleSystemSet.js +1 -1
  260. package/Particles/particleSystemSet.js.map +1 -1
  261. package/Physics/v1/Plugins/cannonJSPlugin.js +2 -2
  262. package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -1
  263. package/Physics/v2/Plugins/havokPlugin.js +3 -1
  264. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  265. package/PostProcesses/postProcess.d.ts +1 -0
  266. package/PostProcesses/postProcess.js +30 -23
  267. package/PostProcesses/postProcess.js.map +1 -1
  268. package/PostProcesses/volumetricLightScatteringPostProcess.js +2 -2
  269. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  270. package/Probes/reflectionProbe.js +1 -1
  271. package/Probes/reflectionProbe.js.map +1 -1
  272. package/Rendering/edgesRenderer.js +3 -3
  273. package/Rendering/edgesRenderer.js.map +1 -1
  274. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +2 -1
  275. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
  276. package/Rendering/prePassRenderer.js +8 -4
  277. package/Rendering/prePassRenderer.js.map +1 -1
  278. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -1
  279. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  280. package/Sprites/spriteManager.js +1 -1
  281. package/Sprites/spriteManager.js.map +1 -1
  282. package/Sprites/spriteMap.js +4 -4
  283. package/Sprites/spriteMap.js.map +1 -1
  284. package/Sprites/spriteSceneComponent.js +2 -2
  285. package/Sprites/spriteSceneComponent.js.map +1 -1
  286. package/XR/features/WebXRFeaturePointSystem.js +2 -2
  287. package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
  288. package/abstractScene.js +16 -16
  289. package/abstractScene.js.map +1 -1
  290. package/assetContainer.js +2 -2
  291. package/assetContainer.js.map +1 -1
  292. package/node.js +2 -2
  293. package/node.js.map +1 -1
  294. package/package.json +1 -1
  295. package/scene.d.ts +0 -4
  296. package/scene.js +6 -12
  297. package/scene.js.map +1 -1
  298. package/Engines/WebGPU/webgpuRenderPassWrapper.d.ts +0 -13
  299. package/Engines/WebGPU/webgpuRenderPassWrapper.js +0 -18
  300. package/Engines/WebGPU/webgpuRenderPassWrapper.js.map +0 -1
@@ -293,12 +293,36 @@ export declare class Vector2 {
293
293
  * @returns the current updated Vector2
294
294
  */
295
295
  normalize(): this;
296
+ /**
297
+ * Normalize the current Vector2 with the given input length.
298
+ * Please note that this is an in place operation.
299
+ * @param len the length of the vector
300
+ * @returns the current updated Vector2
301
+ */
302
+ normalizeFromLength(len: number): this;
303
+ /**
304
+ * Normalize the current Vector2 to a new vector
305
+ * @returns the new Vector2
306
+ */
307
+ normalizeToNew(): this;
308
+ /**
309
+ * Normalize the current Vector2 to the reference
310
+ * @param reference define the Vector2 to update
311
+ * @returns the updated Vector2
312
+ */
313
+ normalizeToRef<T extends Vector2>(reference: T): T;
296
314
  /**
297
315
  * Gets a new Vector2 copied from the Vector2
298
316
  * Example Playground https://playground.babylonjs.com/#QYBWV4#20
299
317
  * @returns a new Vector2
300
318
  */
301
319
  clone(): this;
320
+ /**
321
+ * Gets the dot product of the current vector and the vector "otherVector"
322
+ * @param otherVector defines second vector
323
+ * @returns the dot product (float)
324
+ */
325
+ dot(otherVector: DeepImmutable<this>): number;
302
326
  /**
303
327
  * Gets a new Vector2(0, 0)
304
328
  * @returns a new Vector2
@@ -1387,6 +1411,12 @@ export declare class Vector3 {
1387
1411
  * @returns the dot product
1388
1412
  */
1389
1413
  static Dot(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>): number;
1414
+ /**
1415
+ * Returns the dot product (float) between the current vectors and "otherVector"
1416
+ * @param otherVector defines the right operand
1417
+ * @returns the dot product
1418
+ */
1419
+ dot(otherVector: DeepImmutable<this>): number;
1390
1420
  /**
1391
1421
  * Returns a new Vector3 as the cross product of the vectors "left" and "right"
1392
1422
  * The cross product is then orthogonal to both "left" and "right"
@@ -1870,6 +1900,24 @@ export declare class Vector4 {
1870
1900
  * @returns the updated Vector4.
1871
1901
  */
1872
1902
  normalize(): this;
1903
+ /**
1904
+ * Normalize the current Vector4 with the given input length.
1905
+ * Please note that this is an in place operation.
1906
+ * @param len the length of the vector
1907
+ * @returns the current updated Vector4
1908
+ */
1909
+ normalizeFromLength(len: number): this;
1910
+ /**
1911
+ * Normalize the current Vector4 to a new vector
1912
+ * @returns the new Vector4
1913
+ */
1914
+ normalizeToNew(): this;
1915
+ /**
1916
+ * Normalize the current Vector4 to the reference
1917
+ * @param reference define the Vector4 to update
1918
+ * @returns the updated Vector4
1919
+ */
1920
+ normalizeToRef<T extends Vector4>(reference: T): T;
1873
1921
  /**
1874
1922
  * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
1875
1923
  * @returns this converted to a new vector3
@@ -1910,6 +1958,12 @@ export declare class Vector4 {
1910
1958
  * @returns the current updated Vector3
1911
1959
  */
1912
1960
  setAll(v: number): this;
1961
+ /**
1962
+ * Returns the dot product (float) between the current vectors and "otherVector"
1963
+ * @param otherVector defines the right operand
1964
+ * @returns the dot product
1965
+ */
1966
+ dot(otherVector: DeepImmutable<this>): number;
1913
1967
  /**
1914
1968
  * Returns a new Vector4 set from the starting index of the given array.
1915
1969
  * @param array the array to pull values from
@@ -2087,6 +2141,13 @@ export declare class Vector4 {
2087
2141
  * @returns a new Vector4
2088
2142
  */
2089
2143
  static FromVector3(source: Vector3, w?: number): Vector4;
2144
+ /**
2145
+ * Returns the dot product (float) between the vectors "left" and "right"
2146
+ * @param left defines the left operand
2147
+ * @param right defines the right operand
2148
+ * @returns the dot product
2149
+ */
2150
+ static Dot(left: DeepImmutable<Vector4>, right: DeepImmutable<Vector4>): number;
2090
2151
  }
2091
2152
  /**
2092
2153
  * Class used to store quaternion data
@@ -2331,12 +2392,25 @@ export declare class Quaternion {
2331
2392
  * @returns the current updated quaternion
2332
2393
  */
2333
2394
  normalize(): this;
2395
+ /**
2396
+ * Normalize the current quaternion with the given input length.
2397
+ * Please note that this is an in place operation.
2398
+ * @param len the length of the quaternion
2399
+ * @returns the current updated Quaternion
2400
+ */
2401
+ normalizeFromLength(len: number): this;
2334
2402
  /**
2335
2403
  * Normalize a copy of the current quaternion
2336
2404
  * Example Playground https://playground.babylonjs.com/#L49EJ7#55
2337
2405
  * @returns the normalized quaternion
2338
2406
  */
2339
2407
  normalizeToNew(): this;
2408
+ /**
2409
+ * Normalize the current Quaternion to the reference
2410
+ * @param reference define the Quaternion to update
2411
+ * @returns the updated Quaternion
2412
+ */
2413
+ normalizeToRef<T extends Quaternion>(reference: T): T;
2340
2414
  /**
2341
2415
  * Returns a new Vector3 set with the Euler angles translated from the current quaternion
2342
2416
  * Example Playground https://playground.babylonjs.com/#L49EJ7#32
@@ -2366,6 +2440,12 @@ export declare class Quaternion {
2366
2440
  * @returns the current updated quaternion
2367
2441
  */
2368
2442
  fromRotationMatrix(matrix: DeepImmutable<Matrix>): this;
2443
+ /**
2444
+ * Returns the dot product (float) between the current quaternions and "other"
2445
+ * @param other defines the right operand
2446
+ * @returns the dot product
2447
+ */
2448
+ dot(other: DeepImmutable<this>): number;
2369
2449
  /**
2370
2450
  * Creates a new quaternion from a rotation matrix
2371
2451
  * Example Playground https://playground.babylonjs.com/#L49EJ7#101
@@ -2666,6 +2746,19 @@ export declare class Quaternion {
2666
2746
  * @returns result input
2667
2747
  */
2668
2748
  static Hermite1stDerivativeToRef<T extends Quaternion>(value1: DeepImmutable<Quaternion>, tangent1: DeepImmutable<Quaternion>, value2: DeepImmutable<Quaternion>, tangent2: DeepImmutable<Quaternion>, time: number, result: T): T;
2749
+ /**
2750
+ * Returns a new Quaternion as the normalization of the given Quaternion
2751
+ * @param quat defines the Quaternion to normalize
2752
+ * @returns the new Quaternion
2753
+ */
2754
+ static Normalize(quat: DeepImmutable<Quaternion>): Quaternion;
2755
+ /**
2756
+ * Sets the given Quaternion "result" with the normalization of the given first Quaternion
2757
+ * @param quat defines the Quaternion to normalize
2758
+ * @param result defines the Quaternion where to store the result
2759
+ * @returns result input
2760
+ */
2761
+ static NormalizeToRef<T extends Quaternion>(quat: DeepImmutable<Quaternion>, result: T): T;
2669
2762
  }
2670
2763
  /**
2671
2764
  * Class used to store matrix data (4x4)
@@ -82,7 +82,7 @@ export class Vector2 {
82
82
  * @returns a new array with 2 elements: the Vector2 coordinates.
83
83
  */
84
84
  asArray() {
85
- const result = new Array();
85
+ const result = [];
86
86
  this.toArray(result, 0);
87
87
  return result;
88
88
  }
@@ -412,8 +412,40 @@ export class Vector2 {
412
412
  * @returns the current updated Vector2
413
413
  */
414
414
  normalize() {
415
- Vector2.NormalizeToRef(this, this);
416
- return this;
415
+ return this.normalizeFromLength(this.length());
416
+ }
417
+ /**
418
+ * Normalize the current Vector2 with the given input length.
419
+ * Please note that this is an in place operation.
420
+ * @param len the length of the vector
421
+ * @returns the current updated Vector2
422
+ */
423
+ normalizeFromLength(len) {
424
+ if (len === 0 || len === 1.0) {
425
+ return this;
426
+ }
427
+ return this.scaleInPlace(1.0 / len);
428
+ }
429
+ /**
430
+ * Normalize the current Vector2 to a new vector
431
+ * @returns the new Vector2
432
+ */
433
+ normalizeToNew() {
434
+ const normalized = new this.constructor(0, 0);
435
+ this.normalizeToRef(normalized);
436
+ return normalized;
437
+ }
438
+ /**
439
+ * Normalize the current Vector2 to the reference
440
+ * @param reference define the Vector2 to update
441
+ * @returns the updated Vector2
442
+ */
443
+ normalizeToRef(reference) {
444
+ const len = this.length();
445
+ if (len === 0 || len === 1.0) {
446
+ return reference.copyFromFloats(this.x, this.y);
447
+ }
448
+ return this.scaleToRef(1.0 / len, reference);
417
449
  }
418
450
  /**
419
451
  * Gets a new Vector2 copied from the Vector2
@@ -423,6 +455,14 @@ export class Vector2 {
423
455
  clone() {
424
456
  return new this.constructor(this.x, this.y);
425
457
  }
458
+ /**
459
+ * Gets the dot product of the current vector and the vector "otherVector"
460
+ * @param otherVector defines second vector
461
+ * @returns the dot product (float)
462
+ */
463
+ dot(otherVector) {
464
+ return this.x * otherVector.x + this.y * otherVector.y;
465
+ }
426
466
  // Statics
427
467
  /**
428
468
  * Gets a new Vector2(0, 0)
@@ -603,9 +643,9 @@ export class Vector2 {
603
643
  * @returns a new Vector2
604
644
  */
605
645
  static Normalize(vector) {
606
- const newVector = new vector.constructor();
607
- this.NormalizeToRef(vector, newVector);
608
- return newVector;
646
+ const result = new vector.constructor();
647
+ Vector2.NormalizeToRef(vector, result);
648
+ return result;
609
649
  }
610
650
  /**
611
651
  * Normalize a given vector into a second one
@@ -615,12 +655,7 @@ export class Vector2 {
615
655
  * @returns result input
616
656
  */
617
657
  static NormalizeToRef(vector, result) {
618
- const len = vector.length();
619
- if (len === 0) {
620
- return result;
621
- }
622
- result.x = vector.x / len;
623
- result.y = vector.y / len;
658
+ vector.normalizeToRef(result);
624
659
  return result;
625
660
  }
626
661
  /**
@@ -2149,6 +2184,14 @@ export class Vector3 {
2149
2184
  static Dot(left, right) {
2150
2185
  return left._x * right._x + left._y * right._y + left._z * right._z;
2151
2186
  }
2187
+ /**
2188
+ * Returns the dot product (float) between the current vectors and "otherVector"
2189
+ * @param otherVector defines the right operand
2190
+ * @returns the dot product
2191
+ */
2192
+ dot(otherVector) {
2193
+ return this._x * otherVector._x + this._y * otherVector._y + this._z * otherVector._z;
2194
+ }
2152
2195
  /**
2153
2196
  * Returns a new Vector3 as the cross product of the vectors "left" and "right"
2154
2197
  * The cross product is then orthogonal to both "left" and "right"
@@ -2660,7 +2703,7 @@ export class Vector4 {
2660
2703
  * @returns the resulting array
2661
2704
  */
2662
2705
  asArray() {
2663
- const result = new Array();
2706
+ const result = [];
2664
2707
  this.toArray(result, 0);
2665
2708
  return result;
2666
2709
  }
@@ -3038,12 +3081,41 @@ export class Vector4 {
3038
3081
  * @returns the updated Vector4.
3039
3082
  */
3040
3083
  normalize() {
3041
- const len = this.length();
3042
- if (len === 0) {
3084
+ return this.normalizeFromLength(this.length());
3085
+ }
3086
+ /**
3087
+ * Normalize the current Vector4 with the given input length.
3088
+ * Please note that this is an in place operation.
3089
+ * @param len the length of the vector
3090
+ * @returns the current updated Vector4
3091
+ */
3092
+ normalizeFromLength(len) {
3093
+ if (len === 0 || len === 1.0) {
3043
3094
  return this;
3044
3095
  }
3045
3096
  return this.scaleInPlace(1.0 / len);
3046
3097
  }
3098
+ /**
3099
+ * Normalize the current Vector4 to a new vector
3100
+ * @returns the new Vector4
3101
+ */
3102
+ normalizeToNew() {
3103
+ const normalized = new this.constructor(0, 0, 0, 0);
3104
+ this.normalizeToRef(normalized);
3105
+ return normalized;
3106
+ }
3107
+ /**
3108
+ * Normalize the current Vector4 to the reference
3109
+ * @param reference define the Vector4 to update
3110
+ * @returns the updated Vector4
3111
+ */
3112
+ normalizeToRef(reference) {
3113
+ const len = this.length();
3114
+ if (len === 0 || len === 1.0) {
3115
+ return reference.copyFromFloats(this.x, this.y, this.z, this.w);
3116
+ }
3117
+ return this.scaleToRef(1.0 / len, reference);
3118
+ }
3047
3119
  /**
3048
3120
  * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
3049
3121
  * @returns this converted to a new vector3
@@ -3105,6 +3177,14 @@ export class Vector4 {
3105
3177
  this.x = this.y = this.z = this.w = v;
3106
3178
  return this;
3107
3179
  }
3180
+ /**
3181
+ * Returns the dot product (float) between the current vectors and "otherVector"
3182
+ * @param otherVector defines the right operand
3183
+ * @returns the dot product
3184
+ */
3185
+ dot(otherVector) {
3186
+ return this.x * otherVector.x + this.y * otherVector.y + this.z * otherVector.z + this.w * otherVector.w;
3187
+ }
3108
3188
  // Statics
3109
3189
  /**
3110
3190
  * Returns a new Vector4 set from the starting index of the given array.
@@ -3205,8 +3285,7 @@ export class Vector4 {
3205
3285
  * @returns result input
3206
3286
  */
3207
3287
  static NormalizeToRef(vector, result) {
3208
- result.copyFrom(vector);
3209
- result.normalize();
3288
+ vector.normalizeToRef(result);
3210
3289
  return result;
3211
3290
  }
3212
3291
  /**
@@ -3382,6 +3461,15 @@ export class Vector4 {
3382
3461
  static FromVector3(source, w = 0) {
3383
3462
  return new Vector4(source._x, source._y, source._z, w);
3384
3463
  }
3464
+ /**
3465
+ * Returns the dot product (float) between the vectors "left" and "right"
3466
+ * @param left defines the left operand
3467
+ * @param right defines the right operand
3468
+ * @returns the dot product
3469
+ */
3470
+ static Dot(left, right) {
3471
+ return left.dot(right);
3472
+ }
3385
3473
  }
3386
3474
  Vector4._ZeroReadOnly = Vector4.Zero();
3387
3475
  /**
@@ -3778,13 +3866,19 @@ export class Quaternion {
3778
3866
  * @returns the current updated quaternion
3779
3867
  */
3780
3868
  normalize() {
3781
- const len = this.length();
3782
- if (len === 0) {
3869
+ return this.normalizeFromLength(this.length());
3870
+ }
3871
+ /**
3872
+ * Normalize the current quaternion with the given input length.
3873
+ * Please note that this is an in place operation.
3874
+ * @param len the length of the quaternion
3875
+ * @returns the current updated Quaternion
3876
+ */
3877
+ normalizeFromLength(len) {
3878
+ if (len === 0 || len === 1.0) {
3783
3879
  return this;
3784
3880
  }
3785
- const inv = 1.0 / len;
3786
- this.scaleInPlace(inv);
3787
- return this;
3881
+ return this.scaleInPlace(1.0 / len);
3788
3882
  }
3789
3883
  /**
3790
3884
  * Normalize a copy of the current quaternion
@@ -3792,12 +3886,21 @@ export class Quaternion {
3792
3886
  * @returns the normalized quaternion
3793
3887
  */
3794
3888
  normalizeToNew() {
3889
+ const normalized = new this.constructor(0, 0, 0, 1);
3890
+ this.normalizeToRef(normalized);
3891
+ return normalized;
3892
+ }
3893
+ /**
3894
+ * Normalize the current Quaternion to the reference
3895
+ * @param reference define the Quaternion to update
3896
+ * @returns the updated Quaternion
3897
+ */
3898
+ normalizeToRef(reference) {
3795
3899
  const len = this.length();
3796
- if (len === 0) {
3797
- return this.clone();
3900
+ if (len === 0 || len === 1.0) {
3901
+ return reference.copyFromFloats(this._x, this._y, this._z, this._w);
3798
3902
  }
3799
- const inv = 1.0 / len;
3800
- return this.scale(inv);
3903
+ return this.scaleToRef(1.0 / len, reference);
3801
3904
  }
3802
3905
  /**
3803
3906
  * Returns a new Vector3 set with the Euler angles translated from the current quaternion
@@ -3868,6 +3971,14 @@ export class Quaternion {
3868
3971
  Quaternion.FromRotationMatrixToRef(matrix, this);
3869
3972
  return this;
3870
3973
  }
3974
+ /**
3975
+ * Returns the dot product (float) between the current quaternions and "other"
3976
+ * @param other defines the right operand
3977
+ * @returns the dot product
3978
+ */
3979
+ dot(other) {
3980
+ return this._x * other._x + this._y * other._y + this._z * other._z + this._w * other._w;
3981
+ }
3871
3982
  // Statics
3872
3983
  /**
3873
3984
  * Creates a new quaternion from a rotation matrix
@@ -4401,6 +4512,26 @@ export class Quaternion {
4401
4512
  result._isDirty = true;
4402
4513
  return result;
4403
4514
  }
4515
+ /**
4516
+ * Returns a new Quaternion as the normalization of the given Quaternion
4517
+ * @param quat defines the Quaternion to normalize
4518
+ * @returns the new Quaternion
4519
+ */
4520
+ static Normalize(quat) {
4521
+ const result = Quaternion.Zero();
4522
+ Quaternion.NormalizeToRef(quat, result);
4523
+ return result;
4524
+ }
4525
+ /**
4526
+ * Sets the given Quaternion "result" with the normalization of the given first Quaternion
4527
+ * @param quat defines the Quaternion to normalize
4528
+ * @param result defines the Quaternion where to store the result
4529
+ * @returns result input
4530
+ */
4531
+ static NormalizeToRef(quat, result) {
4532
+ quat.normalizeToRef(result);
4533
+ return result;
4534
+ }
4404
4535
  }
4405
4536
  /**
4406
4537
  * Class used to store matrix data (4x4)