babylonjs-addons 9.15.0 → 9.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.
@@ -2730,10 +2730,6 @@ class AtmospherePBRMaterialDefines extends MaterialDefines {
2730
2730
  export class AtmospherePBRMaterialPlugin extends MaterialPluginBase {
2731
2731
  private readonly _atmosphere;
2732
2732
  private readonly _isAerialPerspectiveEnabled;
2733
- private static readonly _ShaderIncludesRetryDelayMs;
2734
- private _shaderIncludesLoaded;
2735
- private _shaderIncludesLoadPromise;
2736
- private _shaderIncludesNextRetryTime;
2737
2733
  /**
2738
2734
  * Constructs the {@link AtmospherePBRMaterialPlugin}.
2739
2735
  * @param material - The material to apply the plugin to.
@@ -2766,11 +2762,32 @@ export class AtmospherePBRMaterialPlugin extends MaterialPluginBase {
2766
2762
  */
2767
2763
  isReadyForSubMesh(): boolean;
2768
2764
  /**
2769
- * Lazily loads (and thereby registers into the ShaderStore) the shader includes referenced by
2770
- * this plugin's injected custom code. Loading the correct variant for the host material's shader
2771
- * language keeps this module free of top-level shader side effects so it can be tree-shaken.
2765
+ * Ensures the shader includes for this material's shader language are registered, kicking off a lazy
2766
+ * load if needed. Registration from a previously created material (or an explicit preload) is detected
2767
+ * synchronously via the ShaderStore, so only the very first atmosphere material can incur a load delay.
2768
+ * @returns True when the includes are registered and the plugin can proceed.
2772
2769
  */
2773
- private _loadShaderIncludesAsync;
2770
+ private _ensureShaderIncludesLoaded;
2771
+ /**
2772
+ * Fire-and-forget load of the shader includes used from isReadyForSubMesh. Backs off after a failure and
2773
+ * logs so a missing registration doesn't silently stall rendering forever; a retry still recovers from
2774
+ * transient failures such as a dropped network request.
2775
+ * @param shaderLanguage - The shader language whose includes to load.
2776
+ * @param state - The shared load state for that language.
2777
+ */
2778
+ private _tryLoadShaderIncludesAsync;
2779
+ /**
2780
+ * Preloads (and registers into the ShaderStore) the atmosphere shader includes for the given shader
2781
+ * language, ahead of creating any atmosphere-enabled material. Await this before creating meshes when
2782
+ * they must render in their creation frame with zero delay. Safe to call multiple times; concurrent
2783
+ * calls coalesce onto a single load.
2784
+ *
2785
+ * As an alternative, `Material.forceCompilationAsync(mesh)` (or `Scene.whenReadyAsync`) also awaits the
2786
+ * includes, because readiness is gated through `isReadyForSubMesh`.
2787
+ * @param shaderLanguage - The shader language to preload includes for (defaults to GLSL). Pass `ShaderLanguage.WGSL` for WebGPU.
2788
+ * @returns A promise that resolves once the includes are registered.
2789
+ */
2790
+ static PreloadShaderIncludesAsync(shaderLanguage?: ShaderLanguage): Promise<void>;
2774
2791
  /**
2775
2792
  * @override
2776
2793
  */
@@ -3223,6 +3240,22 @@ export class Atmosphere implements IDisposable {
3223
3240
  * @param options - The options used to create the atmosphere.
3224
3241
  */
3225
3242
  constructor(name: string, scene: Scene, lights: DirectionalLight[], options?: IAtmosphereOptions);
3243
+ /**
3244
+ * Fire-and-forget wrapper around {@link preloadMaterialPluginShaderIncludesAsync} used during construction.
3245
+ * Swallows failures so a rejected preload does not surface as an unhandled promise rejection; the plugin's
3246
+ * `isReadyForSubMesh` already retries and logs on failure.
3247
+ * @returns A promise that always resolves.
3248
+ */
3249
+ private _eagerlyPreloadMaterialPluginShaderIncludesAsync;
3250
+ /**
3251
+ * Preloads the shader includes used by the atmosphere PBR material plugin so that atmosphere-enabled
3252
+ * materials can render in their creation frame with no delay. The plugin registers these includes lazily
3253
+ * (to keep the module tree-shakeable), so without a preload the very first atmosphere material may skip a
3254
+ * frame while they load. Await this before creating meshes that must render immediately. Safe to call
3255
+ * multiple times.
3256
+ * @returns A promise that resolves once the includes are registered.
3257
+ */
3258
+ preloadMaterialPluginShaderIncludesAsync(): Promise<void>;
3226
3259
  /**
3227
3260
  * @override
3228
3261
  */
@@ -6061,10 +6094,6 @@ declare namespace ADDONS {
6061
6094
  export class AtmospherePBRMaterialPlugin extends BABYLON.MaterialPluginBase {
6062
6095
  private readonly _atmosphere;
6063
6096
  private readonly _isAerialPerspectiveEnabled;
6064
- private static readonly _ShaderIncludesRetryDelayMs;
6065
- private _shaderIncludesLoaded;
6066
- private _shaderIncludesLoadPromise;
6067
- private _shaderIncludesNextRetryTime;
6068
6097
  /**
6069
6098
  * Constructs the {@link AtmospherePBRMaterialPlugin}.
6070
6099
  * @param material - The material to apply the plugin to.
@@ -6097,11 +6126,32 @@ declare namespace ADDONS {
6097
6126
  */
6098
6127
  isReadyForSubMesh(): boolean;
6099
6128
  /**
6100
- * Lazily loads (and thereby registers into the ShaderStore) the shader includes referenced by
6101
- * this plugin's injected custom code. Loading the correct variant for the host material's shader
6102
- * language keeps this module free of top-level shader side effects so it can be tree-shaken.
6129
+ * Ensures the shader includes for this material's shader language are registered, kicking off a lazy
6130
+ * load if needed. Registration from a previously created material (or an explicit preload) is detected
6131
+ * synchronously via the ShaderStore, so only the very first atmosphere material can incur a load delay.
6132
+ * @returns True when the includes are registered and the plugin can proceed.
6103
6133
  */
6104
- private _loadShaderIncludesAsync;
6134
+ private _ensureShaderIncludesLoaded;
6135
+ /**
6136
+ * Fire-and-forget load of the shader includes used from isReadyForSubMesh. Backs off after a failure and
6137
+ * logs so a missing registration doesn't silently stall rendering forever; a retry still recovers from
6138
+ * transient failures such as a dropped network request.
6139
+ * @param shaderLanguage - The shader language whose includes to load.
6140
+ * @param state - The shared load state for that language.
6141
+ */
6142
+ private _tryLoadShaderIncludesAsync;
6143
+ /**
6144
+ * Preloads (and registers into the ShaderStore) the atmosphere shader includes for the given shader
6145
+ * language, ahead of creating any atmosphere-enabled material. Await this before creating meshes when
6146
+ * they must render in their creation frame with zero delay. Safe to call multiple times; concurrent
6147
+ * calls coalesce onto a single load.
6148
+ *
6149
+ * As an alternative, `Material.forceCompilationAsync(mesh)` (or `Scene.whenReadyAsync`) also awaits the
6150
+ * includes, because readiness is gated through `isReadyForSubMesh`.
6151
+ * @param shaderLanguage - The shader language to preload includes for (defaults to GLSL). Pass `ShaderLanguage.WGSL` for WebGPU.
6152
+ * @returns A promise that resolves once the includes are registered.
6153
+ */
6154
+ static PreloadShaderIncludesAsync(shaderLanguage?: BABYLON.ShaderLanguage): Promise<void>;
6105
6155
  /**
6106
6156
  * @override
6107
6157
  */
@@ -6532,6 +6582,22 @@ declare namespace ADDONS {
6532
6582
  * @param options - The options used to create the atmosphere.
6533
6583
  */
6534
6584
  constructor(name: string, scene: BABYLON.Scene, lights: BABYLON.DirectionalLight[], options?: IAtmosphereOptions);
6585
+ /**
6586
+ * Fire-and-forget wrapper around {@link preloadMaterialPluginShaderIncludesAsync} used during construction.
6587
+ * Swallows failures so a rejected preload does not surface as an unhandled promise rejection; the plugin's
6588
+ * `isReadyForSubMesh` already retries and logs on failure.
6589
+ * @returns A promise that always resolves.
6590
+ */
6591
+ private _eagerlyPreloadMaterialPluginShaderIncludesAsync;
6592
+ /**
6593
+ * Preloads the shader includes used by the atmosphere PBR material plugin so that atmosphere-enabled
6594
+ * materials can render in their creation frame with no delay. The plugin registers these includes lazily
6595
+ * (to keep the module tree-shakeable), so without a preload the very first atmosphere material may skip a
6596
+ * frame while they load. Await this before creating meshes that must render immediately. Safe to call
6597
+ * multiple times.
6598
+ * @returns A promise that resolves once the includes are registered.
6599
+ */
6600
+ preloadMaterialPluginShaderIncludesAsync(): Promise<void>;
6535
6601
  /**
6536
6602
  * @override
6537
6603
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-addons",
3
- "version": "9.15.0",
3
+ "version": "9.16.0",
4
4
  "main": "babylonjs.addons.min.js",
5
5
  "types": "babylonjs.addons.module.d.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "test:escheck": "es-check es6 ./babylonjs.addons.js"
17
17
  },
18
18
  "dependencies": {
19
- "babylonjs": "9.15.0"
19
+ "babylonjs": "9.16.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@dev/addons": "1.0.0",
@@ -3,8 +3,7 @@
3
3
 
4
4
  "compilerOptions": {
5
5
  "outDir": "./dist",
6
- "target": "ES5",
7
- "ignoreDeprecations": "6.0",
6
+ "target": "es2015",
8
7
  "rootDir": "../../../",
9
8
  "declaration": false,
10
9
  "importHelpers": true,