@babylonjs/core 5.10.0 → 5.12.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 (87) hide show
  1. package/Cameras/Inputs/freeCameraTouchInput.d.ts +1 -0
  2. package/Cameras/Inputs/freeCameraTouchInput.js +3 -2
  3. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  4. package/Engines/Extensions/engine.query.js +1 -1
  5. package/Engines/Extensions/engine.query.js.map +1 -1
  6. package/Engines/ICanvas.d.ts +5 -0
  7. package/Engines/ICanvas.js.map +1 -1
  8. package/Engines/WebGPU/webgpuConstants.d.ts +1 -1
  9. package/Engines/WebGPU/webgpuConstants.js +5 -5
  10. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  11. package/Engines/engine.d.ts +2 -2
  12. package/Engines/thinEngine.js +2 -2
  13. package/Engines/thinEngine.js.map +1 -1
  14. package/Engines/webgpuEngine.js +1 -1
  15. package/Engines/webgpuEngine.js.map +1 -1
  16. package/Materials/Background/backgroundMaterial.js +2 -1
  17. package/Materials/Background/backgroundMaterial.js.map +1 -1
  18. package/Materials/Node/nodeMaterial.js +2 -1
  19. package/Materials/Node/nodeMaterial.js.map +1 -1
  20. package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +1 -1
  21. package/Materials/PBR/pbrAnisotropicConfiguration.js +1 -1
  22. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  23. package/Materials/PBR/pbrBaseMaterial.js +9 -4
  24. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  25. package/Materials/Textures/baseTexture.d.ts +2 -1
  26. package/Materials/Textures/baseTexture.js +6 -3
  27. package/Materials/Textures/baseTexture.js.map +1 -1
  28. package/Materials/Textures/cubeTexture.js +1 -1
  29. package/Materials/Textures/cubeTexture.js.map +1 -1
  30. package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
  31. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  32. package/Materials/Textures/hdrCubeTexture.js +1 -1
  33. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  34. package/Materials/effect.d.ts +5 -0
  35. package/Materials/effect.js +5 -0
  36. package/Materials/effect.js.map +1 -1
  37. package/Materials/material.d.ts +2 -0
  38. package/Materials/material.js +4 -1
  39. package/Materials/material.js.map +1 -1
  40. package/Materials/materialPluginBase.d.ts +14 -0
  41. package/Materials/materialPluginBase.js +16 -0
  42. package/Materials/materialPluginBase.js.map +1 -1
  43. package/Materials/materialPluginEvent.d.ts +2 -0
  44. package/Materials/materialPluginEvent.js.map +1 -1
  45. package/Materials/materialPluginManager.d.ts +1 -0
  46. package/Materials/materialPluginManager.js +13 -1
  47. package/Materials/materialPluginManager.js.map +1 -1
  48. package/Materials/shaderMaterial.d.ts +17 -2
  49. package/Materials/shaderMaterial.js +65 -4
  50. package/Materials/shaderMaterial.js.map +1 -1
  51. package/Materials/standardMaterial.js +8 -3
  52. package/Materials/standardMaterial.js.map +1 -1
  53. package/Maths/math.vector.d.ts +7 -0
  54. package/Maths/math.vector.js +43 -11
  55. package/Maths/math.vector.js.map +1 -1
  56. package/Meshes/Builders/shapeBuilder.d.ts +12 -0
  57. package/Meshes/Builders/shapeBuilder.js +48 -10
  58. package/Meshes/Builders/shapeBuilder.js.map +1 -1
  59. package/Meshes/mesh.js +1 -1
  60. package/Meshes/mesh.js.map +1 -1
  61. package/Meshes/subMesh.d.ts +2 -1
  62. package/Meshes/subMesh.js +4 -2
  63. package/Meshes/subMesh.js.map +1 -1
  64. package/Misc/computePressure.js +4 -3
  65. package/Misc/computePressure.js.map +1 -1
  66. package/Misc/iInspectable.d.ts +1 -1
  67. package/Misc/iInspectable.js.map +1 -1
  68. package/Misc/screenshotTools.js +31 -14
  69. package/Misc/screenshotTools.js.map +1 -1
  70. package/Misc/tools.d.ts +16 -0
  71. package/Misc/tools.js +44 -30
  72. package/Misc/tools.js.map +1 -1
  73. package/Offline/database.js +2 -2
  74. package/Offline/database.js.map +1 -1
  75. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +1 -1
  76. package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
  77. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  78. package/Rendering/prePassRendererSceneComponent.js +2 -2
  79. package/Rendering/prePassRendererSceneComponent.js.map +1 -1
  80. package/XR/webXRCamera.js +11 -0
  81. package/XR/webXRCamera.js.map +1 -1
  82. package/XR/webXRExperienceHelper.js +2 -1
  83. package/XR/webXRExperienceHelper.js.map +1 -1
  84. package/package.json +2 -2
  85. package/sceneComponent.d.ts +2 -2
  86. package/sceneComponent.js +2 -2
  87. package/sceneComponent.js.map +1 -1
@@ -1852,6 +1852,13 @@ export declare class Quaternion {
1852
1852
  * @returns a new array populated with 4 elements from the quaternion coordinates
1853
1853
  */
1854
1854
  asArray(): number[];
1855
+ /**
1856
+ * Stores from the starting index in the given array the Quaternion successive values
1857
+ * @param array defines the array where to store the x,y,z,w components
1858
+ * @param index defines an optional index in the target array to define where to start storing values
1859
+ * @returns the current Quaternion object
1860
+ */
1861
+ toArray(array: FloatArray, index?: number): Quaternion;
1855
1862
  /**
1856
1863
  * Check if two quaternions are equals
1857
1864
  * @param otherQuaternion defines the second operand
@@ -1006,17 +1006,35 @@ var Vector3 = /** @class */ (function () {
1006
1006
  * @param result defines the Vector3 where to store the result
1007
1007
  */
1008
1008
  Vector3.prototype.projectOnPlaneToRef = function (plane, origin, result) {
1009
- var n = plane.normal;
1010
- var d = plane.d;
1011
- var V = MathTmp.Vector3[0];
1012
- // ray direction
1013
- this.subtractToRef(origin, V);
1014
- V.normalize();
1015
- var denom = Vector3.Dot(V, n);
1016
- var t = -(Vector3.Dot(origin, n) + d) / denom;
1017
- // P = P0 + t*V
1018
- var scaledV = V.scaleInPlace(t);
1019
- origin.addToRef(scaledV, result);
1009
+ // Use the normal scaled to the plane offset as the origin for the formula
1010
+ var planeOrigin = MathTmp.Vector3[0];
1011
+ plane.normal.scaleToRef(-plane.d, planeOrigin);
1012
+ // Since the normal in Babylon should point toward the viewer, invert it for the dot product
1013
+ var inverseNormal = MathTmp.Vector3[1];
1014
+ plane.normal.negateToRef(inverseNormal);
1015
+ // This vector is the direction
1016
+ var direction = this;
1017
+ // Calculate how close the direction is to the normal of the plane
1018
+ var dotProduct = Vector3.Dot(inverseNormal, direction);
1019
+ /*
1020
+ * Early out in case the direction will never hit the plane.
1021
+ *
1022
+ * Epsilon is used to avoid issues with rays very near to parallel with the
1023
+ * plane, and squared because as of writing the value is not sufficiently
1024
+ * small for this use case.
1025
+ */
1026
+ if (dotProduct <= Epsilon * Epsilon) {
1027
+ // No good option for setting the result vector here, so just take the origin of the ray
1028
+ result.copyFrom(origin);
1029
+ return;
1030
+ }
1031
+ // Calculate the offset
1032
+ var relativeOrigin = MathTmp.Vector3[2];
1033
+ planeOrigin.subtractToRef(origin, relativeOrigin);
1034
+ // Calculate the length along the direction vector to the hit point
1035
+ var hitDistance = Vector3.Dot(relativeOrigin, inverseNormal) / dotProduct;
1036
+ // Apply the hit point by adding the direction scaled by the distance to the origin
1037
+ result.set(origin.x + direction.x * hitDistance, origin.y + direction.y * hitDistance, origin.z + direction.z * hitDistance);
1020
1038
  };
1021
1039
  /**
1022
1040
  * Returns true if the current Vector3 and the given vector coordinates are strictly equal
@@ -3159,6 +3177,20 @@ var Quaternion = /** @class */ (function () {
3159
3177
  Quaternion.prototype.asArray = function () {
3160
3178
  return [this._x, this._y, this._z, this._w];
3161
3179
  };
3180
+ /**
3181
+ * Stores from the starting index in the given array the Quaternion successive values
3182
+ * @param array defines the array where to store the x,y,z,w components
3183
+ * @param index defines an optional index in the target array to define where to start storing values
3184
+ * @returns the current Quaternion object
3185
+ */
3186
+ Quaternion.prototype.toArray = function (array, index) {
3187
+ if (index === void 0) { index = 0; }
3188
+ array[index] = this.x;
3189
+ array[index + 1] = this.y;
3190
+ array[index + 2] = this.z;
3191
+ array[index + 3] = this.w;
3192
+ return this;
3193
+ };
3162
3194
  /**
3163
3195
  * Check if two quaternions are equals
3164
3196
  * @param otherQuaternion defines the second operand