@babylonjs/core 5.14.1 → 5.16.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 (118) hide show
  1. package/Audio/sound.js +2 -2
  2. package/Audio/sound.js.map +1 -1
  3. package/Cameras/Inputs/BaseCameraMouseWheelInput.d.ts +1 -1
  4. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +8 -2
  5. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  6. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.d.ts +0 -1
  7. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +7 -2
  8. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  9. package/Cameras/Inputs/followCameraMouseWheelInput.d.ts +0 -1
  10. package/Cameras/Inputs/followCameraMouseWheelInput.js +7 -2
  11. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  12. package/Cameras/arcRotateCamera.js +8 -2
  13. package/Cameras/arcRotateCamera.js.map +1 -1
  14. package/Cameras/camera.d.ts +15 -5
  15. package/Cameras/camera.js +81 -10
  16. package/Cameras/camera.js.map +1 -1
  17. package/Cameras/targetCamera.js +5 -0
  18. package/Cameras/targetCamera.js.map +1 -1
  19. package/DeviceInput/InputDevices/deviceSourceManager.js +4 -0
  20. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  21. package/DeviceInput/InputDevices/internalDeviceSourceManager.d.ts +2 -1
  22. package/DeviceInput/InputDevices/internalDeviceSourceManager.js.map +1 -1
  23. package/DeviceInput/InputDevices/webDeviceInputSystem.js +2 -4
  24. package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -1
  25. package/Engines/Extensions/engine.cubeTexture.js +3 -3
  26. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  27. package/Engines/Extensions/engine.rawTexture.js +3 -3
  28. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  29. package/Engines/Native/nativeInterfaces.d.ts +1 -0
  30. package/Engines/Native/nativeInterfaces.js.map +1 -1
  31. package/Engines/WebGPU/Extensions/engine.rawTexture.js +3 -3
  32. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  33. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +6 -6
  34. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  35. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +4 -4
  36. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  37. package/Engines/nativeEngine.d.ts +1 -0
  38. package/Engines/nativeEngine.js +18 -4
  39. package/Engines/nativeEngine.js.map +1 -1
  40. package/Engines/thinEngine.d.ts +17 -3
  41. package/Engines/thinEngine.js +43 -11
  42. package/Engines/thinEngine.js.map +1 -1
  43. package/Engines/webgpuEngine.js +1 -1
  44. package/Engines/webgpuEngine.js.map +1 -1
  45. package/Inputs/scene.inputManager.js +5 -1
  46. package/Inputs/scene.inputManager.js.map +1 -1
  47. package/Legacy/legacy.js +10 -6
  48. package/Legacy/legacy.js.map +1 -1
  49. package/Loading/sceneLoader.js +9 -9
  50. package/Loading/sceneLoader.js.map +1 -1
  51. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +2 -1
  52. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  53. package/Materials/Node/Blocks/elbowBlock.js +5 -3
  54. package/Materials/Node/Blocks/elbowBlock.js.map +1 -1
  55. package/Materials/PBR/pbrBaseMaterial.js +4 -4
  56. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  57. package/Materials/PBR/pbrClearCoatConfiguration.d.ts +1 -1
  58. package/Materials/PBR/pbrClearCoatConfiguration.js +1 -1
  59. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  60. package/Materials/PBR/pbrIridescenceConfiguration.d.ts +1 -1
  61. package/Materials/PBR/pbrIridescenceConfiguration.js +1 -1
  62. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  63. package/Materials/PBR/pbrSheenConfiguration.d.ts +1 -1
  64. package/Materials/PBR/pbrSheenConfiguration.js +1 -1
  65. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  66. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +1 -1
  67. package/Materials/PBR/pbrSubSurfaceConfiguration.js +1 -1
  68. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  69. package/Materials/Textures/Loaders/basisTextureLoader.js +6 -1
  70. package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
  71. package/Materials/Textures/baseTexture.d.ts +1 -1
  72. package/Materials/Textures/baseTexture.js +2 -2
  73. package/Materials/Textures/baseTexture.js.map +1 -1
  74. package/Materials/Textures/videoTexture.js +4 -1
  75. package/Materials/Textures/videoTexture.js.map +1 -1
  76. package/Materials/imageProcessingConfiguration.js.map +1 -1
  77. package/Materials/materialHelper.d.ts +1 -1
  78. package/Materials/materialHelper.js +6 -6
  79. package/Materials/materialHelper.js.map +1 -1
  80. package/Maths/math.color.d.ts +15 -3
  81. package/Maths/math.color.js +26 -3
  82. package/Maths/math.color.js.map +1 -1
  83. package/Meshes/Builders/discBuilder.d.ts +26 -0
  84. package/Meshes/Builders/discBuilder.js +1 -1
  85. package/Meshes/Builders/discBuilder.js.map +1 -1
  86. package/Meshes/geometry.js +2 -2
  87. package/Meshes/geometry.js.map +1 -1
  88. package/Meshes/mesh.d.ts +1 -1
  89. package/Meshes/mesh.js +8 -7
  90. package/Meshes/mesh.js.map +1 -1
  91. package/Meshes/transformNode.d.ts +3 -3
  92. package/Meshes/transformNode.js +2 -2
  93. package/Meshes/transformNode.js.map +1 -1
  94. package/Misc/basis.d.ts +8 -0
  95. package/Misc/basis.js +74 -32
  96. package/Misc/basis.js.map +1 -1
  97. package/Misc/screenshotTools.js +3 -0
  98. package/Misc/screenshotTools.js.map +1 -1
  99. package/Particles/particleHelper.js +4 -4
  100. package/Particles/particleHelper.js.map +1 -1
  101. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +0 -2
  102. package/PostProcesses/volumetricLightScatteringPostProcess.js +22 -15
  103. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  104. package/Rendering/geometryBufferRenderer.js +3 -2
  105. package/Rendering/geometryBufferRenderer.js.map +1 -1
  106. package/Shaders/ShadersInclude/helperFunctions.js +1 -1
  107. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  108. package/Shaders/geometry.fragment.js +1 -1
  109. package/Shaders/geometry.fragment.js.map +1 -1
  110. package/XR/webXREnterExitUI.js +1 -1
  111. package/XR/webXREnterExitUI.js.map +1 -1
  112. package/assetContainer.d.ts +1 -1
  113. package/assetContainer.js +11 -11
  114. package/assetContainer.js.map +1 -1
  115. package/package.json +1 -1
  116. package/scene.d.ts +6 -6
  117. package/scene.js +8 -6
  118. package/scene.js.map +1 -1
@@ -42,8 +42,8 @@ declare type RenderTargetWrapper = import("./renderTargetWrapper").RenderTargetW
42
42
  * @hidden
43
43
  */
44
44
  export interface ISceneLike {
45
- _addPendingData(data: any): void;
46
- _removePendingData(data: any): void;
45
+ addPendingData(data: any): void;
46
+ removePendingData(data: any): void;
47
47
  offlineProvider: IOfflineProvider;
48
48
  }
49
49
  /**
@@ -126,6 +126,11 @@ export interface EngineOptions extends WebGLContextAttributes {
126
126
  * This will not influence NativeEngine and WebGPUEngine which set the behavior to true during construction.
127
127
  */
128
128
  forceSRGBBufferSupportState?: boolean;
129
+ /**
130
+ * True if the more expensive but exact conversions should be used for transforming colors to and from linear space within shaders.
131
+ * Otherwise, the default is to use a cheaper approximation.
132
+ */
133
+ useExactSrgbConversions?: boolean;
129
134
  }
130
135
  /**
131
136
  * The base engine class (root of all engines)
@@ -388,8 +393,12 @@ export declare class ThinEngine {
388
393
  private _maxSimultaneousTextures;
389
394
  private _maxMSAASamplesOverride;
390
395
  private _activeRequests;
396
+ /**
397
+ * If set to true zooming in and out in the browser will rescale the hardware-scaling correctly.
398
+ */
399
+ adaptToDeviceRatio: boolean;
391
400
  /** @hidden */
392
- private _adaptToDeviceRatio;
401
+ private _lastDevicePixelRatio;
393
402
  /** @hidden */
394
403
  _transformTextureUrl: Nullable<(url: string) => string>;
395
404
  /**
@@ -459,6 +468,11 @@ export declare class ThinEngine {
459
468
  */
460
469
  get snapshotRenderingMode(): number;
461
470
  set snapshotRenderingMode(mode: number);
471
+ protected _useExactSrgbConversions: boolean;
472
+ /**
473
+ * Gets a boolean indicating if the exact sRGB conversions or faster approximations are used for converting to and from linear space.
474
+ */
475
+ get useExactSrgbConversions(): boolean;
462
476
  /**
463
477
  * Creates a new snapshot at the next frame using the current snapshotRenderingMode
464
478
  */
@@ -158,8 +158,12 @@ var ThinEngine = /** @class */ (function () {
158
158
  this._maxSimultaneousTextures = 0;
159
159
  this._maxMSAASamplesOverride = null;
160
160
  this._activeRequests = new Array();
161
+ /**
162
+ * If set to true zooming in and out in the browser will rescale the hardware-scaling correctly.
163
+ */
164
+ this.adaptToDeviceRatio = false;
161
165
  /** @hidden */
162
- this._adaptToDeviceRatio = false;
166
+ this._lastDevicePixelRatio = 1.0;
163
167
  /** @hidden */
164
168
  this._transformTextureUrl = null;
165
169
  /**
@@ -179,6 +183,7 @@ var ThinEngine = /** @class */ (function () {
179
183
  /** @hidden */
180
184
  this._isWebGPU = false;
181
185
  this._snapshotRenderingMode = 0;
186
+ this._useExactSrgbConversions = false;
182
187
  this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };
183
188
  this._unpackFlipYCached = null;
184
189
  /**
@@ -192,7 +197,7 @@ var ThinEngine = /** @class */ (function () {
192
197
  options = options || {};
193
198
  this._creationOptions = options;
194
199
  // Save this off for use in resize().
195
- this._adaptToDeviceRatio = adaptToDeviceRatio !== null && adaptToDeviceRatio !== void 0 ? adaptToDeviceRatio : false;
200
+ this.adaptToDeviceRatio = adaptToDeviceRatio !== null && adaptToDeviceRatio !== void 0 ? adaptToDeviceRatio : false;
196
201
  this._stencilStateComposer.stencilGlobal = this._stencilState;
197
202
  PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);
198
203
  if (!canvasOrContext) {
@@ -235,6 +240,9 @@ var ThinEngine = /** @class */ (function () {
235
240
  if (options.xrCompatible === undefined) {
236
241
  options.xrCompatible = true;
237
242
  }
243
+ if (options.useExactSrgbConversions !== undefined) {
244
+ this._useExactSrgbConversions = options.useExactSrgbConversions;
245
+ }
238
246
  this._doNotHandleContextLost = options.doNotHandleContextLost ? true : false;
239
247
  // Exceptions
240
248
  if (navigator && navigator.userAgent) {
@@ -368,6 +376,7 @@ var ThinEngine = /** @class */ (function () {
368
376
  var devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;
369
377
  var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;
370
378
  this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;
379
+ this._lastDevicePixelRatio = devicePixelRatio;
371
380
  this.resize();
372
381
  this._isStencilEnable = options.stencil ? true : false;
373
382
  this._initGLContext();
@@ -400,7 +409,7 @@ var ThinEngine = /** @class */ (function () {
400
409
  */
401
410
  // Not mixed with Version for tooling purpose.
402
411
  get: function () {
403
- return "babylonjs@5.14.1";
412
+ return "babylonjs@5.16.0";
404
413
  },
405
414
  enumerable: false,
406
415
  configurable: true
@@ -410,7 +419,7 @@ var ThinEngine = /** @class */ (function () {
410
419
  * Returns the current version of the framework
411
420
  */
412
421
  get: function () {
413
- return "5.14.1";
422
+ return "5.16.0";
414
423
  },
415
424
  enumerable: false,
416
425
  configurable: true
@@ -697,6 +706,16 @@ var ThinEngine = /** @class */ (function () {
697
706
  enumerable: false,
698
707
  configurable: true
699
708
  });
709
+ Object.defineProperty(ThinEngine.prototype, "useExactSrgbConversions", {
710
+ /**
711
+ * Gets a boolean indicating if the exact sRGB conversions or faster approximations are used for converting to and from linear space.
712
+ */
713
+ get: function () {
714
+ return this._useExactSrgbConversions;
715
+ },
716
+ enumerable: false,
717
+ configurable: true
718
+ });
700
719
  /**
701
720
  * Creates a new snapshot at the next frame using the current snapshotRenderingMode
702
721
  */
@@ -1400,10 +1419,11 @@ var ThinEngine = /** @class */ (function () {
1400
1419
  var width;
1401
1420
  var height;
1402
1421
  // Requery hardware scaling level to handle zoomed-in resizing.
1403
- if (this._adaptToDeviceRatio) {
1422
+ if (this.adaptToDeviceRatio) {
1404
1423
  var devicePixelRatio_1 = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;
1405
- var limitDeviceRatio = this._creationOptions.limitDeviceRatio || devicePixelRatio_1;
1406
- this._hardwareScalingLevel = this._adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio_1) : 1.0;
1424
+ var changeRatio = this._lastDevicePixelRatio / devicePixelRatio_1;
1425
+ this._lastDevicePixelRatio = devicePixelRatio_1;
1426
+ this._hardwareScalingLevel *= changeRatio;
1407
1427
  }
1408
1428
  if (IsWindowObjectExist()) {
1409
1429
  width = this._renderingCanvas ? this._renderingCanvas.clientWidth || this._renderingCanvas.width : window.innerWidth;
@@ -2234,6 +2254,12 @@ var ThinEngine = /** @class */ (function () {
2234
2254
  else {
2235
2255
  delete defines["USE_REVERSE_DEPTHBUFFER"];
2236
2256
  }
2257
+ if (this.useExactSrgbConversions) {
2258
+ defines["USE_EXACT_SRGB_CONVERSIONS"] = "";
2259
+ }
2260
+ else {
2261
+ delete defines["USE_EXACT_SRGB_CONVERSIONS"];
2262
+ }
2237
2263
  return;
2238
2264
  }
2239
2265
  else {
@@ -2247,6 +2273,12 @@ var ThinEngine = /** @class */ (function () {
2247
2273
  }
2248
2274
  s += "#define USE_REVERSE_DEPTHBUFFER";
2249
2275
  }
2276
+ if (this.useExactSrgbConversions) {
2277
+ if (s) {
2278
+ s += "\n";
2279
+ }
2280
+ s += "#define USE_EXACT_SRGB_CONVERSIONS";
2281
+ }
2250
2282
  return s;
2251
2283
  }
2252
2284
  };
@@ -3190,7 +3222,7 @@ var ThinEngine = /** @class */ (function () {
3190
3222
  }
3191
3223
  }
3192
3224
  if (scene) {
3193
- scene._addPendingData(texture);
3225
+ scene.addPendingData(texture);
3194
3226
  }
3195
3227
  texture.url = url;
3196
3228
  texture.generateMipMaps = !noMipmap;
@@ -3210,7 +3242,7 @@ var ThinEngine = /** @class */ (function () {
3210
3242
  }
3211
3243
  var onInternalError = function (message, exception) {
3212
3244
  if (scene) {
3213
- scene._removePendingData(texture);
3245
+ scene.removePendingData(texture);
3214
3246
  }
3215
3247
  if (url === originalUrl) {
3216
3248
  if (onLoadObserver) {
@@ -3767,7 +3799,7 @@ var ThinEngine = /** @class */ (function () {
3767
3799
  this._bindTextureDirectly(gl.TEXTURE_2D, null);
3768
3800
  // this.resetTextureCache();
3769
3801
  if (scene) {
3770
- scene._removePendingData(texture);
3802
+ scene.removePendingData(texture);
3771
3803
  }
3772
3804
  texture.onLoadedObservable.notifyObservers(texture);
3773
3805
  texture.onLoadedObservable.clear();
@@ -3785,7 +3817,7 @@ var ThinEngine = /** @class */ (function () {
3785
3817
  if (!texture._hardwareTexture) {
3786
3818
  // this.resetTextureCache();
3787
3819
  if (scene) {
3788
- scene._removePendingData(texture);
3820
+ scene.removePendingData(texture);
3789
3821
  }
3790
3822
  return;
3791
3823
  }