@babylonjs/core 5.17.1 → 5.18.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 (77) hide show
  1. package/Engines/Extensions/engine.views.d.ts +13 -0
  2. package/Engines/Extensions/engine.views.js +16 -1
  3. package/Engines/Extensions/engine.views.js.map +1 -1
  4. package/Engines/engine.d.ts +2 -0
  5. package/Engines/engineFeatures.d.ts +2 -0
  6. package/Engines/engineFeatures.js.map +1 -1
  7. package/Engines/nativeEngine.js +1 -0
  8. package/Engines/nativeEngine.js.map +1 -1
  9. package/Engines/nullEngine.js +1 -0
  10. package/Engines/nullEngine.js.map +1 -1
  11. package/Engines/thinEngine.js +9 -3
  12. package/Engines/thinEngine.js.map +1 -1
  13. package/Engines/webgpuEngine.js +1 -0
  14. package/Engines/webgpuEngine.js.map +1 -1
  15. package/Gizmos/axisDragGizmo.d.ts +11 -8
  16. package/Gizmos/axisDragGizmo.js.map +1 -1
  17. package/Gizmos/axisScaleGizmo.d.ts +20 -13
  18. package/Gizmos/axisScaleGizmo.js.map +1 -1
  19. package/Gizmos/boundingBoxGizmo.d.ts +23 -18
  20. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  21. package/Gizmos/cameraGizmo.d.ts +8 -5
  22. package/Gizmos/cameraGizmo.js.map +1 -1
  23. package/Gizmos/gizmo.d.ts +48 -6
  24. package/Gizmos/gizmo.js.map +1 -1
  25. package/Gizmos/gizmoManager.d.ts +17 -9
  26. package/Gizmos/gizmoManager.js.map +1 -1
  27. package/Gizmos/lightGizmo.d.ts +12 -7
  28. package/Gizmos/lightGizmo.js.map +1 -1
  29. package/Gizmos/planeDragGizmo.d.ts +10 -8
  30. package/Gizmos/planeDragGizmo.js.map +1 -1
  31. package/Gizmos/planeRotationGizmo.d.ts +23 -14
  32. package/Gizmos/planeRotationGizmo.js.map +1 -1
  33. package/Gizmos/positionGizmo.d.ts +9 -7
  34. package/Gizmos/positionGizmo.js +1 -1
  35. package/Gizmos/positionGizmo.js.map +1 -1
  36. package/Gizmos/rotationGizmo.d.ts +6 -4
  37. package/Gizmos/rotationGizmo.js.map +1 -1
  38. package/Gizmos/scaleGizmo.d.ts +15 -12
  39. package/Gizmos/scaleGizmo.js.map +1 -1
  40. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +18 -0
  41. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +85 -1
  42. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  43. package/Materials/Node/nodeMaterial.d.ts +6 -0
  44. package/Materials/Node/nodeMaterial.js +11 -0
  45. package/Materials/Node/nodeMaterial.js.map +1 -1
  46. package/Maths/math.vector.d.ts +2 -2
  47. package/Maths/math.vector.js +18 -30
  48. package/Maths/math.vector.js.map +1 -1
  49. package/Meshes/Compression/dracoCompression.js +1 -1
  50. package/Meshes/Compression/dracoCompression.js.map +1 -1
  51. package/Misc/basis.js +3 -0
  52. package/Misc/basis.js.map +1 -1
  53. package/Misc/fileTools.js +2 -2
  54. package/Misc/fileTools.js.map +1 -1
  55. package/Misc/khronosTextureContainer2.js +1 -1
  56. package/Misc/khronosTextureContainer2.js.map +1 -1
  57. package/Misc/tools.d.ts +2 -2
  58. package/Misc/tools.js +4 -1
  59. package/Misc/tools.js.map +1 -1
  60. package/Offline/database.js +6 -8
  61. package/Offline/database.js.map +1 -1
  62. package/Physics/Plugins/ammoJSPlugin.d.ts +2 -2
  63. package/Physics/Plugins/ammoJSPlugin.js +29 -29
  64. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  65. package/Physics/Plugins/cannonJSPlugin.d.ts +2 -2
  66. package/Physics/Plugins/cannonJSPlugin.js +26 -26
  67. package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
  68. package/Physics/Plugins/oimoJSPlugin.js +9 -11
  69. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  70. package/Physics/physicsImpostor.d.ts +6 -6
  71. package/Physics/physicsImpostor.js +7 -6
  72. package/Physics/physicsImpostor.js.map +1 -1
  73. package/Shaders/sprites.fragment.js +1 -1
  74. package/Shaders/sprites.fragment.js.map +1 -1
  75. package/Sprites/spriteRenderer.js +1 -1
  76. package/Sprites/spriteRenderer.js.map +1 -1
  77. package/package.json +1 -1
@@ -635,14 +635,14 @@ export declare class Vector3 {
635
635
  */
636
636
  scaleAndAddToRef(scale: number, result: Vector3): Vector3;
637
637
  /**
638
- * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.
638
+ * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.
639
639
  * @param plane defines the plane to project to
640
640
  * @param origin defines the origin of the projection ray
641
641
  * @returns the projected vector3
642
642
  */
643
643
  projectOnPlane(plane: Plane, origin: Vector3): Vector3;
644
644
  /**
645
- * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.
645
+ * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.
646
646
  * @param plane defines the plane to project to
647
647
  * @param origin defines the origin of the projection ray
648
648
  * @param result defines the Vector3 where to store the result
@@ -989,7 +989,7 @@ var Vector3 = /** @class */ (function () {
989
989
  return result.addInPlaceFromFloats(this._x * scale, this._y * scale, this._z * scale);
990
990
  };
991
991
  /**
992
- * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.
992
+ * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.
993
993
  * @param plane defines the plane to project to
994
994
  * @param origin defines the origin of the projection ray
995
995
  * @returns the projected vector3
@@ -1000,41 +1000,29 @@ var Vector3 = /** @class */ (function () {
1000
1000
  return result;
1001
1001
  };
1002
1002
  /**
1003
- * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.
1003
+ * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.
1004
1004
  * @param plane defines the plane to project to
1005
1005
  * @param origin defines the origin of the projection ray
1006
1006
  * @param result defines the Vector3 where to store the result
1007
1007
  */
1008
1008
  Vector3.prototype.projectOnPlaneToRef = function (plane, origin, 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 _a = this, x = _a.x, y = _a.y, z = _a.z;
1017
- // Calculate how close the direction is to the normal of the plane
1018
- var dotProduct = Vector3.Dot(inverseNormal, this);
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;
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
+ //When the ray is close to parallel to the plane return infinity vector
1017
+ if (Math.abs(denom) < Math.pow(10, -10)) {
1018
+ origin.addToRef(new Vector3(Infinity, Infinity, Infinity), result);
1019
+ }
1020
+ else {
1021
+ var t = -(Vector3.Dot(origin, n) + d) / denom;
1022
+ // P = P0 + t*V
1023
+ var scaledV = V.scaleInPlace(t);
1024
+ origin.addToRef(scaledV, result);
1030
1025
  }
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 + x * hitDistance, origin.y + y * hitDistance, origin.z + z * hitDistance);
1038
1026
  };
1039
1027
  /**
1040
1028
  * Returns true if the current Vector3 and the given vector coordinates are strictly equal