@babylonjs/core 5.41.0 → 5.42.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 (44) hide show
  1. package/Actions/action.d.ts +2 -1
  2. package/Actions/action.js +3 -1
  3. package/Actions/action.js.map +1 -1
  4. package/Actions/actionManager.js +5 -7
  5. package/Actions/actionManager.js.map +1 -1
  6. package/Actions/directActions.js +2 -0
  7. package/Actions/directActions.js.map +1 -1
  8. package/Audio/sound.js +5 -5
  9. package/Audio/sound.js.map +1 -1
  10. package/Behaviors/Meshes/fadeInOutBehavior.d.ts +27 -4
  11. package/Behaviors/Meshes/fadeInOutBehavior.js +74 -9
  12. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  13. package/Behaviors/Meshes/pointerDragBehavior.d.ts +8 -1
  14. package/Behaviors/Meshes/pointerDragBehavior.js +8 -2
  15. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  16. package/Engines/WebGL/webGL2ShaderProcessors.js +1 -1
  17. package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
  18. package/Engines/engine.js +25 -26
  19. package/Engines/engine.js.map +1 -1
  20. package/Engines/thinEngine.d.ts +5 -1
  21. package/Engines/thinEngine.js +19 -15
  22. package/Engines/thinEngine.js.map +1 -1
  23. package/Gizmos/axisScaleGizmo.d.ts +2 -1
  24. package/Gizmos/axisScaleGizmo.js +9 -7
  25. package/Gizmos/axisScaleGizmo.js.map +1 -1
  26. package/Gizmos/boundingBoxGizmo.d.ts +3 -0
  27. package/Gizmos/boundingBoxGizmo.js +28 -25
  28. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  29. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +2 -1
  30. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +2 -1
  31. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  32. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.d.ts +4 -2
  33. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js +3 -1
  34. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js.map +1 -1
  35. package/Materials/Node/Blocks/Input/inputBlock.js +7 -0
  36. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  37. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  38. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  39. package/Materials/material.d.ts +2 -0
  40. package/Materials/material.js +4 -0
  41. package/Materials/material.js.map +1 -1
  42. package/Misc/tools.js +1 -1
  43. package/Misc/tools.js.map +1 -1
  44. package/package.json +1 -1
@@ -239,6 +239,10 @@ export declare class ThinEngine {
239
239
  * Gets the current frame id
240
240
  */
241
241
  get frameId(): number;
242
+ /**
243
+ * The time (in milliseconds elapsed since the current page has been loaded) when the engine was initialized
244
+ */
245
+ readonly startTime: number;
242
246
  /** @internal */
243
247
  _uniformBuffers: UniformBuffer[];
244
248
  /** @internal */
@@ -1556,7 +1560,7 @@ export declare class ThinEngine {
1556
1560
  */
1557
1561
  static GetExponentOfTwo(value: number, max: number, mode?: number): number;
1558
1562
  /**
1559
- * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)
1563
+ * Queue a new function into the requested animation frame pool (ie. this function will be executed by the browser (or the javascript engine) for the next frame)
1560
1564
  * @param func - the function to be called
1561
1565
  * @param requester - the object that will request the next frame. Falls back to window.
1562
1566
  * @returns frame number
@@ -19,6 +19,7 @@ import { WebGLHardwareTexture } from "./WebGL/webGLHardwareTexture.js";
19
19
  import { DrawWrapper } from "../Materials/drawWrapper.js";
20
20
  import { StencilStateComposer } from "../States/stencilStateComposer.js";
21
21
  import { ShaderLanguage } from "../Materials/shaderLanguage.js";
22
+ import { PrecisionDate } from "../Misc/precisionDate.js";
22
23
  /**
23
24
  * Keeps track of all the buffer info used in engine.
24
25
  */
@@ -188,6 +189,7 @@ export class ThinEngine {
188
189
  */
189
190
  this.enableUnpackFlipYCached = true;
190
191
  this._boundUniforms = {};
192
+ this.startTime = PrecisionDate.Now;
191
193
  let canvas = null;
192
194
  options = options || {};
193
195
  this._creationOptions = options;
@@ -401,13 +403,13 @@ export class ThinEngine {
401
403
  */
402
404
  // Not mixed with Version for tooling purpose.
403
405
  static get NpmPackage() {
404
- return "babylonjs@5.41.0";
406
+ return "babylonjs@5.42.0";
405
407
  }
406
408
  /**
407
409
  * Returns the current version of the framework
408
410
  */
409
411
  static get Version() {
410
- return "5.41.0";
412
+ return "5.42.0";
411
413
  }
412
414
  /**
413
415
  * Returns a string describing the current engine
@@ -4548,30 +4550,32 @@ export class ThinEngine {
4548
4550
  return Math.min(pot, max);
4549
4551
  }
4550
4552
  /**
4551
- * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)
4553
+ * Queue a new function into the requested animation frame pool (ie. this function will be executed by the browser (or the javascript engine) for the next frame)
4552
4554
  * @param func - the function to be called
4553
4555
  * @param requester - the object that will request the next frame. Falls back to window.
4554
4556
  * @returns frame number
4555
4557
  */
4556
4558
  static QueueNewFrame(func, requester) {
4559
+ // Note that there is kind of a typing issue here, as `setTimeout` might return something else than a number (NodeJs returns a NodeJS.Timeout object).
4560
+ // Also if the global `requestAnimationFrame`'s returnType is number, `requester.requestPostAnimationFrame` and `requester.requestAnimationFrame` types
4561
+ // are `any`.
4557
4562
  if (!IsWindowObjectExist()) {
4558
- if (typeof requestAnimationFrame !== "undefined") {
4563
+ if (typeof requestAnimationFrame === "function") {
4559
4564
  return requestAnimationFrame(func);
4560
4565
  }
4561
- return setTimeout(func, 16);
4562
- }
4563
- if (!requester) {
4564
- requester = window;
4565
- }
4566
- if (requester.requestPostAnimationFrame) {
4567
- return requester.requestPostAnimationFrame(func);
4568
- }
4569
- else if (requester.requestAnimationFrame) {
4570
- return requester.requestAnimationFrame(func);
4571
4566
  }
4572
4567
  else {
4573
- return window.setTimeout(func, 16);
4568
+ const { requestPostAnimationFrame, requestAnimationFrame } = requester || window;
4569
+ if (typeof requestPostAnimationFrame === "function") {
4570
+ return requestPostAnimationFrame(func);
4571
+ }
4572
+ if (typeof requestAnimationFrame === "function") {
4573
+ return requestAnimationFrame(func);
4574
+ }
4574
4575
  }
4576
+ // fallback to the global `setTimeout`.
4577
+ // In most cases (aka in the browser), `window` is the global object, so instead of calling `window.setTimeout` we could call the global `setTimeout`.
4578
+ return setTimeout(func, 16);
4575
4579
  }
4576
4580
  /**
4577
4581
  * Gets host document