@babylonjs/core 5.25.0 → 5.26.1

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 (109) hide show
  1. package/Audio/audioEngine.js +1 -2
  2. package/Audio/audioEngine.js.map +1 -1
  3. package/Cameras/Inputs/freeCameraDeviceOrientationInput.d.ts +4 -1
  4. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +17 -4
  5. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  6. package/Cameras/VR/vrExperienceHelper.js +1 -24
  7. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  8. package/Culling/Octrees/octreeSceneComponent.js +1 -5
  9. package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
  10. package/DeviceInput/webDeviceInputSystem.js +0 -18
  11. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  12. package/Engines/Extensions/engine.cubeTexture.js +3 -2
  13. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  14. package/Engines/engine.js +3 -34
  15. package/Engines/engine.js.map +1 -1
  16. package/Engines/thinEngine.js +2 -14
  17. package/Engines/thinEngine.js.map +1 -1
  18. package/Gamepads/gamepadManager.js +2 -2
  19. package/Gamepads/gamepadManager.js.map +1 -1
  20. package/Layers/layer.d.ts +7 -0
  21. package/Layers/layer.js +11 -0
  22. package/Layers/layer.js.map +1 -1
  23. package/Layers/layerSceneComponent.d.ts +4 -2
  24. package/Layers/layerSceneComponent.js +27 -11
  25. package/Layers/layerSceneComponent.js.map +1 -1
  26. package/Loading/loadingScreen.js +6 -6
  27. package/Loading/loadingScreen.js.map +1 -1
  28. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +1 -2
  29. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  30. package/Materials/Textures/renderTargetTexture.js +3 -0
  31. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  32. package/Materials/Textures/thinRenderTargetTexture.js +1 -1
  33. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  34. package/Materials/Textures/videoTexture.js +2 -2
  35. package/Materials/Textures/videoTexture.js.map +1 -1
  36. package/Materials/material.js +5 -2
  37. package/Materials/material.js.map +1 -1
  38. package/Materials/materialHelper.js +1 -6
  39. package/Materials/materialHelper.js.map +1 -1
  40. package/Maths/math.vector.d.ts +47 -10
  41. package/Maths/math.vector.js +89 -10
  42. package/Maths/math.vector.js.map +1 -1
  43. package/Meshes/instancedMesh.js +1 -1
  44. package/Meshes/instancedMesh.js.map +1 -1
  45. package/Meshes/mesh.d.ts +1 -1
  46. package/Meshes/mesh.js +4 -6
  47. package/Meshes/mesh.js.map +1 -1
  48. package/Meshes/subMesh.d.ts +2 -0
  49. package/Meshes/subMesh.js +2 -0
  50. package/Meshes/subMesh.js.map +1 -1
  51. package/Misc/tools.d.ts +9 -0
  52. package/Misc/tools.js +14 -5
  53. package/Misc/tools.js.map +1 -1
  54. package/Misc/virtualJoystick.js +0 -1
  55. package/Misc/virtualJoystick.js.map +1 -1
  56. package/Particles/IParticleSystem.d.ts +6 -0
  57. package/Particles/IParticleSystem.js.map +1 -1
  58. package/Particles/baseParticleSystem.d.ts +8 -0
  59. package/Particles/baseParticleSystem.js +12 -0
  60. package/Particles/baseParticleSystem.js.map +1 -1
  61. package/Particles/gpuParticleSystem.d.ts +1 -1
  62. package/Particles/gpuParticleSystem.js +12 -2
  63. package/Particles/gpuParticleSystem.js.map +1 -1
  64. package/Particles/particleSystem.d.ts +1 -1
  65. package/Particles/particleSystem.js +17 -2
  66. package/Particles/particleSystem.js.map +1 -1
  67. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
  68. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  69. package/Rendering/renderingManager.d.ts +11 -0
  70. package/Rendering/renderingManager.js +55 -9
  71. package/Rendering/renderingManager.js.map +1 -1
  72. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
  73. package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
  74. package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js +1 -1
  75. package/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js.map +1 -1
  76. package/Shaders/ShadersInclude/vertexColorMixing.js +1 -1
  77. package/Shaders/ShadersInclude/vertexColorMixing.js.map +1 -1
  78. package/Shaders/color.fragment.js +3 -2
  79. package/Shaders/color.fragment.js.map +1 -1
  80. package/Shaders/color.vertex.js +1 -1
  81. package/Shaders/color.vertex.js.map +1 -1
  82. package/Shaders/default.fragment.js +3 -3
  83. package/Shaders/default.fragment.js.map +1 -1
  84. package/Shaders/default.vertex.js +1 -1
  85. package/Shaders/default.vertex.js.map +1 -1
  86. package/Shaders/gpuRenderParticles.fragment.d.ts +2 -0
  87. package/Shaders/gpuRenderParticles.fragment.js +8 -1
  88. package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
  89. package/Shaders/gpuRenderParticles.vertex.d.ts +2 -0
  90. package/Shaders/gpuRenderParticles.vertex.js +4 -0
  91. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  92. package/Shaders/particles.fragment.d.ts +2 -0
  93. package/Shaders/particles.fragment.js +8 -1
  94. package/Shaders/particles.fragment.js.map +1 -1
  95. package/Shaders/particles.vertex.d.ts +2 -0
  96. package/Shaders/particles.vertex.js +4 -0
  97. package/Shaders/particles.vertex.js.map +1 -1
  98. package/Shaders/pbr.vertex.js +1 -1
  99. package/Shaders/pbr.vertex.js.map +1 -1
  100. package/Sprites/spriteManager.d.ts +4 -0
  101. package/Sprites/spriteManager.js +2 -0
  102. package/Sprites/spriteManager.js.map +1 -1
  103. package/package.json +1 -1
  104. package/scene.d.ts +14 -0
  105. package/scene.js +37 -12
  106. package/scene.js.map +1 -1
  107. package/sceneComponent.d.ts +2 -0
  108. package/sceneComponent.js +2 -0
  109. package/sceneComponent.js.map +1 -1
@@ -262,7 +262,7 @@ export class Vector2 {
262
262
  /**
263
263
  * Negate the current Vector2 and stores the result in the given vector "result" coordinates
264
264
  * @param result defines the Vector3 object where to store the result
265
- * @returns the current Vector2
265
+ * @returns the result
266
266
  */
267
267
  negateToRef(result) {
268
268
  return result.copyFromFloats(this.x * -1, this.y * -1);
@@ -832,7 +832,7 @@ export class Vector3 {
832
832
  * Example Playground https://playground.babylonjs.com/#R1F8YU#6
833
833
  * @param otherVector defines the second operand
834
834
  * @param result defines the Vector3 object where to store the result
835
- * @returns the current Vector3
835
+ * @returns the result
836
836
  */
837
837
  addToRef(otherVector, result) {
838
838
  return result.copyFromFloats(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);
@@ -863,7 +863,7 @@ export class Vector3 {
863
863
  * Example Playground https://playground.babylonjs.com/#R1F8YU#63
864
864
  * @param otherVector defines the second operand
865
865
  * @param result defines the Vector3 object where to store the result
866
- * @returns the current Vector3
866
+ * @returns the result
867
867
  */
868
868
  subtractToRef(otherVector, result) {
869
869
  return this.subtractFromFloatsToRef(otherVector._x, otherVector._y, otherVector._z, result);
@@ -886,7 +886,7 @@ export class Vector3 {
886
886
  * @param y defines the y coordinate of the operand
887
887
  * @param z defines the z coordinate of the operand
888
888
  * @param result defines the Vector3 object where to store the result
889
- * @returns the current Vector3
889
+ * @returns the result
890
890
  */
891
891
  subtractFromFloatsToRef(x, y, z, result) {
892
892
  return result.copyFromFloats(this._x - x, this._y - y, this._z - z);
@@ -914,7 +914,7 @@ export class Vector3 {
914
914
  * Negate the current Vector3 and stores the result in the given vector "result" coordinates
915
915
  * Example Playground https://playground.babylonjs.com/#R1F8YU#37
916
916
  * @param result defines the Vector3 object where to store the result
917
- * @returns the current Vector3
917
+ * @returns the result
918
918
  */
919
919
  negateToRef(result) {
920
920
  return result.copyFromFloats(this._x * -1, this._y * -1, this._z * -1);
@@ -945,17 +945,45 @@ export class Vector3 {
945
945
  * Example Playground https://playground.babylonjs.com/#R1F8YU#57
946
946
  * @param scale defines the multiplier factor
947
947
  * @param result defines the Vector3 object where to store the result
948
- * @returns the current Vector3
948
+ * @returns the result
949
949
  */
950
950
  scaleToRef(scale, result) {
951
951
  return result.copyFromFloats(this._x * scale, this._y * scale, this._z * scale);
952
952
  }
953
+ /**
954
+ * Creates a vector normal (perpendicular) to the current Vector3 and stores the result in the given vector
955
+ * @param result defines the Vector3 object where to store the resultant normal
956
+ * returns the result
957
+ * @hidden
958
+ */
959
+ _getNormalToRef(result) {
960
+ /**
961
+ * Calculates the spherical coordinates of the current vector
962
+ * so saves on memory rather than importing whole Spherical Class
963
+ */
964
+ const radius = this.length();
965
+ let theta = Math.acos(this.y / radius);
966
+ const phi = Math.atan2(this.z, this.x);
967
+ //makes angle 90 degs to current vector
968
+ if (theta > Math.PI / 2) {
969
+ theta -= Math.PI / 2;
970
+ }
971
+ else {
972
+ theta += Math.PI / 2;
973
+ }
974
+ //Calculates resutant normal vector from spherical coordinate of perpendicular vector
975
+ const x = radius * Math.sin(theta) * Math.cos(phi);
976
+ const y = radius * Math.cos(theta);
977
+ const z = radius * Math.sin(theta) * Math.sin(phi);
978
+ result.set(x, y, z);
979
+ return result;
980
+ }
953
981
  /**
954
982
  * Rotates the vector using the given unit quaternion and stores the new vector in result
955
983
  * Example Playground https://playground.babylonjs.com/#R1F8YU#9
956
984
  * @param q the unit quaternion representing the rotation
957
985
  * @param result the output vector
958
- * @returns the current Vector3
986
+ * @returns the result
959
987
  */
960
988
  applyRotationQuaternionToRef(q, result) {
961
989
  const ix = q.w * this.x + q.y * this.z - q.z * this.y;
@@ -1092,7 +1120,7 @@ export class Vector3 {
1092
1120
  * Example Playground https://playground.babylonjs.com/#R1F8YU#33
1093
1121
  * @param otherVector defines the second operand
1094
1122
  * @param result defines the Vector3 object where to store the result
1095
- * @returns the current Vector3
1123
+ * @returns the result
1096
1124
  */
1097
1125
  multiplyToRef(otherVector, result) {
1098
1126
  return result.copyFromFloats(this._x * otherVector._x, this._y * otherVector._y, this._z * otherVector._z);
@@ -1122,7 +1150,7 @@ export class Vector3 {
1122
1150
  * Example Playground https://playground.babylonjs.com/#R1F8YU#18
1123
1151
  * @param otherVector defines the second operand
1124
1152
  * @param result defines the Vector3 object where to store the result
1125
- * @returns the current Vector3
1153
+ * @returns the result
1126
1154
  */
1127
1155
  divideToRef(otherVector, result) {
1128
1156
  return result.copyFromFloats(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);
@@ -1484,6 +1512,31 @@ export class Vector3 {
1484
1512
  const angle = Math.atan2(Vector3.Dot(v1, right), Vector3.Dot(v1, forward));
1485
1513
  return Scalar.NormalizeRadians(angle);
1486
1514
  }
1515
+ /**
1516
+ * Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point and stores it in the ref Vector3
1517
+ * @param start the starting point
1518
+ * @param target the target point
1519
+ * @param ref the vector3 to store the result
1520
+ * @returns ref in the form (pitch, yaw, 0)
1521
+ */
1522
+ static PitchYawRollToMoveBetweenPointsToRef(start, target, ref) {
1523
+ const diff = TmpVectors.Vector3[0];
1524
+ target.subtractToRef(start, diff);
1525
+ ref.y = Math.atan2(diff.x, diff.z) || 0;
1526
+ ref.x = Math.atan2(Math.sqrt(diff.x ** 2 + diff.z ** 2), diff.y) || 0;
1527
+ ref.z = 0;
1528
+ return ref;
1529
+ }
1530
+ /**
1531
+ * Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point
1532
+ * @param start the starting point
1533
+ * @param target the target point
1534
+ * @returns the rotation in the form (pitch, yaw, 0)
1535
+ */
1536
+ static PitchYawRollToMoveBetweenPoints(start, target) {
1537
+ const ref = Vector3.Zero();
1538
+ return Vector3.PitchYawRollToMoveBetweenPointsToRef(start, target, ref);
1539
+ }
1487
1540
  /**
1488
1541
  * Slerp between two vectors. See also `SmoothToRef`
1489
1542
  * Slerp is a spherical linear interpolation
@@ -2566,7 +2619,7 @@ export class Vector4 {
2566
2619
  /**
2567
2620
  * Negate the current Vector4 and stores the result in the given vector "result" coordinates
2568
2621
  * @param result defines the Vector3 object where to store the result
2569
- * @returns the current Vector4
2622
+ * @returns the result
2570
2623
  */
2571
2624
  negateToRef(result) {
2572
2625
  return result.copyFromFloats(this.x * -1, this.y * -1, this.z * -1, this.w * -1);
@@ -3608,6 +3661,32 @@ export class Quaternion {
3608
3661
  result.z = 0.25 * s;
3609
3662
  }
3610
3663
  }
3664
+ /**
3665
+ * Creates the rotation quaternion needed to rotate from one Vector3 onto another Vector3
3666
+ * @param fromVector the starting vector
3667
+ * @param toVector the ending vector
3668
+ * @returns the rotation quaternion needed
3669
+ */
3670
+ static RotationQuaternionFromOnto(fromVector, toVector) {
3671
+ const ref = Quaternion.Zero();
3672
+ return Quaternion.RotationQuaternionFromOntoToRef(fromVector, toVector, ref);
3673
+ }
3674
+ /**
3675
+ * Creates the rotation quaternion needed to rotate from one Vector3 onto another Vector3 and stores in a result Quaternion
3676
+ * @param fromVector the starting vector
3677
+ * @param toVector the ending vector
3678
+ * @param result the rotation quaternion needed
3679
+ * @returns the result
3680
+ */
3681
+ static RotationQuaternionFromOntoToRef(fromVector, toVector, result) {
3682
+ const normal = TmpVectors.Vector3[0];
3683
+ Vector3.CrossToRef(fromVector, toVector, normal);
3684
+ if (normal.equals(Vector3.ZeroReadOnly)) {
3685
+ fromVector._getNormalToRef(normal);
3686
+ }
3687
+ const angle = Vector3.GetAngleBetweenVectors(fromVector, toVector, normal);
3688
+ return Quaternion.RotationAxisToRef(normal, angle, result);
3689
+ }
3611
3690
  /**
3612
3691
  * Returns the dot product (float) between the quaternions "left" and "right"
3613
3692
  * @param left defines the left operand