babylonjs-toolkit 9.34.0 → 9.34.10

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.
package/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare namespace TOOLKIT {
7
7
  * @class SceneManager - All rights reserved (c) 2024 Mackey Kinard
8
8
  */
9
9
  class SceneManager {
10
- /** Gets the toolkit framework version string (9.32.0 - R1) */
10
+ /** Gets the toolkit framework version string (9.34.10 - R1) */
11
11
  static get Version(): string;
12
12
  /** Gets the toolkit framework copyright notice */
13
13
  static get Copyright(): string;
@@ -200,6 +200,8 @@ declare namespace TOOLKIT {
200
200
  /** Hidden layer mask value (Unity Layer 28 - Value: 268435456) */
201
201
  static readonly HiddenLayerMask: number;
202
202
  private static _HideLoadingScreen;
203
+ /** The fade a HideLoadingScreen call asked for while its scene is revealed first. */
204
+ private static _FadeLoadingScreen;
203
205
  static CVTOOLS_NAME: string;
204
206
  static CVTOOLS_MESH: string;
205
207
  static CVTOOLS_HAND: string;
@@ -283,15 +285,19 @@ declare namespace TOOLKIT {
283
285
  */
284
286
  static LoadRuntimeAssets(assetsManager: BABYLON.AssetsManager, requiredFilenames: string[], readyHandler: () => void, maxTimeout?: number, debugMode?: boolean): Promise<void>;
285
287
  /**
286
- * Shows the default loading screen panel
288
+ * Shows the default loading screen panel, with the splash stages on it (LoadingScreenStages). It counts as the page's splash,
289
+ * so the reveal waits for it. On a page that painted its own cover (engine.html) the stages go on that cover instead.
287
290
  * @param engine The engine instance.
288
291
  * @param hideLoadingUIWithEngine hide the loading screen with engine.hideLoadingUI. When set to false, you must manually hide the loading screen using TOOLKIT.SceneManager.HideLoadingScreen when the scene is ready. Default true.
289
- * @param defaultLoadingUIMarginTop The top margin of the loading text. Default 150px.
292
+ * @param defaultLoadingUIMarginTop The top margin of the loading stages (status line and bar). Default 150px.
290
293
  */
291
294
  static ShowLoadingScreen(engine: BABYLON.Engine | BABYLON.WebGPUEngine | BABYLON.AbstractEngine, hideLoadingUIWithEngine?: boolean, defaultLoadingUIMarginTop?: string): void;
292
295
  /**
293
- * Hides the default loading screen panel
296
+ * Hides the default loading screen panel. While the stages are on it and the engine's last scene is not revealed yet, the screen
297
+ * ends like every splash: this returns at once, PREWARM runs behind the screen (HideSplashScreen), it shows Ready, the
298
+ * reveal is recorded, and then it fades.
294
299
  * @param engine The engine instance.
300
+ * @param fade Fade the screen out. Default true.
295
301
  */
296
302
  static HideLoadingScreen(engine: BABYLON.Engine | BABYLON.WebGPUEngine | BABYLON.AbstractEngine, fade?: boolean): void;
297
303
  /** Force the engine loading screen to be hidden (Triple Check Loading Screen Hidden) */
@@ -371,7 +377,8 @@ declare namespace TOOLKIT {
371
377
  /**
372
378
  * True while the page's splash screen is up: shown and not yet fading out (both kinds fade by setting an inline opacity of 0).
373
379
  * The React splash is `#xbabylonjsSplashScreen` (its inner `#xbabylonjsLoadingDiv` never fades itself, so only the outer one
374
- * counts); the exported engine.html loader is `#xbabylonjsLoadingDiv` alone.
380
+ * counts); the exported engine.html loader is `#xbabylonjsLoadingDiv` alone. Without either, the built-in loading screen counts
381
+ * (ShowLoadingScreen, LoadingScreenStages).
375
382
  * @returns False when there is no document or no splash element.
376
383
  */
377
384
  static IsSplashScreenShowing(): boolean;
@@ -2728,7 +2735,7 @@ declare namespace TOOLKIT {
2728
2735
  * @param projectScriptBundleUrl specified project script bundle. Default (default.playground.js).
2729
2736
  * @param showDefaultLoadingScreen show the default loading screen. Default false.
2730
2737
  * @param hideLoadingUIWithEngine hide the loading screen with engine.hideLoadingUI. When set to false, you must manually hide the loading screen using TOOLKIT.SceneManager.HideLoadingScreen when the scene is ready. Default true.
2731
- * @param defaultLoadingUIMarginTop The top margin of the loading text. Default 150px.
2738
+ * @param defaultLoadingUIMarginTop The top margin of the loading stages (status line and bar). Default 150px.
2732
2739
  * @param trackDevicePixelRatio re-apply the hardware scaling level (1 / window.devicePixelRatio) and resize the engine whenever the device pixel ratio changes (a window moved between displays, browser zoom). Default true when hardwareScalingLevel is not set, false when it is.
2733
2740
  */
2734
2741
  interface IRuntimeOptions {
@@ -7072,6 +7079,138 @@ declare namespace TOOLKIT {
7072
7079
  private static ForgetScene;
7073
7080
  }
7074
7081
  }
7082
+ declare namespace TOOLKIT {
7083
+ /** The stage elements on one cover (Babylon clones its loading screen div per canvas or engine view). */
7084
+ interface ILoadingScreenStageView {
7085
+ /** The loading screen div they sit on. */
7086
+ screen: HTMLElement;
7087
+ /** The status line and bar, under the spinner. */
7088
+ stage: HTMLElement;
7089
+ /** The status line. */
7090
+ status: HTMLElement;
7091
+ /** The detail line, bottom right. */
7092
+ details: HTMLElement;
7093
+ /** The bar's fill. */
7094
+ fill: HTMLElement;
7095
+ /** The fill's sliding animation until the first real progress, null when it does not slide. */
7096
+ slide: ReturnType<HTMLElement["animate"]>;
7097
+ }
7098
+ /**
7099
+ * The toolkit's default splash: the status line, bar and detail line, fed by SceneManager.OnLoaderStatusObservable, on a cover of
7100
+ * logo and spinner that is up before the toolkit loads. Two covers carry it. The built-in loading screen
7101
+ * (SceneManager.ShowLoadingScreen, the Playground's showDefaultLoadingScreen) is Babylon's default screen: it counts as the page's
7102
+ * splash (SceneManager.IsSplashScreenShowing), so the reveal waits for it, and SceneManager.HideLoadingScreen ends it through the same
7103
+ * last stages as every splash: PREWARM, Ready, the reveal, the fade. engine.html paints its own cover inline, so the player sees it
7104
+ * while the scripts download, and turns the same showDefaultLoadingScreen flag on: ShowLoadingScreen finds that cover and the stages
7105
+ * take it over. React splash screens and a custom BABYLON.ILoadingScreen are left alone.
7106
+ */
7107
+ class LoadingScreenStages {
7108
+ /** The status line until the first report. */
7109
+ static START_TEXT: string;
7110
+ /** The bar's color. */
7111
+ static BAR_COLOR: string;
7112
+ /** Duration of one slide of the bar before its first real progress, in milliseconds. */
7113
+ static SLIDE_DURATION_MS: number;
7114
+ /** One element per loading screen div while the screen is up. */
7115
+ private static Views;
7116
+ /** The OnLoaderStatusObservable observer while the screen is up. */
7117
+ private static Observer;
7118
+ /** SceneManager.HostDefersSceneStatus before the screen took the status line. */
7119
+ private static PreviousHostDefers;
7120
+ /** The loading state of the bar's last value. */
7121
+ private static BarState;
7122
+ /** The bar's value (0-1), null before the first real progress. */
7123
+ private static BarProgress;
7124
+ /**
7125
+ * Puts the stages on a displayed loading screen and follows the loader status until the screen fades.
7126
+ * @param loadingScreen - The engine's loading screen.
7127
+ * @param marginTop - The stage's distance below the middle of the screen.
7128
+ */
7129
+ static Attach(loadingScreen: any, marginTop: string): void;
7130
+ /**
7131
+ * The cover a page painted before the toolkit loaded (engine.html's #xbabylonjsLoadingDiv). A React splash has its own div of that
7132
+ * name inside #xbabylonjsSplashScreen, and that one is not a cover: React splash screens render their own stages.
7133
+ * @returns The cover, or null when the page has none.
7134
+ */
7135
+ static FindPageCover(): HTMLElement;
7136
+ /**
7137
+ * Puts the stages on a cover the page painted itself (engine.html), which the player has been looking at since the page opened.
7138
+ * @param screen - The cover.
7139
+ * @param marginTop - The stage's distance below the middle of the screen.
7140
+ */
7141
+ static AttachScreen(screen: HTMLElement, marginTop: string): void;
7142
+ /**
7143
+ * Starts the stages on the given covers.
7144
+ * @param covers - One div per canvas or engine view.
7145
+ * @param marginTop - The stage's distance below the middle of the screen.
7146
+ */
7147
+ private static Begin;
7148
+ /**
7149
+ * True while the screen is up and not fading (its hide sets an inline opacity of 0).
7150
+ * @returns False when no screen was attached or it has gone.
7151
+ */
7152
+ static IsShowing(): boolean;
7153
+ /**
7154
+ * The scene that still has to be revealed before the screen can hide.
7155
+ * @param engine - The engine hiding its loading screen.
7156
+ * @returns The engine's last scene, or null when the screen can hide now.
7157
+ */
7158
+ static SceneToReveal(engine: BABYLON.AbstractEngine): BABYLON.Scene;
7159
+ /**
7160
+ * Fades out a cover the page painted itself (AttachScreen) and removes it once it has faded.
7161
+ * @param screen - The cover.
7162
+ */
7163
+ static FadeScreen(screen: HTMLElement): void;
7164
+ /**
7165
+ * The loading state of the bar's last value: from 1 on the toolkit owns the bar, so a page stops posting its own download percent.
7166
+ * @returns The state, -1 before the toolkit's first report.
7167
+ */
7168
+ static GetBarState(): number;
7169
+ /**
7170
+ * Shows one status update on the stages: null fields stay as they are, and the bar only moves forward within one loading state
7171
+ * (the download, state -1, follows the file progress as is). This is what the loader status does, and what a page posts for work
7172
+ * of its own before the scene loads (engine.html: the content download).
7173
+ * @param status - The status line.
7174
+ * @param details - The detail line.
7175
+ * @param progress - The bar, 0-1.
7176
+ * @param state - The loading state.
7177
+ */
7178
+ static ShowStatus(status: string, details: string, progress: number, state: number): void;
7179
+ /** Stops following the loader status. The stage stays on the screen, so it fades with it. */
7180
+ static Detach(removeStages?: boolean): void;
7181
+ /**
7182
+ * Builds the stage elements on one cover.
7183
+ * @param screen - The cover.
7184
+ * @param marginTop - The stage's distance below the middle of the screen.
7185
+ * @returns The view.
7186
+ */
7187
+ private static CreateView;
7188
+ /**
7189
+ * Slides the bar's fill until the first real progress (a full, faint bar for a player who asked for less motion).
7190
+ * @param fill - The fill.
7191
+ * @returns The animation, or null when it does not slide.
7192
+ */
7193
+ private static StartSlide;
7194
+ /**
7195
+ * Follows the loader status until the screen has faded.
7196
+ * @param update - The update.
7197
+ */
7198
+ private static OnLoaderStatus;
7199
+ /**
7200
+ * The bar's value after an update.
7201
+ * @param progress - The update's progress.
7202
+ * @param state - The update's loading state.
7203
+ * @returns The value, or null when the update has no progress.
7204
+ */
7205
+ private static NextBarProgress;
7206
+ /**
7207
+ * Turns an all-capitals line into sentence case (mixed-case text is shown as it is).
7208
+ * @param text - The line.
7209
+ * @returns The text to show.
7210
+ */
7211
+ private static ToSentenceCase;
7212
+ }
7213
+ }
7075
7214
  declare namespace TOOLKIT {
7076
7215
  /**
7077
7216
  * Keeps every material's fragment shader inside the device's texture and sampler limits, on WebGPU and WebGL2, for every
@@ -12691,7 +12830,8 @@ declare namespace TOOLKIT {
12691
12830
  * 80-99 %, Ready 100 % (LOADING_SHARE, SHADERS_SHARE) - that only moves forward, glides toward the real progress and creeps slowly
12692
12831
  * while work is pending, so it never sits still or jumps. While SceneManager.PrecompileShaders is false Loading Scene is the only
12693
12832
  * headline before Ready, so its band is the whole bar and the loads' own stages fill it (LOADED_SHARE_WITHOUT_PRECOMPILE).
12694
- * Both page splash screens show it: engine.html and the React splash read SceneManager.OnLoaderStatusObservable.
12833
+ * Every splash screen shows it through SceneManager.OnLoaderStatusObservable: the default splash (LoadingScreenStages, on engine.html
12834
+ * and the built-in loading screen) and the React splash.
12695
12835
  */
12696
12836
  class SplashNarrator {
12697
12837
  /** Every report the narrator receives, before it chooses what to show (tests and host pages that want the raw detail). */
@@ -55195,7 +55335,7 @@ declare namespace TOOLKIT {
55195
55335
  persisted: boolean | null;
55196
55336
  /** Total wire bytes of every group of every root, the app shell's group included (D23). */
55197
55337
  totalBytes: number;
55198
- /** Wire bytes of installed groups. */
55338
+ /** Wire bytes of every stored file of the active versions, each hash once (a partly stored group counts too). */
55199
55339
  installedBytes: number;
55200
55340
  /** True when every group of every root (the app shell's included, D23) is installed. */
55201
55341
  everythingInstalled: boolean;
@@ -55358,6 +55498,10 @@ declare namespace TOOLKIT {
55358
55498
  private static roots;
55359
55499
  /** Every hash in the files cache, as this page last saw it. */
55360
55500
  private static storedHashes;
55501
+ /** The pending totals update of files stored outside a finished group, or null. */
55502
+ private static totalsUpdateTimer;
55503
+ /** The shortest time between totals updates of files stored one by one, in milliseconds. */
55504
+ private static readonly TOTALS_UPDATE_INTERVAL_MS;
55361
55505
  /** Groups listing each hash in the active manifests (D32). */
55362
55506
  private static groupsByHash;
55363
55507
  /** Downloads waiting to start, in run order: player jobs first, then background jobs. */
@@ -56299,6 +56443,8 @@ declare namespace TOOLKIT {
56299
56443
  * @returns The state (base URL, shell flag and policy are set by loadRoot).
56300
56444
  */
56301
56445
  private static createRootState;
56446
+ /** Updates the totals soon, at most once per TOTALS_UPDATE_INTERVAL_MS: files a race stores arrive one by one, often while the game is busy. */
56447
+ private static scheduleTotalsUpdate;
56302
56448
  /** Recomputes the totals and update fields of the state from the roots. */
56303
56449
  private static updateTotalsState;
56304
56450
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-toolkit",
3
- "version": "9.34.0",
3
+ "version": "9.34.10",
4
4
  "description": "Babylon Toolkit Runtime Library (UMD)",
5
5
  "author": "MackeyK24 <mackeyk24@gmail.com>",
6
6
  "main": "lib/babylon.toolkit.js",