@babylonjs/core 5.17.0 → 5.19.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 (102) hide show
  1. package/Debug/debugLayer.d.ts +36 -0
  2. package/Debug/debugLayer.js.map +1 -1
  3. package/Engines/Extensions/engine.query.js +5 -1
  4. package/Engines/Extensions/engine.query.js.map +1 -1
  5. package/Engines/Extensions/engine.transformFeedback.js +5 -1
  6. package/Engines/Extensions/engine.transformFeedback.js.map +1 -1
  7. package/Engines/Extensions/engine.views.d.ts +13 -0
  8. package/Engines/Extensions/engine.views.js +16 -1
  9. package/Engines/Extensions/engine.views.js.map +1 -1
  10. package/Engines/engine.d.ts +15 -240
  11. package/Engines/engineFeatures.d.ts +2 -0
  12. package/Engines/engineFeatures.js.map +1 -1
  13. package/Engines/nativeEngine.js +1 -0
  14. package/Engines/nativeEngine.js.map +1 -1
  15. package/Engines/nullEngine.js +1 -0
  16. package/Engines/nullEngine.js.map +1 -1
  17. package/Engines/thinEngine.d.ts +1 -1
  18. package/Engines/thinEngine.js +14 -4
  19. package/Engines/thinEngine.js.map +1 -1
  20. package/Engines/webgpuEngine.js +1 -0
  21. package/Engines/webgpuEngine.js.map +1 -1
  22. package/Gizmos/axisDragGizmo.d.ts +31 -9
  23. package/Gizmos/axisDragGizmo.js.map +1 -1
  24. package/Gizmos/axisScaleGizmo.d.ts +46 -14
  25. package/Gizmos/axisScaleGizmo.js.map +1 -1
  26. package/Gizmos/boundingBoxGizmo.d.ts +94 -19
  27. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  28. package/Gizmos/cameraGizmo.d.ts +23 -6
  29. package/Gizmos/cameraGizmo.js.map +1 -1
  30. package/Gizmos/gizmo.d.ts +48 -6
  31. package/Gizmos/gizmo.js.map +1 -1
  32. package/Gizmos/gizmoManager.d.ts +25 -17
  33. package/Gizmos/gizmoManager.js.map +1 -1
  34. package/Gizmos/lightGizmo.d.ts +25 -8
  35. package/Gizmos/lightGizmo.js.map +1 -1
  36. package/Gizmos/planeDragGizmo.d.ts +30 -9
  37. package/Gizmos/planeDragGizmo.js.map +1 -1
  38. package/Gizmos/planeRotationGizmo.d.ts +45 -15
  39. package/Gizmos/planeRotationGizmo.js.map +1 -1
  40. package/Gizmos/positionGizmo.d.ts +53 -17
  41. package/Gizmos/positionGizmo.js +1 -1
  42. package/Gizmos/positionGizmo.js.map +1 -1
  43. package/Gizmos/rotationGizmo.d.ts +35 -10
  44. package/Gizmos/rotationGizmo.js.map +1 -1
  45. package/Gizmos/scaleGizmo.d.ts +49 -18
  46. package/Gizmos/scaleGizmo.js.map +1 -1
  47. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +18 -0
  48. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +85 -1
  49. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  50. package/Materials/Node/nodeMaterial.d.ts +8 -1
  51. package/Materials/Node/nodeMaterial.js +15 -3
  52. package/Materials/Node/nodeMaterial.js.map +1 -1
  53. package/Materials/Textures/baseTexture.d.ts +2 -1
  54. package/Materials/Textures/baseTexture.js +4 -1
  55. package/Materials/Textures/baseTexture.js.map +1 -1
  56. package/Materials/Textures/renderTargetTexture.js +3 -0
  57. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  58. package/Materials/index.d.ts +1 -0
  59. package/Materials/index.js +1 -0
  60. package/Materials/index.js.map +1 -1
  61. package/Maths/math.vector.d.ts +18 -3
  62. package/Maths/math.vector.js +52 -31
  63. package/Maths/math.vector.js.map +1 -1
  64. package/Meshes/Compression/dracoCompression.js +1 -1
  65. package/Meshes/Compression/dracoCompression.js.map +1 -1
  66. package/Meshes/groundMesh.js +1 -1
  67. package/Meshes/groundMesh.js.map +1 -1
  68. package/Misc/assetsManager.d.ts +9 -0
  69. package/Misc/assetsManager.js +3 -1
  70. package/Misc/assetsManager.js.map +1 -1
  71. package/Misc/basis.js +10 -4
  72. package/Misc/basis.js.map +1 -1
  73. package/Misc/computePressure.d.ts +9 -3
  74. package/Misc/computePressure.js +13 -5
  75. package/Misc/computePressure.js.map +1 -1
  76. package/Misc/fileTools.js +2 -2
  77. package/Misc/fileTools.js.map +1 -1
  78. package/Misc/khronosTextureContainer2.js +1 -1
  79. package/Misc/khronosTextureContainer2.js.map +1 -1
  80. package/Misc/tools.d.ts +2 -2
  81. package/Misc/tools.js +4 -1
  82. package/Misc/tools.js.map +1 -1
  83. package/Offline/database.js +6 -8
  84. package/Offline/database.js.map +1 -1
  85. package/Physics/Plugins/ammoJSPlugin.d.ts +2 -2
  86. package/Physics/Plugins/ammoJSPlugin.js +29 -29
  87. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  88. package/Physics/Plugins/cannonJSPlugin.d.ts +2 -2
  89. package/Physics/Plugins/cannonJSPlugin.js +26 -26
  90. package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
  91. package/Physics/Plugins/oimoJSPlugin.js +9 -11
  92. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  93. package/Physics/physicsImpostor.d.ts +6 -6
  94. package/Physics/physicsImpostor.js +15 -8
  95. package/Physics/physicsImpostor.js.map +1 -1
  96. package/Shaders/sprites.fragment.js +1 -1
  97. package/Shaders/sprites.fragment.js.map +1 -1
  98. package/Sprites/spriteRenderer.js +1 -1
  99. package/Sprites/spriteRenderer.js.map +1 -1
  100. package/package.json +1 -1
  101. package/scene.js +5 -3
  102. package/scene.js.map +1 -1
@@ -406,6 +406,16 @@ var Vector2 = /** @class */ (function () {
406
406
  Vector2.One = function () {
407
407
  return new Vector2(1, 1);
408
408
  };
409
+ Object.defineProperty(Vector2, "ZeroReadOnly", {
410
+ /**
411
+ * Gets a zero Vector2 that must not be updated
412
+ */
413
+ get: function () {
414
+ return Vector2._ZeroReadOnly;
415
+ },
416
+ enumerable: false,
417
+ configurable: true
418
+ });
409
419
  /**
410
420
  * Gets a new Vector2 set from the given index element of the given array
411
421
  * @param array defines the data source
@@ -677,6 +687,7 @@ var Vector2 = /** @class */ (function () {
677
687
  var proj = segA.add(v.multiplyByFloats(t, t));
678
688
  return Vector2.Distance(p, proj);
679
689
  };
690
+ Vector2._ZeroReadOnly = Vector2.Zero();
680
691
  return Vector2;
681
692
  }());
682
693
  export { Vector2 };
@@ -989,7 +1000,7 @@ var Vector3 = /** @class */ (function () {
989
1000
  return result.addInPlaceFromFloats(this._x * scale, this._y * scale, this._z * scale);
990
1001
  };
991
1002
  /**
992
- * 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.
993
1004
  * @param plane defines the plane to project to
994
1005
  * @param origin defines the origin of the projection ray
995
1006
  * @returns the projected vector3
@@ -1000,41 +1011,29 @@ var Vector3 = /** @class */ (function () {
1000
1011
  return result;
1001
1012
  };
1002
1013
  /**
1003
- * Projects the current vector3 to a plane along a ray starting from a specified origin and directed towards the point.
1014
+ * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.
1004
1015
  * @param plane defines the plane to project to
1005
1016
  * @param origin defines the origin of the projection ray
1006
1017
  * @param result defines the Vector3 where to store the result
1007
1018
  */
1008
1019
  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;
1020
+ var n = plane.normal;
1021
+ var d = plane.d;
1022
+ var V = MathTmp.Vector3[0];
1023
+ // ray direction
1024
+ this.subtractToRef(origin, V);
1025
+ V.normalize();
1026
+ var denom = Vector3.Dot(V, n);
1027
+ //When the ray is close to parallel to the plane return infinity vector
1028
+ if (Math.abs(denom) < Math.pow(10, -10)) {
1029
+ result.setAll(Infinity);
1030
+ }
1031
+ else {
1032
+ var t = -(Vector3.Dot(origin, n) + d) / denom;
1033
+ // P = P0 + t*V
1034
+ var scaledV = V.scaleInPlace(t);
1035
+ origin.addToRef(scaledV, result);
1030
1036
  }
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
1037
  };
1039
1038
  /**
1040
1039
  * Returns true if the current Vector3 and the given vector coordinates are strictly equal
@@ -1582,7 +1581,7 @@ var Vector3 = /** @class */ (function () {
1582
1581
  };
1583
1582
  Object.defineProperty(Vector3, "UpReadOnly", {
1584
1583
  /**
1585
- * Gets a up Vector3 that must not be updated
1584
+ * Gets an up Vector3 that must not be updated
1586
1585
  */
1587
1586
  get: function () {
1588
1587
  return Vector3._UpReadOnly;
@@ -1590,6 +1589,16 @@ var Vector3 = /** @class */ (function () {
1590
1589
  enumerable: false,
1591
1590
  configurable: true
1592
1591
  });
1592
+ Object.defineProperty(Vector3, "DownReadOnly", {
1593
+ /**
1594
+ * Gets a down Vector3 that must not be updated
1595
+ */
1596
+ get: function () {
1597
+ return Vector3._DownReadOnly;
1598
+ },
1599
+ enumerable: false,
1600
+ configurable: true
1601
+ });
1593
1602
  Object.defineProperty(Vector3, "RightReadOnly", {
1594
1603
  /**
1595
1604
  * Gets a right Vector3 that must not be updated
@@ -2305,6 +2314,7 @@ var Vector3 = /** @class */ (function () {
2305
2314
  quat.toEulerAnglesToRef(ref);
2306
2315
  };
2307
2316
  Vector3._UpReadOnly = Vector3.Up();
2317
+ Vector3._DownReadOnly = Vector3.Down();
2308
2318
  Vector3._LeftHandedForwardReadOnly = Vector3.Forward(false);
2309
2319
  Vector3._RightHandedForwardReadOnly = Vector3.Forward(true);
2310
2320
  Vector3._RightReadOnly = Vector3.Right();
@@ -2882,6 +2892,16 @@ var Vector4 = /** @class */ (function () {
2882
2892
  Vector4.One = function () {
2883
2893
  return new Vector4(1.0, 1.0, 1.0, 1.0);
2884
2894
  };
2895
+ Object.defineProperty(Vector4, "ZeroReadOnly", {
2896
+ /**
2897
+ * Gets a zero Vector4 that must not be updated
2898
+ */
2899
+ get: function () {
2900
+ return Vector4._ZeroReadOnly;
2901
+ },
2902
+ enumerable: false,
2903
+ configurable: true
2904
+ });
2885
2905
  /**
2886
2906
  * Returns a new normalized Vector4 from the given one.
2887
2907
  * @param vector the vector to normalize
@@ -3065,6 +3085,7 @@ var Vector4 = /** @class */ (function () {
3065
3085
  if (w === void 0) { w = 0; }
3066
3086
  return new Vector4(source._x, source._y, source._z, w);
3067
3087
  };
3088
+ Vector4._ZeroReadOnly = Vector4.Zero();
3068
3089
  return Vector4;
3069
3090
  }());
3070
3091
  export { Vector4 };