babylonjs-loaders 9.7.0 → 9.8.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.
@@ -702,6 +702,7 @@ import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
702
702
  import { Nullable } from "babylonjs/types";
703
703
  import { Color3 } from "babylonjs/Maths/math.color";
704
704
  import { IMaterialLoadingAdapter } from "babylonjs-loaders/glTF/2.0/materialLoadingAdapter";
705
+ import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
705
706
  /**
706
707
  * Material Loading Adapter for PBR materials that provides a unified OpenPBR-like interface.
707
708
  */
@@ -717,6 +718,11 @@ export class PBRMaterialLoadingAdapter implements IMaterialLoadingAdapter {
717
718
  * Gets the underlying material
718
719
  */
719
720
  get material(): PBRMaterial;
721
+ /**
722
+ * No-op: PBRMaterial has no deferred finalization.
723
+ * @param _loader Unused.
724
+ */
725
+ finalizeAsync(_loader: GLTFLoader): Promise<void>;
720
726
  /**
721
727
  * Whether the material should be treated as unlit
722
728
  */
@@ -1432,6 +1438,7 @@ import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
1432
1438
  import { Nullable } from "babylonjs/types";
1433
1439
  import { Color3 } from "babylonjs/Maths/math.color";
1434
1440
  import { IMaterialLoadingAdapter } from "babylonjs-loaders/glTF/2.0/materialLoadingAdapter";
1441
+ import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
1435
1442
  /**
1436
1443
  * Material Loading Adapter for OpenPBR materials that provides a unified OpenPBR-like interface.
1437
1444
  */
@@ -2132,10 +2139,9 @@ export class OpenPBRMaterialLoadingAdapter implements IMaterialLoadingAdapter {
2132
2139
  set geometryCoatNormalTextureScale(value: number);
2133
2140
  /**
2134
2141
  * Finalizes material properties after all loading is complete.
2135
- * @param signal An AbortSignal that fires when the loader is disposed. Intermediate
2136
- * textures are disposed and the method returns early when aborted.
2142
+ * @param loader The glTF loader; `loader._disposed` is polled between texture passes to bail early on dispose.
2137
2143
  */
2138
- finalizeAsync(signal: AbortSignal): Promise<void>;
2144
+ finalizeAsync(loader: GLTFLoader): Promise<void>;
2139
2145
  private copySurfaceToCoatAsync;
2140
2146
  }
2141
2147
 
@@ -2145,6 +2151,7 @@ import { Material } from "babylonjs/Materials/material";
2145
2151
  import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
2146
2152
  import { Nullable } from "babylonjs/types";
2147
2153
  import { Color3 } from "babylonjs/Maths/math.color";
2154
+ import { GLTFLoader } from "babylonjs-loaders/glTF/2.0/glTFLoader";
2148
2155
  /**
2149
2156
  * Interface for material loading adapters that provides a unified OpenPBR-like interface
2150
2157
  * for both OpenPBR and PBR materials, eliminating conditional branches in extensions.
@@ -2154,20 +2161,17 @@ export interface IMaterialLoadingAdapter {
2154
2161
  * Gets the underlying material
2155
2162
  */
2156
2163
  readonly material: Material;
2157
- /** @deprecated Use finalizeAsync instead. */
2158
- finalize?(): void;
2159
2164
  /**
2160
2165
  * Finalizes material properties after all loading is complete.
2161
- * May return a Promise for async work (e.g. GPU texture processing). Any returned
2162
- * Promise is tracked by the loader and awaited before the COMPLETE state is reached,
2163
- * so callers can rely on onCompleteObservable for fully processed materials.
2166
+ * May do async work (e.g. GPU texture processing); the returned Promise is tracked
2167
+ * by the loader and awaited before the COMPLETE state is reached, so callers can rely
2168
+ * on onCompleteObservable for fully processed materials.
2164
2169
  *
2165
- * The loader passes an AbortSignal that is aborted when the loader is disposed.
2166
- * Implementations should check `signal.aborted` after each await point and, if
2167
- * aborted, release any intermediate resources and return early.
2168
- * @param signal An AbortSignal that fires when the loader is disposed mid-flight.
2170
+ * Implementations should check `loader._disposed` between awaits to bail out early
2171
+ * when the loader is disposed mid-flight.
2172
+ * @param loader The glTF loader driving the finalize step.
2169
2173
  */
2170
- finalizeAsync?(signal: AbortSignal): Promise<void> | void;
2174
+ finalizeAsync(loader: GLTFLoader): Promise<void>;
2171
2175
  /**
2172
2176
  * Whether the material should be treated as unlit
2173
2177
  */
@@ -3132,8 +3136,6 @@ type PBRMaterialImplementation = {
3132
3136
  export class GLTFLoader implements IGLTFLoader {
3133
3137
  /** @internal */
3134
3138
  readonly _completePromises: Promise<unknown>[];
3135
- /** AbortController used to cancel in-flight finalizeAsync() calls when dispose() is called. */
3136
- private _finalizeController;
3137
3139
  /** @internal */
3138
3140
  _assetContainer: Nullable<AssetContainer>;
3139
3141
  /** Storage */
@@ -3146,7 +3148,8 @@ export class GLTFLoader implements IGLTFLoader {
3146
3148
  _skipStartAnimationStep: boolean;
3147
3149
  private readonly _parent;
3148
3150
  private readonly _extensions;
3149
- private _disposed;
3151
+ /** @internal */
3152
+ _disposed: boolean;
3150
3153
  private _rootUrl;
3151
3154
  private _fileName;
3152
3155
  private _uniqueRootUrl;
@@ -8619,6 +8622,11 @@ declare namespace BABYLON.GLTF2 {
8619
8622
  * Gets the underlying material
8620
8623
  */
8621
8624
  get material(): PBRMaterial;
8625
+ /**
8626
+ * No-op: PBRMaterial has no deferred finalization.
8627
+ * @param _loader Unused.
8628
+ */
8629
+ finalizeAsync(_loader: BABYLON.GLTF2.GLTFLoader): Promise<void>;
8622
8630
  /**
8623
8631
  * Whether the material should be treated as unlit
8624
8632
  */
@@ -10034,10 +10042,9 @@ declare namespace BABYLON.GLTF2 {
10034
10042
  set geometryCoatNormalTextureScale(value: number);
10035
10043
  /**
10036
10044
  * Finalizes material properties after all loading is complete.
10037
- * @param signal An AbortSignal that fires when the loader is disposed. Intermediate
10038
- * textures are disposed and the method returns early when aborted.
10045
+ * @param loader The glTF loader; `loader._disposed` is polled between texture passes to bail early on dispose.
10039
10046
  */
10040
- finalizeAsync(signal: AbortSignal): Promise<void>;
10047
+ finalizeAsync(loader: BABYLON.GLTF2.GLTFLoader): Promise<void>;
10041
10048
  private copySurfaceToCoatAsync;
10042
10049
  }
10043
10050
 
@@ -10058,20 +10065,17 @@ declare namespace BABYLON.GLTF2 {
10058
10065
  * Gets the underlying material
10059
10066
  */
10060
10067
  readonly material: Material;
10061
- /** @deprecated Use finalizeAsync instead. */
10062
- finalize?(): void;
10063
10068
  /**
10064
10069
  * Finalizes material properties after all loading is complete.
10065
- * May return a Promise for async work (e.g. GPU texture processing). Any returned
10066
- * Promise is tracked by the loader and awaited before the COMPLETE state is reached,
10067
- * so callers can rely on onCompleteObservable for fully processed materials.
10070
+ * May do async work (e.g. GPU texture processing); the returned Promise is tracked
10071
+ * by the loader and awaited before the COMPLETE state is reached, so callers can rely
10072
+ * on onCompleteObservable for fully processed materials.
10068
10073
  *
10069
- * The loader passes an AbortSignal that is aborted when the loader is disposed.
10070
- * Implementations should check `signal.aborted` after each await point and, if
10071
- * aborted, release any intermediate resources and return early.
10072
- * @param signal An AbortSignal that fires when the loader is disposed mid-flight.
10074
+ * Implementations should check `loader._disposed` between awaits to bail out early
10075
+ * when the loader is disposed mid-flight.
10076
+ * @param loader The glTF loader driving the finalize step.
10073
10077
  */
10074
- finalizeAsync?(signal: AbortSignal): Promise<void> | void;
10078
+ finalizeAsync(loader: BABYLON.GLTF2.GLTFLoader): Promise<void>;
10075
10079
  /**
10076
10080
  * Whether the material should be treated as unlit
10077
10081
  */
@@ -11006,8 +11010,6 @@ declare namespace BABYLON.GLTF2 {
11006
11010
  export class GLTFLoader implements IGLTFLoader {
11007
11011
  /** @internal */
11008
11012
  readonly _completePromises: Promise<unknown>[];
11009
- /** AbortController used to cancel in-flight finalizeAsync() calls when dispose() is called. */
11010
- private _finalizeController;
11011
11013
  /** @internal */
11012
11014
  _assetContainer: Nullable<AssetContainer>;
11013
11015
  /** Storage */
@@ -11020,7 +11022,8 @@ declare namespace BABYLON.GLTF2 {
11020
11022
  _skipStartAnimationStep: boolean;
11021
11023
  private readonly _parent;
11022
11024
  private readonly _extensions;
11023
- private _disposed;
11025
+ /** @internal */
11026
+ _disposed: boolean;
11024
11027
  private _rootUrl;
11025
11028
  private _fileName;
11026
11029
  private _uniqueRootUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-loaders",
3
- "version": "9.7.0",
3
+ "version": "9.8.0",
4
4
  "main": "babylonjs.loaders.min.js",
5
5
  "types": "babylonjs.loaders.module.d.ts",
6
6
  "files": [
@@ -16,8 +16,8 @@
16
16
  "test:escheck": "es-check es6 ./babylonjs.loaders.js"
17
17
  },
18
18
  "dependencies": {
19
- "babylonjs": "9.7.0",
20
- "babylonjs-gltf2interface": "9.7.0"
19
+ "babylonjs": "9.8.0",
20
+ "babylonjs-gltf2interface": "9.8.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@dev/build-tools": "1.0.0",