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.
@@ -2520,10 +2520,6 @@ declare namespace ADDONS {
2520
2520
  export class AtmospherePBRMaterialPlugin extends BABYLON.MaterialPluginBase {
2521
2521
  private readonly _atmosphere;
2522
2522
  private readonly _isAerialPerspectiveEnabled;
2523
- private static readonly _ShaderIncludesRetryDelayMs;
2524
- private _shaderIncludesLoaded;
2525
- private _shaderIncludesLoadPromise;
2526
- private _shaderIncludesNextRetryTime;
2527
2523
  /**
2528
2524
  * Constructs the {@link AtmospherePBRMaterialPlugin}.
2529
2525
  * @param material - The material to apply the plugin to.
@@ -2556,11 +2552,32 @@ declare namespace ADDONS {
2556
2552
  */
2557
2553
  isReadyForSubMesh(): boolean;
2558
2554
  /**
2559
- * Lazily loads (and thereby registers into the ShaderStore) the shader includes referenced by
2560
- * this plugin's injected custom code. Loading the correct variant for the host material's shader
2561
- * language keeps this module free of top-level shader side effects so it can be tree-shaken.
2555
+ * Ensures the shader includes for this material's shader language are registered, kicking off a lazy
2556
+ * load if needed. Registration from a previously created material (or an explicit preload) is detected
2557
+ * synchronously via the ShaderStore, so only the very first atmosphere material can incur a load delay.
2558
+ * @returns True when the includes are registered and the plugin can proceed.
2562
2559
  */
2563
- private _loadShaderIncludesAsync;
2560
+ private _ensureShaderIncludesLoaded;
2561
+ /**
2562
+ * Fire-and-forget load of the shader includes used from isReadyForSubMesh. Backs off after a failure and
2563
+ * logs so a missing registration doesn't silently stall rendering forever; a retry still recovers from
2564
+ * transient failures such as a dropped network request.
2565
+ * @param shaderLanguage - The shader language whose includes to load.
2566
+ * @param state - The shared load state for that language.
2567
+ */
2568
+ private _tryLoadShaderIncludesAsync;
2569
+ /**
2570
+ * Preloads (and registers into the ShaderStore) the atmosphere shader includes for the given shader
2571
+ * language, ahead of creating any atmosphere-enabled material. Await this before creating meshes when
2572
+ * they must render in their creation frame with zero delay. Safe to call multiple times; concurrent
2573
+ * calls coalesce onto a single load.
2574
+ *
2575
+ * As an alternative, `Material.forceCompilationAsync(mesh)` (or `Scene.whenReadyAsync`) also awaits the
2576
+ * includes, because readiness is gated through `isReadyForSubMesh`.
2577
+ * @param shaderLanguage - The shader language to preload includes for (defaults to GLSL). Pass `ShaderLanguage.WGSL` for WebGPU.
2578
+ * @returns A promise that resolves once the includes are registered.
2579
+ */
2580
+ static PreloadShaderIncludesAsync(shaderLanguage?: BABYLON.ShaderLanguage): Promise<void>;
2564
2581
  /**
2565
2582
  * @override
2566
2583
  */
@@ -2991,6 +3008,22 @@ declare namespace ADDONS {
2991
3008
  * @param options - The options used to create the atmosphere.
2992
3009
  */
2993
3010
  constructor(name: string, scene: BABYLON.Scene, lights: BABYLON.DirectionalLight[], options?: IAtmosphereOptions);
3011
+ /**
3012
+ * Fire-and-forget wrapper around {@link preloadMaterialPluginShaderIncludesAsync} used during construction.
3013
+ * Swallows failures so a rejected preload does not surface as an unhandled promise rejection; the plugin's
3014
+ * `isReadyForSubMesh` already retries and logs on failure.
3015
+ * @returns A promise that always resolves.
3016
+ */
3017
+ private _eagerlyPreloadMaterialPluginShaderIncludesAsync;
3018
+ /**
3019
+ * Preloads the shader includes used by the atmosphere PBR material plugin so that atmosphere-enabled
3020
+ * materials can render in their creation frame with no delay. The plugin registers these includes lazily
3021
+ * (to keep the module tree-shakeable), so without a preload the very first atmosphere material may skip a
3022
+ * frame while they load. Await this before creating meshes that must render immediately. Safe to call
3023
+ * multiple times.
3024
+ * @returns A promise that resolves once the includes are registered.
3025
+ */
3026
+ preloadMaterialPluginShaderIncludesAsync(): Promise<void>;
2994
3027
  /**
2995
3028
  * @override
2996
3029
  */