babylonjs-loaders 9.22.2 → 9.25.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.
- package/babylon.glTF1FileLoader.js +1 -1
- package/babylon.glTF1FileLoader.js.map +1 -1
- package/babylon.glTF1FileLoader.min.js +1 -1
- package/babylon.glTF1FileLoader.min.js.map +1 -1
- package/babylon.glTF2FileLoader.js +1 -1
- package/babylon.glTF2FileLoader.js.map +1 -1
- package/babylon.glTF2FileLoader.min.js +1 -1
- package/babylon.glTF2FileLoader.min.js.map +1 -1
- package/babylon.glTFFileLoader.js +1 -1
- package/babylon.glTFFileLoader.js.map +1 -1
- package/babylon.glTFFileLoader.min.js +1 -1
- package/babylon.glTFFileLoader.min.js.map +1 -1
- package/babylon.objFileLoader.js +1 -1
- package/babylon.objFileLoader.js.map +1 -1
- package/babylon.objFileLoader.min.js +1 -1
- package/babylon.objFileLoader.min.js.map +1 -1
- package/babylonjs.loaders.d.ts +295 -23
- package/babylonjs.loaders.es5.js +14436 -0
- package/babylonjs.loaders.js +1 -1
- package/babylonjs.loaders.js.map +1 -1
- package/babylonjs.loaders.min.js +1 -1
- package/babylonjs.loaders.min.js.map +1 -1
- package/babylonjs.loaders.module.d.ts +589 -65
- package/package.json +3 -3
- package/rollup.config.umd.mjs +1 -0
package/babylonjs.loaders.d.ts
CHANGED
|
@@ -357,11 +357,13 @@ declare namespace BABYLON {
|
|
|
357
357
|
*/
|
|
358
358
|
abstract onValidated?: (results: GLTF2.IGLTFValidationResults) => void;
|
|
359
359
|
/**
|
|
360
|
-
* Function called before loading a
|
|
361
|
-
*
|
|
362
|
-
* @
|
|
360
|
+
* Function called before loading a URL referenced by the asset.
|
|
361
|
+
* Setting this function allows parent-relative asset URIs and makes the callback responsible for URI safety.
|
|
362
|
+
* @param url The URL referenced by the asset
|
|
363
|
+
* @param rootUrl The root URL of the asset, if available
|
|
364
|
+
* @returns A promise that resolves to the URL to load
|
|
363
365
|
*/
|
|
364
|
-
preprocessUrlAsync: (url: string) => Promise<string>;
|
|
366
|
+
preprocessUrlAsync: (url: string, rootUrl?: string) => Promise<string>;
|
|
365
367
|
}
|
|
366
368
|
/**
|
|
367
369
|
* File loader for loading glTF files into a scene.
|
|
@@ -376,6 +378,8 @@ declare namespace BABYLON {
|
|
|
376
378
|
* @param options The options for the loader
|
|
377
379
|
*/
|
|
378
380
|
constructor(options?: Partial<Readonly<GLTFLoaderOptions>>);
|
|
381
|
+
/** @internal */
|
|
382
|
+
get _isPreprocessUrlAsyncSet(): boolean;
|
|
379
383
|
/**
|
|
380
384
|
* Raised when the asset has been parsed
|
|
381
385
|
*/
|
|
@@ -2973,7 +2977,8 @@ declare namespace BABYLON {
|
|
|
2973
2977
|
|
|
2974
2978
|
}
|
|
2975
2979
|
declare namespace BABYLON.GLTF2 {
|
|
2976
|
-
/**
|
|
2980
|
+
/** This file must only contain pure code and pure imports */
|
|
2981
|
+
/** @internal */
|
|
2977
2982
|
export type GetValueFn = (target: any, source: Float32Array, offset: number, scale: number) => any;
|
|
2978
2983
|
/** @internal */
|
|
2979
2984
|
export function getVector3(_target: any, source: Float32Array, offset: number, scale: number): Vector3;
|
|
@@ -3011,7 +3016,20 @@ declare namespace BABYLON.GLTF2 {
|
|
|
3011
3016
|
babylonAnimation: Animation;
|
|
3012
3017
|
}[];
|
|
3013
3018
|
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Registers the core glTF animation interpolation mappings.
|
|
3021
|
+
*/
|
|
3022
|
+
export function RegisterGLTFLoaderAnimation(): void;
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
|
|
3026
|
+
}
|
|
3027
|
+
declare namespace BABYLON {
|
|
3028
|
+
|
|
3014
3029
|
|
|
3030
|
+
}
|
|
3031
|
+
declare namespace BABYLON.GLTF2 {
|
|
3032
|
+
|
|
3015
3033
|
|
|
3016
3034
|
|
|
3017
3035
|
}
|
|
@@ -4966,6 +4984,11 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
4966
4984
|
onReady(): void;
|
|
4967
4985
|
dispose(): void;
|
|
4968
4986
|
}
|
|
4987
|
+
/**
|
|
4988
|
+
* @internal
|
|
4989
|
+
* Registers KHR_node_visibility runtime dependencies without changing the extension registry.
|
|
4990
|
+
*/
|
|
4991
|
+
export function _RegisterKHRNodeVisibilityRuntime(): void;
|
|
4969
4992
|
/**
|
|
4970
4993
|
* Registers the KHR_node_visibility glTF loader extension.
|
|
4971
4994
|
* Safe to call multiple times; only the first call has an effect.
|
|
@@ -5027,6 +5050,11 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
5027
5050
|
onReady(): Promise<void>;
|
|
5028
5051
|
dispose(): void;
|
|
5029
5052
|
}
|
|
5053
|
+
/**
|
|
5054
|
+
* @internal
|
|
5055
|
+
* Registers KHR_node_selectability runtime dependencies without changing the extension registry.
|
|
5056
|
+
*/
|
|
5057
|
+
export function _RegisterKHRNodeSelectabilityRuntime(): void;
|
|
5030
5058
|
/**
|
|
5031
5059
|
* Registers the KHR_node_selectability glTF loader extension.
|
|
5032
5060
|
* Safe to call multiple times; only the first call has an effect.
|
|
@@ -5089,6 +5117,11 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
5089
5117
|
onReady(): Promise<void>;
|
|
5090
5118
|
dispose(): void;
|
|
5091
5119
|
}
|
|
5120
|
+
/**
|
|
5121
|
+
* @internal
|
|
5122
|
+
* Registers KHR_node_hoverability runtime dependencies without changing the extension registry.
|
|
5123
|
+
*/
|
|
5124
|
+
export function _RegisterKHRNodeHoverabilityRuntime(): void;
|
|
5092
5125
|
/**
|
|
5093
5126
|
* Registers the KHR_node_hoverability glTF loader extension.
|
|
5094
5127
|
* Safe to call multiple times; only the first call has an effect.
|
|
@@ -6645,6 +6678,11 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
6645
6678
|
* populates the object model with the interactivity extension
|
|
6646
6679
|
*/
|
|
6647
6680
|
export function _AddInteractivityObjectModel(scene: Scene): void;
|
|
6681
|
+
/**
|
|
6682
|
+
* @internal
|
|
6683
|
+
* Registers KHR_interactivity runtime dependencies without changing the extension registry.
|
|
6684
|
+
*/
|
|
6685
|
+
export function _RegisterKHRInteractivityRuntime(): void;
|
|
6648
6686
|
/**
|
|
6649
6687
|
* Registers the KHR_interactivity glTF loader extension.
|
|
6650
6688
|
* Safe to call multiple times; only the first call has an effect.
|
|
@@ -6865,6 +6903,20 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
6865
6903
|
|
|
6866
6904
|
|
|
6867
6905
|
|
|
6906
|
+
}
|
|
6907
|
+
declare namespace BABYLON {
|
|
6908
|
+
|
|
6909
|
+
|
|
6910
|
+
}
|
|
6911
|
+
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
6912
|
+
/**
|
|
6913
|
+
* Registers the KHR_animation_pointer interpolation mappings.
|
|
6914
|
+
* @internal
|
|
6915
|
+
*/
|
|
6916
|
+
export function _RegisterKHRAnimationPointerData(): void;
|
|
6917
|
+
|
|
6918
|
+
|
|
6919
|
+
|
|
6868
6920
|
}
|
|
6869
6921
|
declare namespace BABYLON {
|
|
6870
6922
|
|
|
@@ -8112,6 +8164,24 @@ declare namespace BABYLON.GLTF1 {
|
|
|
8112
8164
|
loadMaterialAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (material: Material) => void, onError: (message: string) => void): boolean;
|
|
8113
8165
|
private _loadTexture;
|
|
8114
8166
|
}
|
|
8167
|
+
/**
|
|
8168
|
+
* Registers the KHR_materials_common extension.
|
|
8169
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
8170
|
+
*/
|
|
8171
|
+
export function RegisterGLTFMaterialsCommonExtension(): void;
|
|
8172
|
+
|
|
8173
|
+
|
|
8174
|
+
|
|
8175
|
+
}
|
|
8176
|
+
declare namespace BABYLON {
|
|
8177
|
+
|
|
8178
|
+
|
|
8179
|
+
}
|
|
8180
|
+
declare namespace BABYLON.GLTF1 {
|
|
8181
|
+
/**
|
|
8182
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
8183
|
+
* Import "./glTFMaterialsCommonExtension.pure" for tree-shakeable, side-effect-free usage.
|
|
8184
|
+
*/
|
|
8115
8185
|
|
|
8116
8186
|
|
|
8117
8187
|
|
|
@@ -8745,6 +8815,24 @@ declare namespace BABYLON.GLTF1 {
|
|
|
8745
8815
|
private static _CreateTextureAsync;
|
|
8746
8816
|
private static _ApplyExtensions;
|
|
8747
8817
|
}
|
|
8818
|
+
/**
|
|
8819
|
+
* Registers the glTF 1.0 loader factory.
|
|
8820
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
8821
|
+
*/
|
|
8822
|
+
export function RegisterGLTF1Loader(): void;
|
|
8823
|
+
|
|
8824
|
+
|
|
8825
|
+
|
|
8826
|
+
}
|
|
8827
|
+
declare namespace BABYLON {
|
|
8828
|
+
|
|
8829
|
+
|
|
8830
|
+
}
|
|
8831
|
+
declare namespace BABYLON.GLTF1 {
|
|
8832
|
+
/**
|
|
8833
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
8834
|
+
* Import "./glTFLoader.pure" for tree-shakeable, side-effect-free usage.
|
|
8835
|
+
*/
|
|
8748
8836
|
|
|
8749
8837
|
|
|
8750
8838
|
|
|
@@ -8766,6 +8854,24 @@ declare namespace BABYLON.GLTF1 {
|
|
|
8766
8854
|
loadTextureBufferAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (buffer: ArrayBufferView) => void): boolean;
|
|
8767
8855
|
loadShaderStringAsync(gltfRuntime: BABYLON.GLTF1.IGLTFRuntime, id: string, onSuccess: (shaderString: string) => void): boolean;
|
|
8768
8856
|
}
|
|
8857
|
+
/**
|
|
8858
|
+
* Registers the KHR_binary_glTF extension.
|
|
8859
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
8860
|
+
*/
|
|
8861
|
+
export function RegisterGLTFBinaryExtension(): void;
|
|
8862
|
+
|
|
8863
|
+
|
|
8864
|
+
|
|
8865
|
+
}
|
|
8866
|
+
declare namespace BABYLON {
|
|
8867
|
+
|
|
8868
|
+
|
|
8869
|
+
}
|
|
8870
|
+
declare namespace BABYLON.GLTF1 {
|
|
8871
|
+
/**
|
|
8872
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
8873
|
+
* Import "./glTFBinaryExtension.pure" for tree-shakeable, side-effect-free usage.
|
|
8874
|
+
*/
|
|
8769
8875
|
|
|
8770
8876
|
|
|
8771
8877
|
|
|
@@ -9700,6 +9806,9 @@ declare namespace BABYLON {
|
|
|
9700
9806
|
activeLod?: number;
|
|
9701
9807
|
/** Distance-based ideal LOD level for this node, recomputed per frame. */
|
|
9702
9808
|
optimalLod?: number;
|
|
9809
|
+
/** Projected screen size (pixels) of the node's AABB — the max across active cameras. Larger nodes keep finer
|
|
9810
|
+
* detail under the splat budget. Only computed while the budget is enabled. */
|
|
9811
|
+
pixelSize?: number;
|
|
9703
9812
|
/** Available LOD levels for this leaf, sorted ascending (0 = finest). Set during the tree walk. */
|
|
9704
9813
|
availableLevels?: number[];
|
|
9705
9814
|
/** Coarsest available level (= max key), always streamed as the permanent base layer. */
|
|
@@ -9801,6 +9910,17 @@ declare namespace BABYLON {
|
|
|
9801
9910
|
* return to it avoids a re-download. Only used when a budget enables eviction. PlayCanvas default `100`.
|
|
9802
9911
|
*/
|
|
9803
9912
|
evictionCooldownFrames?: number;
|
|
9913
|
+
/**
|
|
9914
|
+
* Enables budget-driven LOD: caps the total rendered splats by converging a screen-space (size + distance)
|
|
9915
|
+
* pixel-size threshold to the budget. Selection is view-direction-independent, so it is consistent across any
|
|
9916
|
+
* number of active cameras (each node takes the finest level and largest projected size any camera demands).
|
|
9917
|
+
* A number is an explicit splat cap; `"auto"` picks a device-tiered default (desktop 2.5M / iOS 1.5M /
|
|
9918
|
+
* other mobile 1M; XR shares the mobile tier). **Undefined (default) disables the cap** — LOD is pure
|
|
9919
|
+
* distance, identical to prior behavior. Runtime-mutable via the {@link splatBudget} accessor. When this stream
|
|
9920
|
+
* is hosted in a compound, the compound's {@link GaussianSplattingMesh.splatBudget} (if set) overrides this and
|
|
9921
|
+
* apportions a shared budget across all its streams.
|
|
9922
|
+
*/
|
|
9923
|
+
splatBudget?: number | "auto";
|
|
9804
9924
|
/**
|
|
9805
9925
|
* When set, the stream does not render itself; instead it reserves a region of this compound mesh and
|
|
9806
9926
|
* decodes/sorts into it, so its splats are depth-sorted and drawn in ONE pass together with the compound's
|
|
@@ -9840,7 +9960,7 @@ declare namespace BABYLON {
|
|
|
9840
9960
|
*
|
|
9841
9961
|
* @experimental
|
|
9842
9962
|
*/
|
|
9843
|
-
export class GaussianSplattingStream extends GaussianSplattingMesh {
|
|
9963
|
+
export class GaussianSplattingStream extends GaussianSplattingMesh implements IGaussianSplattingLodBudgetParticipant {
|
|
9844
9964
|
private readonly _metadata;
|
|
9845
9965
|
private readonly _rootUrl;
|
|
9846
9966
|
private readonly _streamOptions;
|
|
@@ -9855,9 +9975,12 @@ declare namespace BABYLON {
|
|
|
9855
9975
|
private _lodUpdateInterval;
|
|
9856
9976
|
private _lodUpdateDistance;
|
|
9857
9977
|
private _maxDetailLod;
|
|
9978
|
+
private _lodPixelThreshold;
|
|
9979
|
+
private _hostBudgetAllocation;
|
|
9858
9980
|
private _frustumCulling;
|
|
9859
9981
|
private readonly _frustumPlanes;
|
|
9860
9982
|
private readonly _cullViewProj;
|
|
9983
|
+
private readonly _frustumScratch;
|
|
9861
9984
|
private _workBuffer;
|
|
9862
9985
|
private _decodeSh;
|
|
9863
9986
|
private _streamShDegree;
|
|
@@ -9888,7 +10011,8 @@ declare namespace BABYLON {
|
|
|
9888
10011
|
private _lodObserver;
|
|
9889
10012
|
private _baseLayerReady;
|
|
9890
10013
|
private _framesSinceLodUpdate;
|
|
9891
|
-
private readonly
|
|
10014
|
+
private readonly _lastLodCamPositions;
|
|
10015
|
+
private _lastLodSignature;
|
|
9892
10016
|
private _forceLodUpdate;
|
|
9893
10017
|
private readonly _boundsMin;
|
|
9894
10018
|
private readonly _boundsMax;
|
|
@@ -9987,6 +10111,66 @@ declare namespace BABYLON {
|
|
|
9987
10111
|
*/
|
|
9988
10112
|
get maxDetailLod(): number;
|
|
9989
10113
|
set maxDetailLod(value: number);
|
|
10114
|
+
/**
|
|
10115
|
+
* This stream's own budget-driven LOD cap in splats (see {@link IGaussianSplattingStreamOptions.splatBudget}).
|
|
10116
|
+
* `0` disables the budget (pure distance LOD). Setting it caps the rendered splat count, taking effect on the
|
|
10117
|
+
* next frame. When this stream is hosted in a compound whose own budget is set, that shared budget overrides
|
|
10118
|
+
* this value — read the actual runtime cap from {@link effectiveSplatBudget}, not this getter (which always
|
|
10119
|
+
* reports the configured own cap).
|
|
10120
|
+
* @experimental
|
|
10121
|
+
*/
|
|
10122
|
+
get splatBudget(): number;
|
|
10123
|
+
set splatBudget(value: number);
|
|
10124
|
+
/**
|
|
10125
|
+
* The splat cap actually in force this frame: a hosting compound's apportioned allocation when this stream is
|
|
10126
|
+
* coordinated, otherwise this stream's own {@link splatBudget}, clamped to what can be kept resident. `0` means
|
|
10127
|
+
* no cap (pure distance LOD). Unlike {@link splatBudget}, this reflects the compound override, so it is the value
|
|
10128
|
+
* to display or reason about at runtime.
|
|
10129
|
+
* @experimental
|
|
10130
|
+
*/
|
|
10131
|
+
get effectiveSplatBudget(): number;
|
|
10132
|
+
/**
|
|
10133
|
+
* Resolves the raw {@link splatBudget} option to a concrete cap: `undefined` ⇒ 0 (disabled), `"auto"` ⇒ a
|
|
10134
|
+
* device-tiered default, a positive number ⇒ itself (floored).
|
|
10135
|
+
* @param option the raw option value
|
|
10136
|
+
* @returns the resolved splat cap (0 = disabled)
|
|
10137
|
+
*/
|
|
10138
|
+
private _resolveSplatBudget;
|
|
10139
|
+
/**
|
|
10140
|
+
* Device-tiered default splat budget for {@link splatBudget} `"auto"`: desktop 2.5M, iOS 1.5M, other mobile
|
|
10141
|
+
* (incl. Android/XR) 1M. XR is folded into the mobile tier (no reliable at-construction detection).
|
|
10142
|
+
* @returns the default splat cap for this device
|
|
10143
|
+
*/
|
|
10144
|
+
private _computeDefaultSplatBudget;
|
|
10145
|
+
/**
|
|
10146
|
+
* The splat budget this stream converges against this frame: the compound's apportioned allocation when hosted
|
|
10147
|
+
* and coordinated, else this stream's own resolved budget. Clamped to the resident budget so the stream never
|
|
10148
|
+
* targets more splats than can be kept resident. `0` means the budget is disabled.
|
|
10149
|
+
* @returns the effective splat cap (0 = disabled)
|
|
10150
|
+
*/
|
|
10151
|
+
private _effectiveSplatBudget;
|
|
10152
|
+
/**
|
|
10153
|
+
* Whether budget-driven LOD is active this frame.
|
|
10154
|
+
* @returns true when a positive effective budget is in force
|
|
10155
|
+
*/
|
|
10156
|
+
private _splatBudgetEnabled;
|
|
10157
|
+
/**
|
|
10158
|
+
* {@link IGaussianSplattingLodBudgetParticipant}: the splats this stream would render at full (distance-optimal)
|
|
10159
|
+
* detail — its demand on a host compound's shared budget. Computed from the current per-node distance-optimal
|
|
10160
|
+
* levels (no pixel threshold), so it does not depend on the allocation it is helping to compute.
|
|
10161
|
+
* @returns the full-detail rendered splat count (0 before the base layer is ready)
|
|
10162
|
+
*/
|
|
10163
|
+
getBudgetDemand(): number;
|
|
10164
|
+
/**
|
|
10165
|
+
* {@link IGaussianSplattingLodBudgetParticipant}: sets the compound's apportioned share of the shared budget.
|
|
10166
|
+
* `null` releases coordination (revert to this stream's own {@link splatBudget}); a number (incl. 0, meaning
|
|
10167
|
+
* "coordinated at the coarsest level") drives the pixel-threshold convergence. Any change to the (already integer)
|
|
10168
|
+
* allocation forces a next-frame re-eval: a decrease may put the current selection over the new cap, and even a
|
|
10169
|
+
* small increase can unlock a finer level that a stationary camera would otherwise never re-evaluate to. The
|
|
10170
|
+
* apportioned demand is allocation-independent, so this settles in one step and does not churn frame to frame.
|
|
10171
|
+
* @param splats the apportioned allocation, or null to release coordination
|
|
10172
|
+
*/
|
|
10173
|
+
setBudgetAllocation(splats: Nullable<number>): void;
|
|
9990
10174
|
/**
|
|
9991
10175
|
* Coarsest LOD level index in the scene (number of LOD levels minus one). Useful as the upper bound
|
|
9992
10176
|
* for {@link maxDetailLod}.
|
|
@@ -10030,10 +10214,17 @@ declare namespace BABYLON {
|
|
|
10030
10214
|
*/
|
|
10031
10215
|
private _getEffectiveWorldMatrix;
|
|
10032
10216
|
/**
|
|
10033
|
-
*
|
|
10034
|
-
*
|
|
10035
|
-
*
|
|
10036
|
-
|
|
10217
|
+
* The cameras the LOD should serve: `scene.activeCameras` when set (split-view / multi-view), else the single
|
|
10218
|
+
* `scene.activeCamera`. Mirrors the sort path's multi-camera handling.
|
|
10219
|
+
* @returns the non-null active cameras (may be empty)
|
|
10220
|
+
*/
|
|
10221
|
+
private _getActiveLodCameras;
|
|
10222
|
+
/**
|
|
10223
|
+
* Re-evaluates the optimal LOD for every node from the active cameras. Each node takes the finest level and the
|
|
10224
|
+
* largest projected pixel size any active camera demands (so every pane of a split view is served), and the
|
|
10225
|
+
* frustum bias uses the union of the frusta. Selection is view-direction-independent, so single- and multi-camera
|
|
10226
|
+
* rendering are consistent. The results are stored in each node's `optimalLod` / `pixelSize`.
|
|
10227
|
+
* @param camera when provided, evaluate against just this camera; otherwise use the active-camera set
|
|
10037
10228
|
*/
|
|
10038
10229
|
evaluateOptimalLods(camera?: Nullable<Camera>): void;
|
|
10039
10230
|
/**
|
|
@@ -10217,10 +10408,61 @@ declare namespace BABYLON {
|
|
|
10217
10408
|
*/
|
|
10218
10409
|
private _cappedLevelForNode;
|
|
10219
10410
|
/**
|
|
10220
|
-
* Computes each node's {@link ISOGLODNode.targetLevel}
|
|
10221
|
-
*
|
|
10411
|
+
* Computes each node's {@link ISOGLODNode.targetLevel}. With the splat budget disabled this is the
|
|
10412
|
+
* distance-optimal level snapped to an available level (capped by {@link maxDetailLod}) — unchanged prior
|
|
10413
|
+
* behavior. With the budget enabled it converges a global pixel-size threshold to the budget and coarsens each
|
|
10414
|
+
* node from its distance-optimal ceiling by how far its projected size falls below that threshold.
|
|
10222
10415
|
*/
|
|
10223
10416
|
private _computeTargetLevels;
|
|
10417
|
+
/**
|
|
10418
|
+
* Splat count of the always-rendered environment layer (0 when none), coerced to a finite non-negative integer.
|
|
10419
|
+
* Counted as a fixed cost in both the budget demand and the leaf convergence so it is never over-drawn.
|
|
10420
|
+
* @returns the environment's rendered splat count
|
|
10421
|
+
*/
|
|
10422
|
+
private _environmentSplatCount;
|
|
10423
|
+
/**
|
|
10424
|
+
* The level a node renders at for a given pixel-size threshold `t`: its distance-optimal ceiling, coarsened by
|
|
10425
|
+
* `round(log_mult(t / pixelSize))` geometric steps when its projected size is below `t`. Snapped to
|
|
10426
|
+
* an available level honoring {@link maxDetailLod}.
|
|
10427
|
+
* @param node leaf node
|
|
10428
|
+
* @param t pixel-size threshold (pixels)
|
|
10429
|
+
* @returns the chosen available LOD level
|
|
10430
|
+
*/
|
|
10431
|
+
private _budgetedLevel;
|
|
10432
|
+
/**
|
|
10433
|
+
* Splat count of a node's file at a given (already snapped) available level.
|
|
10434
|
+
* @param node leaf node
|
|
10435
|
+
* @param level available LOD level
|
|
10436
|
+
* @returns the level's splat count (0 if absent)
|
|
10437
|
+
*/
|
|
10438
|
+
private _countAtLevel;
|
|
10439
|
+
/**
|
|
10440
|
+
* Sum of every leaf's rendered splat count at pixel-size threshold `t`.
|
|
10441
|
+
* @param t pixel-size threshold (pixels)
|
|
10442
|
+
* @returns total rendered splats
|
|
10443
|
+
*/
|
|
10444
|
+
private _totalSplatsAtThreshold;
|
|
10445
|
+
/**
|
|
10446
|
+
* Converges the global pixel-size threshold {@link _lodPixelThreshold} to the largest detail whose total rendered
|
|
10447
|
+
* splats is still within `budget` (the pixel-scale cut, floored at the true sub-pixel limit of 1 px). The
|
|
10448
|
+
* total is monotonically non-increasing in the threshold, so a bisection on `[floorT, ceilT]` — where `ceilT`
|
|
10449
|
+
* coarsens every node to its coarsest available level — gives a GUARANTEED result at or under the cap. When even
|
|
10450
|
+
* that coarsest state exceeds the budget (the budget is below the pinned minimum detail), the threshold is set to
|
|
10451
|
+
* `ceilT` so every node renders at minimum detail — the best achievable; the cap is then unavoidable. O(leaves)
|
|
10452
|
+
* per iteration; no decode.
|
|
10453
|
+
* @param budget target maximum rendered splat count
|
|
10454
|
+
*/
|
|
10455
|
+
private _convergePixelThreshold;
|
|
10456
|
+
/**
|
|
10457
|
+
* The finest already-decoded level of a node that is at least as coarse as `level` (index >= level). Used to
|
|
10458
|
+
* enforce the budget cap immediately without waiting for a download. Returns `null` when no such level is resident
|
|
10459
|
+
* — including when eviction has freed the base layer — so the caller keeps the currently-visible (resident) file
|
|
10460
|
+
* rather than switching to a non-resident one, which would render a hole.
|
|
10461
|
+
* @param node leaf node
|
|
10462
|
+
* @param level the minimum coarseness (level index) required
|
|
10463
|
+
* @returns a resident level index >= level, or null when none is resident
|
|
10464
|
+
*/
|
|
10465
|
+
private _residentLevelAtLeast;
|
|
10224
10466
|
/**
|
|
10225
10467
|
* Applies each node's {@link ISOGLODNode.targetLevel}: switches a node to its target level when that
|
|
10226
10468
|
* level's file is already decoded, otherwise records a pending download request for the file and leaves
|
|
@@ -10274,17 +10516,28 @@ declare namespace BABYLON {
|
|
|
10274
10516
|
*/
|
|
10275
10517
|
private _onLodFrame;
|
|
10276
10518
|
/**
|
|
10277
|
-
*
|
|
10278
|
-
*
|
|
10279
|
-
*
|
|
10280
|
-
*
|
|
10519
|
+
* A cheap signature of the discrete inputs (besides camera translation, tracked separately) that affect projected
|
|
10520
|
+
* pixel size: each camera's identity, FOV, FOV mode and viewport, plus the engine render size and the effective
|
|
10521
|
+
* world matrix revision. A change invalidates the throttled budget LOD so a colocated camera swap / viewport
|
|
10522
|
+
* resize / FOV change — or the stream (or its hosted proxy) being moved or scaled while still in frustum, which
|
|
10523
|
+
* shifts every node's distance and projected size — can't leave it stale.
|
|
10524
|
+
* @param cameras the active cameras
|
|
10525
|
+
* @returns the signature string
|
|
10526
|
+
*/
|
|
10527
|
+
private _computeLodSignature;
|
|
10528
|
+
/**
|
|
10529
|
+
* Updates each leaf node's {@link ISOGLODNode.inFrustum} flag: a node is in-frustum if it is inside ANY
|
|
10530
|
+
* active camera's frustum (the union). When {@link frustumCulling} is disabled (or there are no cameras)
|
|
10531
|
+
* every node is marked in-frustum. Bounds are static (from the LOD tree), so flags are valid for all nodes
|
|
10532
|
+
* regardless of decode state. Returns true when any node's in-frustum state changed (so the LOD bias must be re-applied).
|
|
10281
10533
|
* @returns whether any node's in-frustum state changed
|
|
10282
10534
|
*/
|
|
10283
10535
|
private _updateNodeFrustum;
|
|
10284
10536
|
/**
|
|
10285
|
-
* Reads the splat count from SOG metadata
|
|
10537
|
+
* Reads the splat count from SOG metadata, coerced to a finite non-negative integer (metadata is untrusted, so
|
|
10538
|
+
* `count` / `shape[0]` may be a string or malformed — a non-numeric value must not leak into count arithmetic).
|
|
10286
10539
|
* @param data SOG metadata
|
|
10287
|
-
* @returns the splat count
|
|
10540
|
+
* @returns the splat count (0 when absent/invalid)
|
|
10288
10541
|
*/
|
|
10289
10542
|
private static _GetSplatCount;
|
|
10290
10543
|
/**
|
|
@@ -10928,6 +11181,12 @@ declare namespace BABYLON {
|
|
|
10928
11181
|
* Options for loading OBJ/MTL files
|
|
10929
11182
|
*/
|
|
10930
11183
|
export type OBJLoadingOptions = {
|
|
11184
|
+
/**
|
|
11185
|
+
* Defines the character encoding used to decode OBJ and MTL files.
|
|
11186
|
+
* Use "auto" to detect UTF-8/UTF-16 and fall back to GB18030, or provide an encoding label supported by TextDecoder.
|
|
11187
|
+
* Defaults to "auto".
|
|
11188
|
+
*/
|
|
11189
|
+
encoding?: string;
|
|
10931
11190
|
/**
|
|
10932
11191
|
* Defines if UVs are optimized by default during load.
|
|
10933
11192
|
*/
|
|
@@ -10985,6 +11244,10 @@ declare namespace BABYLON {
|
|
|
10985
11244
|
* This is a babylon scene loader plugin.
|
|
10986
11245
|
*/
|
|
10987
11246
|
export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
11247
|
+
/**
|
|
11248
|
+
* Defines the character encoding used to decode OBJ and MTL files.
|
|
11249
|
+
*/
|
|
11250
|
+
static ENCODING: string;
|
|
10988
11251
|
/**
|
|
10989
11252
|
* Defines if UVs are optimized by default during load.
|
|
10990
11253
|
*/
|
|
@@ -11036,7 +11299,11 @@ declare namespace BABYLON {
|
|
|
11036
11299
|
/**
|
|
11037
11300
|
* Defines the extension the plugin is able to load.
|
|
11038
11301
|
*/
|
|
11039
|
-
readonly extensions:
|
|
11302
|
+
readonly extensions: {
|
|
11303
|
+
readonly ".obj": {
|
|
11304
|
+
readonly isBinary: true;
|
|
11305
|
+
};
|
|
11306
|
+
};
|
|
11040
11307
|
private _assetContainer;
|
|
11041
11308
|
private _loadingOptions;
|
|
11042
11309
|
/**
|
|
@@ -11058,6 +11325,7 @@ declare namespace BABYLON {
|
|
|
11058
11325
|
* @param onFailure
|
|
11059
11326
|
*/
|
|
11060
11327
|
private _loadMTL;
|
|
11328
|
+
private _decode;
|
|
11061
11329
|
/** @internal */
|
|
11062
11330
|
createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync | ISceneLoaderPlugin;
|
|
11063
11331
|
/**
|
|
@@ -11081,7 +11349,7 @@ declare namespace BABYLON {
|
|
|
11081
11349
|
* @param rootUrl root url to load from
|
|
11082
11350
|
* @returns a promise which completes when objects have been loaded to the scene
|
|
11083
11351
|
*/
|
|
11084
|
-
loadAsync(scene: Scene, data: string, rootUrl: string): Promise<void>;
|
|
11352
|
+
loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<void>;
|
|
11085
11353
|
/**
|
|
11086
11354
|
* Load into an asset container.
|
|
11087
11355
|
* @param scene The scene to load into
|
|
@@ -11089,7 +11357,7 @@ declare namespace BABYLON {
|
|
|
11089
11357
|
* @param rootUrl The root url for scene and resources
|
|
11090
11358
|
* @returns The loaded asset container
|
|
11091
11359
|
*/
|
|
11092
|
-
loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string): Promise<AssetContainer>;
|
|
11360
|
+
loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string): Promise<AssetContainer>;
|
|
11093
11361
|
/**
|
|
11094
11362
|
* Read the OBJ file and create an Array of meshes.
|
|
11095
11363
|
* Each mesh contains all information given by the OBJ and the MTL file.
|
|
@@ -11111,7 +11379,11 @@ declare namespace BABYLON {
|
|
|
11111
11379
|
|
|
11112
11380
|
export var OBJFileLoaderMetadata: {
|
|
11113
11381
|
readonly name: "obj";
|
|
11114
|
-
readonly extensions:
|
|
11382
|
+
readonly extensions: {
|
|
11383
|
+
readonly ".obj": {
|
|
11384
|
+
readonly isBinary: true;
|
|
11385
|
+
};
|
|
11386
|
+
};
|
|
11115
11387
|
};
|
|
11116
11388
|
|
|
11117
11389
|
|