@babylonjs/core 5.48.0 → 5.48.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 (66) hide show
  1. package/Bones/skeleton.js +1 -1
  2. package/Bones/skeleton.js.map +1 -1
  3. package/Debug/physicsViewer.js +4 -0
  4. package/Debug/physicsViewer.js.map +1 -1
  5. package/Engines/Native/nativeInterfaces.d.ts +0 -1
  6. package/Engines/Native/nativeInterfaces.js.map +1 -1
  7. package/Engines/engine.d.ts +3 -1
  8. package/Engines/engine.js +14 -5
  9. package/Engines/engine.js.map +1 -1
  10. package/Engines/engineStore.d.ts +6 -0
  11. package/Engines/engineStore.js +6 -0
  12. package/Engines/engineStore.js.map +1 -1
  13. package/Engines/nativeEngine.d.ts +3 -2
  14. package/Engines/nativeEngine.js +9 -5
  15. package/Engines/nativeEngine.js.map +1 -1
  16. package/Engines/thinEngine.d.ts +4 -3
  17. package/Engines/thinEngine.js +11 -13
  18. package/Engines/thinEngine.js.map +1 -1
  19. package/Helpers/environmentHelper.d.ts +1 -0
  20. package/Helpers/environmentHelper.js +6 -5
  21. package/Helpers/environmentHelper.js.map +1 -1
  22. package/Loading/Plugins/babylonFileLoader.js +1 -0
  23. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  24. package/Materials/Background/backgroundMaterial.js +1 -1
  25. package/Materials/Background/backgroundMaterial.js.map +1 -1
  26. package/Materials/Node/Blocks/Input/inputBlock.js +8 -8
  27. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  28. package/Materials/Textures/thinTexture.d.ts +4 -2
  29. package/Materials/Textures/thinTexture.js +5 -2
  30. package/Materials/Textures/thinTexture.js.map +1 -1
  31. package/Materials/material.js +5 -0
  32. package/Materials/material.js.map +1 -1
  33. package/Materials/materialHelper.js +1 -1
  34. package/Materials/materialHelper.js.map +1 -1
  35. package/Materials/materialPluginBase.js +3 -0
  36. package/Materials/materialPluginBase.js.map +1 -1
  37. package/Materials/pushMaterial.d.ts +2 -1
  38. package/Materials/pushMaterial.js +4 -0
  39. package/Materials/pushMaterial.js.map +1 -1
  40. package/Maths/math.color.d.ts +20 -12
  41. package/Maths/math.color.js +85 -31
  42. package/Maths/math.color.js.map +1 -1
  43. package/Misc/decorators.js +2 -2
  44. package/Misc/decorators.js.map +1 -1
  45. package/Misc/fileTools.js +3 -0
  46. package/Misc/fileTools.js.map +1 -1
  47. package/Misc/khronosTextureContainer2.d.ts +3 -3
  48. package/Misc/khronosTextureContainer2.js +4 -3
  49. package/Misc/khronosTextureContainer2.js.map +1 -1
  50. package/Misc/observable.d.ts +18 -1
  51. package/Misc/observable.js +28 -2
  52. package/Misc/observable.js.map +1 -1
  53. package/Physics/v2/IPhysicsEnginePlugin.d.ts +3 -0
  54. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  55. package/Physics/v2/physicsAggregate.js +1 -1
  56. package/Physics/v2/physicsAggregate.js.map +1 -1
  57. package/Physics/v2/physicsBody.d.ts +12 -0
  58. package/Physics/v2/physicsBody.js +19 -0
  59. package/Physics/v2/physicsBody.js.map +1 -1
  60. package/Physics/v2/physicsShape.d.ts +24 -4
  61. package/Physics/v2/physicsShape.js +24 -13
  62. package/Physics/v2/physicsShape.js.map +1 -1
  63. package/package.json +1 -1
  64. package/scene.d.ts +1 -1
  65. package/scene.js +47 -46
  66. package/scene.js.map +1 -1
@@ -1,3 +1,4 @@
1
+ import { Observable } from "../Misc/observable";
1
2
  import type { Nullable } from "../types";
2
3
  declare type Engine = import("./engine").Engine;
3
4
  declare type Scene = import("../scene").Scene;
@@ -8,6 +9,11 @@ declare type Scene = import("../scene").Scene;
8
9
  export declare class EngineStore {
9
10
  /** Gets the list of created engines */
10
11
  static Instances: import("./engine").Engine[];
12
+ /**
13
+ * Notifies when an engine was disposed.
14
+ * Mainly used for static/cache cleanup
15
+ */
16
+ static OnEnginesDisposedObservable: Observable<import("./engine").Engine>;
11
17
  /** @internal */
12
18
  static _LastCreatedScene: Nullable<Scene>;
13
19
  /**
@@ -1,3 +1,4 @@
1
+ import { Observable } from "../Misc/observable.js";
1
2
  /**
2
3
  * The engine store class is responsible to hold all the instances of Engine and Scene created
3
4
  * during the life time of the application.
@@ -21,6 +22,11 @@ export class EngineStore {
21
22
  }
22
23
  /** Gets the list of created engines */
23
24
  EngineStore.Instances = new Array();
25
+ /**
26
+ * Notifies when an engine was disposed.
27
+ * Mainly used for static/cache cleanup
28
+ */
29
+ EngineStore.OnEnginesDisposedObservable = new Observable();
24
30
  /** @internal */
25
31
  EngineStore._LastCreatedScene = null;
26
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"engineStore.js","sourceRoot":"","sources":["../../../../lts/core/generated/Engines/engineStore.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,OAAO,WAAW;IAOpB;;OAEG;IACI,MAAM,KAAK,iBAAiB;QAC/B,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,gBAAgB;QAC9B,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;;AAtBD,uCAAuC;AACzB,qBAAS,GAAG,IAAI,KAAK,EAAU,CAAC;AAE9C,gBAAgB;AACF,6BAAiB,GAAoB,IAAI,CAAC;AAoBxD;;;GAGG;AACW,8BAAkB,GAAG,IAAI,CAAC;AAExC;;;GAGG;AACW,2BAAe,GAAG,EAAE,CAAC","sourcesContent":["import type { Nullable } from \"../types\";\r\n\r\ndeclare type Engine = import(\"./engine\").Engine;\r\ndeclare type Scene = import(\"../scene\").Scene;\r\n\r\n/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nexport class EngineStore {\r\n /** Gets the list of created engines */\r\n public static Instances = new Array<Engine>();\r\n\r\n /** @internal */\r\n public static _LastCreatedScene: Nullable<Scene> = null;\r\n\r\n /**\r\n * Gets the latest created engine\r\n */\r\n public static get LastCreatedEngine(): Nullable<Engine> {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n\r\n return this.Instances[this.Instances.length - 1];\r\n }\r\n\r\n /**\r\n * Gets the latest created scene\r\n */\r\n public static get LastCreatedScene(): Nullable<Scene> {\r\n return this._LastCreatedScene;\r\n }\r\n\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n public static UseFallbackTexture = true;\r\n\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n public static FallbackTexture = \"\";\r\n}\r\n"]}
1
+ {"version":3,"file":"engineStore.js","sourceRoot":"","sources":["../../../../lts/core/generated/Engines/engineStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD;;;GAGG;AACH,MAAM,OAAO,WAAW;IAapB;;OAEG;IACI,MAAM,KAAK,iBAAiB;QAC/B,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,gBAAgB;QAC9B,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;;AA5BD,uCAAuC;AACzB,qBAAS,GAAG,IAAI,KAAK,EAAU,CAAC;AAE9C;;;GAGG;AACW,uCAA2B,GAAG,IAAI,UAAU,EAAU,CAAC;AAErE,gBAAgB;AACF,6BAAiB,GAAoB,IAAI,CAAC;AAoBxD;;;GAGG;AACW,8BAAkB,GAAG,IAAI,CAAC;AAExC;;;GAGG;AACW,2BAAe,GAAG,EAAE,CAAC","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\n\r\ndeclare type Engine = import(\"./engine\").Engine;\r\ndeclare type Scene = import(\"../scene\").Scene;\r\n\r\n/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nexport class EngineStore {\r\n /** Gets the list of created engines */\r\n public static Instances = new Array<Engine>();\r\n\r\n /**\r\n * Notifies when an engine was disposed.\r\n * Mainly used for static/cache cleanup\r\n */\r\n public static OnEnginesDisposedObservable = new Observable<Engine>();\r\n\r\n /** @internal */\r\n public static _LastCreatedScene: Nullable<Scene> = null;\r\n\r\n /**\r\n * Gets the latest created engine\r\n */\r\n public static get LastCreatedEngine(): Nullable<Engine> {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n\r\n return this.Instances[this.Instances.length - 1];\r\n }\r\n\r\n /**\r\n * Gets the latest created scene\r\n */\r\n public static get LastCreatedScene(): Nullable<Scene> {\r\n return this._LastCreatedScene;\r\n }\r\n\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n public static UseFallbackTexture = true;\r\n\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n public static FallbackTexture = \"\";\r\n}\r\n"]}
@@ -70,7 +70,6 @@ export declare class NativeEngine extends Engine {
70
70
  private _zOffset;
71
71
  private _zOffsetUnits;
72
72
  private _depthWrite;
73
- getHardwareScalingLevel(): number;
74
73
  setHardwareScalingLevel(level: number): void;
75
74
  constructor(options?: NativeEngineOptions);
76
75
  dispose(): void;
@@ -378,9 +377,11 @@ export declare class NativeEngine extends Engine {
378
377
  /**
379
378
  * Wraps an external native texture in a Babylon texture.
380
379
  * @param texture defines the external texture
380
+ * @param hasMipMaps defines whether the external texture has mip maps
381
+ * @param samplingMode defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
381
382
  * @returns the babylon internal texture
382
383
  */
383
- wrapNativeTexture(texture: any): InternalTexture;
384
+ wrapNativeTexture(texture: any, hasMipMaps?: boolean, samplingMode?: number): InternalTexture;
384
385
  /**
385
386
  * Wraps an external web gl texture in a Babylon texture.
386
387
  * @returns the babylon internal texture
@@ -115,10 +115,8 @@ class CommandBufferEncoder {
115
115
  }
116
116
  /** @internal */
117
117
  export class NativeEngine extends Engine {
118
- getHardwareScalingLevel() {
119
- return this._engine.getHardwareScalingLevel();
120
- }
121
118
  setHardwareScalingLevel(level) {
119
+ super.setHardwareScalingLevel(level);
122
120
  this._engine.setHardwareScalingLevel(level);
123
121
  }
124
122
  constructor(options = {}) {
@@ -267,7 +265,9 @@ export class NativeEngine extends Engine {
267
265
  // Currently we do not fully configure the ThinEngine on construction of NativeEngine.
268
266
  // Setup resolution scaling based on display settings.
269
267
  const devicePixelRatio = window ? window.devicePixelRatio || 1.0 : 1.0;
270
- this._hardwareScalingLevel = options.adaptToDeviceRatio ? devicePixelRatio : 1.0;
268
+ this._hardwareScalingLevel = options.adaptToDeviceRatio ? 1.0 / devicePixelRatio : 1.0;
269
+ this._engine.setHardwareScalingLevel(this._hardwareScalingLevel);
270
+ this._lastDevicePixelRatio = devicePixelRatio;
271
271
  this.resize();
272
272
  const currentDepthFunction = this.getDepthFunction();
273
273
  if (currentDepthFunction) {
@@ -1393,13 +1393,17 @@ export class NativeEngine extends Engine {
1393
1393
  /**
1394
1394
  * Wraps an external native texture in a Babylon texture.
1395
1395
  * @param texture defines the external texture
1396
+ * @param hasMipMaps defines whether the external texture has mip maps
1397
+ * @param samplingMode defines the sampling mode for the external texture (default: 3)
1396
1398
  * @returns the babylon internal texture
1397
1399
  */
1398
- wrapNativeTexture(texture) {
1400
+ wrapNativeTexture(texture, hasMipMaps = false, samplingMode = 3) {
1399
1401
  const hardwareTexture = new NativeHardwareTexture(texture, this._engine);
1400
1402
  const internalTexture = new InternalTexture(this, InternalTextureSource.Unknown, true);
1401
1403
  internalTexture._hardwareTexture = hardwareTexture;
1402
1404
  internalTexture.isReady = true;
1405
+ internalTexture.useMipMaps = hasMipMaps;
1406
+ this.updateTextureSamplingMode(samplingMode, internalTexture);
1403
1407
  return internalTexture;
1404
1408
  }
1405
1409
  /**