@babylonjs/core 5.29.0 → 5.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/Cameras/cameraInputsManager.d.ts +2 -2
  2. package/Cameras/cameraInputsManager.js +5 -4
  3. package/Cameras/cameraInputsManager.js.map +1 -1
  4. package/Collisions/pickingInfo.d.ts +1 -0
  5. package/Collisions/pickingInfo.js +7 -2
  6. package/Collisions/pickingInfo.js.map +1 -1
  7. package/Culling/ray.d.ts +1 -1
  8. package/Culling/ray.js +0 -6
  9. package/Culling/ray.js.map +1 -1
  10. package/Debug/debugLayer.d.ts +5 -0
  11. package/Debug/debugLayer.js.map +1 -1
  12. package/Engines/Extensions/engine.renderTarget.js +5 -1
  13. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  14. package/Engines/Processors/iShaderProcessor.d.ts +4 -0
  15. package/Engines/Processors/iShaderProcessor.js.map +1 -1
  16. package/Engines/Processors/shaderCodeNode.js +11 -2
  17. package/Engines/Processors/shaderCodeNode.js.map +1 -1
  18. package/Engines/Processors/shaderProcessor.js +4 -1
  19. package/Engines/Processors/shaderProcessor.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.renderTarget.js +4 -1
  21. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  22. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +2 -0
  23. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  24. package/Engines/WebGPU/webgpuShaderProcessor.js +3 -7
  25. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  26. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.d.ts +6 -0
  27. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +36 -8
  28. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  29. package/Engines/WebGPU/webgpuTextureHelper.js +2 -0
  30. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  31. package/Engines/WebGPU/webgpuTintWASM.d.ts +1 -0
  32. package/Engines/WebGPU/webgpuTintWASM.js +7 -1
  33. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  34. package/Engines/constants.d.ts +4 -0
  35. package/Engines/constants.js +4 -0
  36. package/Engines/constants.js.map +1 -1
  37. package/Engines/engine.d.ts +45 -12
  38. package/Engines/nativeEngine.js +1 -0
  39. package/Engines/nativeEngine.js.map +1 -1
  40. package/Engines/thinEngine.js +6 -3
  41. package/Engines/thinEngine.js.map +1 -1
  42. package/Engines/webgpuEngine.d.ts +0 -2
  43. package/Engines/webgpuEngine.js +15 -14
  44. package/Engines/webgpuEngine.js.map +1 -1
  45. package/IAccessibilityTag.d.ts +29 -0
  46. package/IAccessibilityTag.js +2 -0
  47. package/IAccessibilityTag.js.map +1 -0
  48. package/Inputs/scene.inputManager.d.ts +1 -1
  49. package/Inputs/scene.inputManager.js +9 -2
  50. package/Inputs/scene.inputManager.js.map +1 -1
  51. package/Layers/effectLayer.js +1 -1
  52. package/Layers/effectLayer.js.map +1 -1
  53. package/Lights/Shadows/cascadedShadowGenerator.d.ts +3 -1
  54. package/Lights/Shadows/cascadedShadowGenerator.js +19 -16
  55. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  56. package/Lights/Shadows/shadowGenerator.d.ts +6 -2
  57. package/Lights/Shadows/shadowGenerator.js +32 -7
  58. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  59. package/Lights/Shadows/shadowGeneratorSceneComponent.js +16 -8
  60. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  61. package/Lights/light.d.ts +10 -3
  62. package/Lights/light.js +28 -6
  63. package/Lights/light.js.map +1 -1
  64. package/Lights/pointLight.js +6 -2
  65. package/Lights/pointLight.js.map +1 -1
  66. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +24 -3
  67. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +92 -21
  68. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +3 -1
  70. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +8 -2
  71. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  72. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +4 -0
  73. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +11 -1
  74. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  75. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -0
  76. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +7 -1
  77. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  78. package/Materials/materialHelper.js +2 -1
  79. package/Materials/materialHelper.js.map +1 -1
  80. package/Materials/uniformBuffer.js +1 -1
  81. package/Materials/uniformBuffer.js.map +1 -1
  82. package/Maths/math.vector.d.ts +88 -20
  83. package/Maths/math.vector.js +88 -31
  84. package/Maths/math.vector.js.map +1 -1
  85. package/Meshes/abstractMesh.js +11 -7
  86. package/Meshes/abstractMesh.js.map +1 -1
  87. package/Meshes/mesh.d.ts +3 -3
  88. package/Meshes/mesh.js +28 -19
  89. package/Meshes/mesh.js.map +1 -1
  90. package/Meshes/transformNode.d.ts +1 -1
  91. package/Meshes/transformNode.js +1 -1
  92. package/Meshes/transformNode.js.map +1 -1
  93. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.d.ts +17 -4
  94. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +49 -9
  95. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
  96. package/Misc/iInspectable.d.ts +5 -1
  97. package/Misc/iInspectable.js +4 -0
  98. package/Misc/iInspectable.js.map +1 -1
  99. package/Misc/index.d.ts +1 -1
  100. package/Misc/index.js +1 -1
  101. package/Misc/index.js.map +1 -1
  102. package/Misc/khronosTextureContainer2.js +41 -46
  103. package/Misc/khronosTextureContainer2.js.map +1 -1
  104. package/Misc/observable.js +4 -4
  105. package/Misc/observable.js.map +1 -1
  106. package/Misc/pressureObserverWrapper.d.ts +36 -0
  107. package/Misc/pressureObserverWrapper.js +68 -0
  108. package/Misc/pressureObserverWrapper.js.map +1 -0
  109. package/Misc/sceneRecorder.js +10 -4
  110. package/Misc/sceneRecorder.js.map +1 -1
  111. package/Misc/screenshotTools.js +0 -1
  112. package/Misc/screenshotTools.js.map +1 -1
  113. package/Particles/particleSystem.d.ts +4 -0
  114. package/Particles/particleSystem.js +12 -4
  115. package/Particles/particleSystem.js.map +1 -1
  116. package/PostProcesses/postProcess.js +4 -4
  117. package/PostProcesses/postProcess.js.map +1 -1
  118. package/Rendering/depthPeelingRenderer.js +4 -0
  119. package/Rendering/depthPeelingRenderer.js.map +1 -1
  120. package/Rendering/renderingManager.d.ts +3 -0
  121. package/Rendering/renderingManager.js +3 -0
  122. package/Rendering/renderingManager.js.map +1 -1
  123. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +3 -3
  124. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  125. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  126. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  127. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +1 -1
  128. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
  129. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +20 -15
  130. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  131. package/Shaders/fxaa.fragment.js +10 -5
  132. package/Shaders/fxaa.fragment.js.map +1 -1
  133. package/Shaders/particles.vertex.js +4 -1
  134. package/Shaders/particles.vertex.js.map +1 -1
  135. package/Shaders/spriteMap.fragment.js +7 -2
  136. package/Shaders/spriteMap.fragment.js.map +1 -1
  137. package/XR/features/WebXRControllerPointerSelection.js +1 -0
  138. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  139. package/XR/features/WebXRNearInteraction.js.map +1 -1
  140. package/node.d.ts +8 -0
  141. package/node.js +13 -1
  142. package/node.js.map +1 -1
  143. package/package.json +1 -1
  144. package/scene.d.ts +1 -8
  145. package/scene.js +1 -24
  146. package/scene.js.map +1 -1
  147. package/Misc/computePressure.d.ts +0 -57
  148. package/Misc/computePressure.js +0 -48
  149. package/Misc/computePressure.js.map +0 -1
@@ -1018,11 +1018,16 @@ export class Vector3 {
1018
1018
  }
1019
1019
  /**
1020
1020
  * Creates a vector normal (perpendicular) to the current Vector3 and stores the result in the given vector
1021
+ * Out of the infinite possibilities the normal chosen is the one formed by rotating the current vector
1022
+ * 90 degrees about an axis which lies perpendicular to the current vector
1023
+ * and its projection on the xz plane. In the case of a current vector in the xz plane
1024
+ * the normal is calculated to be along the y axis.
1025
+ * Example Playground https://playground.babylonjs.com/#R1F8YU#230
1026
+ * Example Playground https://playground.babylonjs.com/#R1F8YU#231
1021
1027
  * @param result defines the Vector3 object where to store the resultant normal
1022
1028
  * returns the result
1023
- * @hidden
1024
1029
  */
1025
- _getNormalToRef(result) {
1030
+ getNormalToRef(result) {
1026
1031
  /**
1027
1032
  * Calculates the spherical coordinates of the current vector
1028
1033
  * so saves on memory rather than importing whole Spherical Class
@@ -3293,6 +3298,7 @@ export class Vector4 {
3293
3298
  Vector4._ZeroReadOnly = Vector4.Zero();
3294
3299
  /**
3295
3300
  * Class used to store quaternion data
3301
+ * Example Playground - Overview - https://playground.babylonjs.com/#L49EJ7#100
3296
3302
  * @see https://en.wikipedia.org/wiki/Quaternion
3297
3303
  * @see https://doc.babylonjs.com/features/position,_rotation,_scaling
3298
3304
  */
@@ -3375,6 +3381,7 @@ export class Quaternion {
3375
3381
  }
3376
3382
  /**
3377
3383
  * Copy the quaternion to an array
3384
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#13
3378
3385
  * @returns a new array populated with 4 elements from the quaternion coordinates
3379
3386
  */
3380
3387
  asArray() {
@@ -3382,6 +3389,7 @@ export class Quaternion {
3382
3389
  }
3383
3390
  /**
3384
3391
  * Stores from the starting index in the given array the Quaternion successive values
3392
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#59
3385
3393
  * @param array defines the array where to store the x,y,z,w components
3386
3394
  * @param index defines an optional index in the target array to define where to start storing values
3387
3395
  * @returns the current Quaternion object
@@ -3395,6 +3403,7 @@ export class Quaternion {
3395
3403
  }
3396
3404
  /**
3397
3405
  * Check if two quaternions are equals
3406
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#38
3398
3407
  * @param otherQuaternion defines the second operand
3399
3408
  * @returns true if the current quaternion and the given one coordinates are strictly equals
3400
3409
  */
@@ -3403,6 +3412,7 @@ export class Quaternion {
3403
3412
  }
3404
3413
  /**
3405
3414
  * Gets a boolean if two quaternions are equals (using an epsilon value)
3415
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#37
3406
3416
  * @param otherQuaternion defines the other quaternion
3407
3417
  * @param epsilon defines the minimal distance to consider equality
3408
3418
  * @returns true if the given quaternion coordinates are close to the current ones by a distance of epsilon.
@@ -3416,6 +3426,7 @@ export class Quaternion {
3416
3426
  }
3417
3427
  /**
3418
3428
  * Clone the current quaternion
3429
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#12
3419
3430
  * @returns a new quaternion copied from the current one
3420
3431
  */
3421
3432
  clone() {
@@ -3423,6 +3434,7 @@ export class Quaternion {
3423
3434
  }
3424
3435
  /**
3425
3436
  * Copy a quaternion to the current one
3437
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#86
3426
3438
  * @param other defines the other quaternion
3427
3439
  * @returns the updated current quaternion
3428
3440
  */
@@ -3435,6 +3447,7 @@ export class Quaternion {
3435
3447
  }
3436
3448
  /**
3437
3449
  * Updates the current quaternion with the given float coordinates
3450
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#87
3438
3451
  * @param x defines the x coordinate
3439
3452
  * @param y defines the y coordinate
3440
3453
  * @param z defines the z coordinate
@@ -3450,6 +3463,7 @@ export class Quaternion {
3450
3463
  }
3451
3464
  /**
3452
3465
  * Updates the current quaternion from the given float coordinates
3466
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#56
3453
3467
  * @param x defines the x coordinate
3454
3468
  * @param y defines the y coordinate
3455
3469
  * @param z defines the z coordinate
@@ -3461,6 +3475,7 @@ export class Quaternion {
3461
3475
  }
3462
3476
  /**
3463
3477
  * Adds two quaternions
3478
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#10
3464
3479
  * @param other defines the second operand
3465
3480
  * @returns a new quaternion as the addition result of the given one and the current quaternion
3466
3481
  */
@@ -3469,6 +3484,7 @@ export class Quaternion {
3469
3484
  }
3470
3485
  /**
3471
3486
  * Add a quaternion to the current one
3487
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#11
3472
3488
  * @param other defines the quaternion to add
3473
3489
  * @returns the current quaternion
3474
3490
  */
@@ -3481,6 +3497,7 @@ export class Quaternion {
3481
3497
  }
3482
3498
  /**
3483
3499
  * Subtract two quaternions
3500
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#57
3484
3501
  * @param other defines the second operand
3485
3502
  * @returns a new quaternion as the subtraction result of the given one from the current one
3486
3503
  */
@@ -3489,6 +3506,7 @@ export class Quaternion {
3489
3506
  }
3490
3507
  /**
3491
3508
  * Subtract a quaternion to the current one
3509
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#58
3492
3510
  * @param other defines the quaternion to subtract
3493
3511
  * @returns the current quaternion
3494
3512
  */
@@ -3501,6 +3519,7 @@ export class Quaternion {
3501
3519
  }
3502
3520
  /**
3503
3521
  * Multiplies the current quaternion by a scale factor
3522
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#88
3504
3523
  * @param value defines the scale factor
3505
3524
  * @returns a new quaternion set by multiplying the current quaternion coordinates by the float "scale"
3506
3525
  */
@@ -3509,6 +3528,7 @@ export class Quaternion {
3509
3528
  }
3510
3529
  /**
3511
3530
  * Scale the current quaternion values by a factor and stores the result to a given quaternion
3531
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#89
3512
3532
  * @param scale defines the scale factor
3513
3533
  * @param result defines the Quaternion object where to store the result
3514
3534
  * @returns result input
@@ -3522,6 +3542,7 @@ export class Quaternion {
3522
3542
  }
3523
3543
  /**
3524
3544
  * Multiplies in place the current quaternion by a scale factor
3545
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#90
3525
3546
  * @param value defines the scale factor
3526
3547
  * @returns the current modified quaternion
3527
3548
  */
@@ -3534,6 +3555,7 @@ export class Quaternion {
3534
3555
  }
3535
3556
  /**
3536
3557
  * Scale the current quaternion values by a factor and add the result to a given quaternion
3558
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#91
3537
3559
  * @param scale defines the scale factor
3538
3560
  * @param result defines the Quaternion object where to store the result
3539
3561
  * @returns result input
@@ -3547,6 +3569,7 @@ export class Quaternion {
3547
3569
  }
3548
3570
  /**
3549
3571
  * Multiplies two quaternions
3572
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#43
3550
3573
  * @param q1 defines the second operand
3551
3574
  * @returns a new quaternion set as the multiplication result of the current one with the given one "q1"
3552
3575
  */
@@ -3557,6 +3580,7 @@ export class Quaternion {
3557
3580
  }
3558
3581
  /**
3559
3582
  * Sets the given "result" as the the multiplication result of the current one with the given one "q1"
3583
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#45
3560
3584
  * @param q1 defines the second operand
3561
3585
  * @param result defines the target quaternion
3562
3586
  * @returns the current quaternion
@@ -3571,6 +3595,7 @@ export class Quaternion {
3571
3595
  }
3572
3596
  /**
3573
3597
  * Updates the current quaternion with the multiplication of itself with the given one "q1"
3598
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#46
3574
3599
  * @param q1 defines the second operand
3575
3600
  * @returns the currentupdated quaternion
3576
3601
  */
@@ -3580,6 +3605,7 @@ export class Quaternion {
3580
3605
  }
3581
3606
  /**
3582
3607
  * Conjugates the current quaternion and stores the result in the given quaternion
3608
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#81
3583
3609
  * @param ref defines the target quaternion
3584
3610
  * @returns result input
3585
3611
  */
@@ -3589,6 +3615,7 @@ export class Quaternion {
3589
3615
  }
3590
3616
  /**
3591
3617
  * Conjugates in place the current quaternion
3618
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#82
3592
3619
  * @returns the current updated quaternion
3593
3620
  */
3594
3621
  conjugateInPlace() {
@@ -3599,6 +3626,7 @@ export class Quaternion {
3599
3626
  }
3600
3627
  /**
3601
3628
  * Conjugates (1-q) the current quaternion
3629
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#83
3602
3630
  * @returns a new quaternion
3603
3631
  */
3604
3632
  conjugate() {
@@ -3606,6 +3634,7 @@ export class Quaternion {
3606
3634
  }
3607
3635
  /**
3608
3636
  * Returns the inverse of the current quaternion
3637
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#84
3609
3638
  * @returns a new quaternion
3610
3639
  */
3611
3640
  invert() {
@@ -3619,6 +3648,7 @@ export class Quaternion {
3619
3648
  }
3620
3649
  /**
3621
3650
  * Invert in place the current quaternion
3651
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#85
3622
3652
  * @returns this quaternion
3623
3653
  */
3624
3654
  invertInPlace() {
@@ -3632,6 +3662,7 @@ export class Quaternion {
3632
3662
  }
3633
3663
  /**
3634
3664
  * Gets squared length of current quaternion
3665
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#29
3635
3666
  * @returns the quaternion length (float)
3636
3667
  */
3637
3668
  lengthSquared() {
@@ -3639,6 +3670,7 @@ export class Quaternion {
3639
3670
  }
3640
3671
  /**
3641
3672
  * Gets length of current quaternion
3673
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#28
3642
3674
  * @returns the quaternion length (float)
3643
3675
  */
3644
3676
  length() {
@@ -3646,6 +3678,7 @@ export class Quaternion {
3646
3678
  }
3647
3679
  /**
3648
3680
  * Normalize in place the current quaternion
3681
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#54
3649
3682
  * @returns the current updated quaternion
3650
3683
  */
3651
3684
  normalize() {
@@ -3659,6 +3692,7 @@ export class Quaternion {
3659
3692
  }
3660
3693
  /**
3661
3694
  * Normalize a copy of the current quaternion
3695
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#55
3662
3696
  * @returns the normalized quaternion
3663
3697
  */
3664
3698
  normalizeToNew() {
@@ -3671,6 +3705,7 @@ export class Quaternion {
3671
3705
  }
3672
3706
  /**
3673
3707
  * Returns a new Vector3 set with the Euler angles translated from the current quaternion
3708
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#32
3674
3709
  * @returns a new Vector3 containing the Euler angles
3675
3710
  * @see https://doc.babylonjs.com/divingDeeper/mesh/transforms/center_origin/rotation_conventions
3676
3711
  */
@@ -3681,6 +3716,7 @@ export class Quaternion {
3681
3716
  }
3682
3717
  /**
3683
3718
  * Sets the given vector3 "result" with the Euler angles translated from the current quaternion
3719
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#31
3684
3720
  * @param result defines the vector which will be filled with the Euler angles
3685
3721
  * @returns result input
3686
3722
  * @see https://doc.babylonjs.com/divingDeeper/mesh/transforms/center_origin/rotation_conventions
@@ -3715,6 +3751,7 @@ export class Quaternion {
3715
3751
  }
3716
3752
  /**
3717
3753
  * Updates the given rotation matrix with the current quaternion values
3754
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#67
3718
3755
  * @param result defines the target matrix
3719
3756
  * @returns the current unchanged quaternion
3720
3757
  */
@@ -3724,6 +3761,7 @@ export class Quaternion {
3724
3761
  }
3725
3762
  /**
3726
3763
  * Updates the current quaternion from the given rotation matrix values
3764
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#41
3727
3765
  * @param matrix defines the source matrix
3728
3766
  * @returns the current updated quaternion
3729
3767
  */
@@ -3734,6 +3772,7 @@ export class Quaternion {
3734
3772
  // Statics
3735
3773
  /**
3736
3774
  * Creates a new quaternion from a rotation matrix
3775
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#101
3737
3776
  * @param matrix defines the source matrix
3738
3777
  * @returns a new quaternion created from the given rotation matrix values
3739
3778
  */
@@ -3744,6 +3783,7 @@ export class Quaternion {
3744
3783
  }
3745
3784
  /**
3746
3785
  * Updates the given quaternion with the given rotation matrix values
3786
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#102
3747
3787
  * @param matrix defines the source matrix
3748
3788
  * @param result defines the target quaternion
3749
3789
  * @returns result input
@@ -3785,36 +3825,9 @@ export class Quaternion {
3785
3825
  }
3786
3826
  return result;
3787
3827
  }
3788
- /**
3789
- * Creates the rotation quaternion needed to rotate from one Vector3 onto another Vector3
3790
- * Example PG https://playground.babylonjs.com/#L49EJ7#2
3791
- * @param fromVector the starting vector
3792
- * @param toVector the ending vector
3793
- * @returns the rotation quaternion needed
3794
- */
3795
- static RotationQuaternionFromOnto(fromVector, toVector) {
3796
- const ref = Quaternion.Zero();
3797
- return Quaternion.RotationQuaternionFromOntoToRef(fromVector, toVector, ref);
3798
- }
3799
- /**
3800
- * Creates the rotation quaternion needed to rotate from one Vector3 onto another Vector3 and stores in a result Quaternion
3801
- * Example PG https://playground.babylonjs.com/#L49EJ7#3
3802
- * @param fromVector the starting vector
3803
- * @param toVector the ending vector
3804
- * @param result the rotation quaternion needed
3805
- * @returns the result
3806
- */
3807
- static RotationQuaternionFromOntoToRef(fromVector, toVector, result) {
3808
- const normal = TmpVectors.Vector3[0];
3809
- Vector3.CrossToRef(fromVector, toVector, normal);
3810
- if (normal.equals(Vector3.ZeroReadOnly)) {
3811
- fromVector._getNormalToRef(normal);
3812
- }
3813
- const angle = Vector3.GetAngleBetweenVectors(fromVector, toVector, normal);
3814
- return Quaternion.RotationAxisToRef(normal, angle, result);
3815
- }
3816
3828
  /**
3817
3829
  * Returns the dot product (float) between the quaternions "left" and "right"
3830
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#61
3818
3831
  * @param left defines the left operand
3819
3832
  * @param right defines the right operand
3820
3833
  * @returns the dot product
@@ -3824,6 +3837,7 @@ export class Quaternion {
3824
3837
  }
3825
3838
  /**
3826
3839
  * Checks if the orientations of two rotation quaternions are close to each other
3840
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#60
3827
3841
  * @param quat0 defines the first quaternion to check
3828
3842
  * @param quat1 defines the second quaternion to check
3829
3843
  * @param epsilon defines closeness, 0 same orientation, 1 PI apart, default 0.1
@@ -3835,7 +3849,7 @@ export class Quaternion {
3835
3849
  }
3836
3850
  /**
3837
3851
  * Smooth interpolation between two quaternions using Slerp
3838
- *
3852
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#93
3839
3853
  * @param source source quaternion
3840
3854
  * @param goal goal quaternion
3841
3855
  * @param deltaTime current interpolation frame
@@ -3857,6 +3871,7 @@ export class Quaternion {
3857
3871
  }
3858
3872
  /**
3859
3873
  * Inverse a given quaternion
3874
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#103
3860
3875
  * @param q defines the source quaternion
3861
3876
  * @returns a new quaternion as the inverted current quaternion
3862
3877
  */
@@ -3865,6 +3880,7 @@ export class Quaternion {
3865
3880
  }
3866
3881
  /**
3867
3882
  * Inverse a given quaternion
3883
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#104
3868
3884
  * @param q defines the source quaternion
3869
3885
  * @param result the quaternion the result will be stored in
3870
3886
  * @returns the result quaternion
@@ -3890,6 +3906,7 @@ export class Quaternion {
3890
3906
  }
3891
3907
  /**
3892
3908
  * Creates a quaternion from a rotation around an axis
3909
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#72
3893
3910
  * @param axis defines the axis to use
3894
3911
  * @param angle defines the angle to use
3895
3912
  * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float)
@@ -3899,6 +3916,7 @@ export class Quaternion {
3899
3916
  }
3900
3917
  /**
3901
3918
  * Creates a rotation around an axis and stores it into the given quaternion
3919
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#73
3902
3920
  * @param axis defines the axis to use
3903
3921
  * @param angle defines the angle to use
3904
3922
  * @param result defines the target quaternion
@@ -3915,6 +3933,7 @@ export class Quaternion {
3915
3933
  }
3916
3934
  /**
3917
3935
  * Creates a new quaternion from data stored into an array
3936
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#63
3918
3937
  * @param array defines the data source
3919
3938
  * @param offset defines the offset in the source array where the data starts
3920
3939
  * @returns a new quaternion
@@ -3927,6 +3946,7 @@ export class Quaternion {
3927
3946
  }
3928
3947
  /**
3929
3948
  * Updates the given quaternion "result" from the starting index of the given array.
3949
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#64
3930
3950
  * @param array the array to pull values from
3931
3951
  * @param offset the offset into the array to start at
3932
3952
  * @param result the quaternion to store the result in
@@ -3941,6 +3961,7 @@ export class Quaternion {
3941
3961
  }
3942
3962
  /**
3943
3963
  * Create a quaternion from Euler rotation angles
3964
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#33
3944
3965
  * @param x Pitch
3945
3966
  * @param y Yaw
3946
3967
  * @param z Roll
@@ -3953,6 +3974,7 @@ export class Quaternion {
3953
3974
  }
3954
3975
  /**
3955
3976
  * Updates a quaternion from Euler rotation angles
3977
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#34
3956
3978
  * @param x Pitch
3957
3979
  * @param y Yaw
3958
3980
  * @param z Roll
@@ -3965,6 +3987,7 @@ export class Quaternion {
3965
3987
  }
3966
3988
  /**
3967
3989
  * Create a quaternion from Euler rotation vector
3990
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#35
3968
3991
  * @param vec the Euler vector (x Pitch, y Yaw, z Roll)
3969
3992
  * @returns the new Quaternion
3970
3993
  */
@@ -3975,6 +3998,7 @@ export class Quaternion {
3975
3998
  }
3976
3999
  /**
3977
4000
  * Updates a quaternion from Euler rotation vector
4001
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#36
3978
4002
  * @param vec the Euler vector (x Pitch, y Yaw, z Roll)
3979
4003
  * @param result the quaternion to store the result
3980
4004
  * @returns the updated quaternion
@@ -3985,6 +4009,7 @@ export class Quaternion {
3985
4009
  }
3986
4010
  /**
3987
4011
  * Updates a quaternion so that it rotates vector vecFrom to vector vecTo
4012
+ * Example Playground - https://playground.babylonjs.com/#L49EJ7#70
3988
4013
  * @param vecFrom defines the direction vector from which to rotate
3989
4014
  * @param vecTo defines the direction vector to which to rotate
3990
4015
  * @param result the quaternion to store the result
@@ -4008,6 +4033,7 @@ export class Quaternion {
4008
4033
  }
4009
4034
  /**
4010
4035
  * Creates a new quaternion from the given Euler float angles (y, x, z)
4036
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#77
4011
4037
  * @param yaw defines the rotation around Y axis
4012
4038
  * @param pitch defines the rotation around X axis
4013
4039
  * @param roll defines the rotation around Z axis
@@ -4020,6 +4046,7 @@ export class Quaternion {
4020
4046
  }
4021
4047
  /**
4022
4048
  * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion
4049
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#78
4023
4050
  * @param yaw defines the rotation around Y axis
4024
4051
  * @param pitch defines the rotation around X axis
4025
4052
  * @param roll defines the rotation around Z axis
@@ -4045,6 +4072,7 @@ export class Quaternion {
4045
4072
  }
4046
4073
  /**
4047
4074
  * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation
4075
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#68
4048
4076
  * @param alpha defines the rotation around first axis
4049
4077
  * @param beta defines the rotation around second axis
4050
4078
  * @param gamma defines the rotation around third axis
@@ -4057,6 +4085,7 @@ export class Quaternion {
4057
4085
  }
4058
4086
  /**
4059
4087
  * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion
4088
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#69
4060
4089
  * @param alpha defines the rotation around first axis
4061
4090
  * @param beta defines the rotation around second axis
4062
4091
  * @param gamma defines the rotation around third axis
@@ -4076,6 +4105,7 @@ export class Quaternion {
4076
4105
  }
4077
4106
  /**
4078
4107
  * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)
4108
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#75
4079
4109
  * @param axis1 defines the first axis
4080
4110
  * @param axis2 defines the second axis
4081
4111
  * @param axis3 defines the third axis
@@ -4088,6 +4118,7 @@ export class Quaternion {
4088
4118
  }
4089
4119
  /**
4090
4120
  * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion
4121
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#76
4091
4122
  * @param axis1 defines the first axis
4092
4123
  * @param axis2 defines the second axis
4093
4124
  * @param axis3 defines the third axis
@@ -4103,6 +4134,7 @@ export class Quaternion {
4103
4134
  /**
4104
4135
  * Creates a new rotation value to orient an object to look towards the given forward direction, the up direction being oriented like "up".
4105
4136
  * This function works in left handed mode
4137
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#96
4106
4138
  * @param forward defines the forward direction - Must be normalized and orthogonal to up.
4107
4139
  * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.
4108
4140
  * @returns A new quaternion oriented toward the specified forward and up.
@@ -4115,6 +4147,7 @@ export class Quaternion {
4115
4147
  /**
4116
4148
  * Creates a new rotation value to orient an object to look towards the given forward direction with the up direction being oriented like "up", and stores it in the target quaternion.
4117
4149
  * This function works in left handed mode
4150
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#97
4118
4151
  * @param forward defines the forward direction - Must be normalized and orthogonal to up.
4119
4152
  * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.
4120
4153
  * @param ref defines the target quaternion.
@@ -4129,6 +4162,7 @@ export class Quaternion {
4129
4162
  /**
4130
4163
  * Creates a new rotation value to orient an object to look towards the given forward direction, the up direction being oriented like "up".
4131
4164
  * This function works in right handed mode
4165
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#98
4132
4166
  * @param forward defines the forward direction - Must be normalized and orthogonal to up.
4133
4167
  * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.
4134
4168
  * @returns A new quaternion oriented toward the specified forward and up.
@@ -4141,6 +4175,7 @@ export class Quaternion {
4141
4175
  /**
4142
4176
  * Creates a new rotation value to orient an object to look towards the given forward direction with the up direction being oriented like "up", and stores it in the target quaternion.
4143
4177
  * This function works in right handed mode
4178
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#105
4144
4179
  * @param forward defines the forward direction - Must be normalized and orthogonal to up.
4145
4180
  * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.
4146
4181
  * @param ref defines the target quaternion.
@@ -4153,6 +4188,7 @@ export class Quaternion {
4153
4188
  }
4154
4189
  /**
4155
4190
  * Interpolates between two quaternions
4191
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#79
4156
4192
  * @param left defines first quaternion
4157
4193
  * @param right defines second quaternion
4158
4194
  * @param amount defines the gradient to use
@@ -4165,6 +4201,7 @@ export class Quaternion {
4165
4201
  }
4166
4202
  /**
4167
4203
  * Interpolates between two quaternions and stores it into a target quaternion
4204
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#92
4168
4205
  * @param left defines first quaternion
4169
4206
  * @param right defines second quaternion
4170
4207
  * @param amount defines the gradient to use
@@ -4198,6 +4235,8 @@ export class Quaternion {
4198
4235
  }
4199
4236
  /**
4200
4237
  * Interpolate between two quaternions using Hermite interpolation
4238
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#47
4239
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#hermite-quaternion-spline
4201
4240
  * @param value1 defines first quaternion
4202
4241
  * @param tangent1 defines the incoming tangent
4203
4242
  * @param value2 defines second quaternion
@@ -4220,6 +4259,7 @@ export class Quaternion {
4220
4259
  }
4221
4260
  /**
4222
4261
  * Returns a new Quaternion which is the 1st derivative of the Hermite spline defined by the quaternions "value1", "value2", "tangent1", "tangent2".
4262
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#48
4223
4263
  * @param value1 defines the first control point
4224
4264
  * @param tangent1 defines the first tangent
4225
4265
  * @param value2 defines the second control point
@@ -4234,6 +4274,7 @@ export class Quaternion {
4234
4274
  }
4235
4275
  /**
4236
4276
  * Update a Quaternion with the 1st derivative of the Hermite spline defined by the quaternions "value1", "value2", "tangent1", "tangent2".
4277
+ * Example Playground https://playground.babylonjs.com/#L49EJ7#49
4237
4278
  * @param value1 defines the first control point
4238
4279
  * @param tangent1 defines the first tangent
4239
4280
  * @param value2 defines the second control point
@@ -4253,6 +4294,20 @@ export class Quaternion {
4253
4294
  }
4254
4295
  /**
4255
4296
  * Class used to store matrix data (4x4)
4297
+ * Note on matrix definitions in Babylon.js for setting values directly rather than using one of the methods available.
4298
+ * Matrix size is given by rows x columns.
4299
+ * A Vector3 is a 1 X 3 matrix [x, y, z].
4300
+ * In Babylon.js multiplying a 1 x 3 matrix by a 4 x 4 matrix
4301
+ * is done using BABYLON.Vector4.TransformCoordinates(vector3, matrix)
4302
+ * and extending the passed Vector3 to a Vector4 [x, y, z, w] with w = 1.
4303
+ * The multiplication has this form
4304
+ * [x, y, z, w] |m0, m1, m2, m3 |
4305
+ * |m4, m5, m6, m7 |
4306
+ * |m8, m9, m10, m11|
4307
+ * |m12, m13, m14, m15|
4308
+ *
4309
+ * = [xm0 + ym4 + zm8 + wm12, xm1 + ym5 + zm9 + wm13, xm2 + ym6 + zm10 + wm14, xm3 + ym7 + zm11 + wm15]
4310
+ *
4256
4311
  */
4257
4312
  export class Matrix {
4258
4313
  /**
@@ -4617,6 +4672,7 @@ export class Matrix {
4617
4672
  }
4618
4673
  /**
4619
4674
  * Multiply two matrices
4675
+ * A.multiply(B) means apply B to A so result is B x A
4620
4676
  * @param other defines the second operand
4621
4677
  * @returns a new matrix set with the multiplication result of the current Matrix and the given one
4622
4678
  */
@@ -4665,6 +4721,7 @@ export class Matrix {
4665
4721
  }
4666
4722
  /**
4667
4723
  * Sets the given matrix "result" with the multiplication result of the current Matrix and the given one
4724
+ * A.multiplyToRef(B, R) means apply B to A and store in R and R = B x A
4668
4725
  * @param other defines the second operand
4669
4726
  * @param result defines the matrix where to store the multiplication
4670
4727
  * @returns result input