babylonjs-loaders 9.26.0 → 9.26.2
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.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/babylonjs.loaders.d.ts +1505 -92
- package/babylonjs.loaders.es5.js +13257 -8699
- 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 +3068 -202
- package/package.json +3 -3
package/babylonjs.loaders.d.ts
CHANGED
|
@@ -2828,8 +2828,9 @@ declare namespace BABYLON.GLTF2 {
|
|
|
2828
2828
|
onLoading?(): void;
|
|
2829
2829
|
/**
|
|
2830
2830
|
* Called after the loader state changes to READY.
|
|
2831
|
+
* @returns a promise when the extension has asynchronous readiness work
|
|
2831
2832
|
*/
|
|
2832
|
-
onReady?(): void
|
|
2833
|
+
onReady?(): void | Promise<void>;
|
|
2833
2834
|
/**
|
|
2834
2835
|
* Define this method to modify the default behavior when loading scenes.
|
|
2835
2836
|
* @param context The context when loading the asset
|
|
@@ -3417,7 +3418,7 @@ declare namespace BABYLON.GLTF2 {
|
|
|
3417
3418
|
private _forEachExtensions;
|
|
3418
3419
|
private _applyExtensions;
|
|
3419
3420
|
private _extensionsOnLoading;
|
|
3420
|
-
private
|
|
3421
|
+
private _extensionsOnReadyAsync;
|
|
3421
3422
|
private _extensionsLoadSceneAsync;
|
|
3422
3423
|
private _extensionsLoadNodeAsync;
|
|
3423
3424
|
private _extensionsLoadCameraAsync;
|
|
@@ -4060,9 +4061,10 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
4060
4061
|
/**
|
|
4061
4062
|
* get a path-to-object converter for the given glTF tree
|
|
4062
4063
|
* @param gltf the glTF tree to use
|
|
4064
|
+
* @param configure optional callback for adding asset-local accessors to this converter
|
|
4063
4065
|
* @returns a path-to-object converter for the given glTF tree
|
|
4064
4066
|
*/
|
|
4065
|
-
export function GetPathToObjectConverter(gltf: BABYLON.GLTF2.Loader.IGLTF): BABYLON.GLTF2.Loader.Extensions.GLTFPathToObjectConverter<unknown, unknown, unknown>;
|
|
4067
|
+
export function GetPathToObjectConverter(gltf: BABYLON.GLTF2.Loader.IGLTF, configure?: (mapping: object) => void): BABYLON.GLTF2.Loader.Extensions.GLTFPathToObjectConverter<unknown, unknown, unknown>;
|
|
4066
4068
|
/**
|
|
4067
4069
|
* This function will return the object accessor for the given key in the object model
|
|
4068
4070
|
* If the key is not found, it will return undefined
|
|
@@ -4081,8 +4083,9 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
4081
4083
|
* Note that this will NOT change the typescript types. To do that you will need to change the interface itself (extending it in the module that uses it)
|
|
4082
4084
|
* @param key the key to add the object accessor at. For example /cameras/\{\}/perspective/aspectRatio
|
|
4083
4085
|
* @param accessor the object accessor to add
|
|
4086
|
+
* @param mapping object-model mapping to update; defaults to the process-wide mapping used as the template for new converters
|
|
4084
4087
|
*/
|
|
4085
|
-
export function AddObjectAccessorToKey<GLTFTargetType = any, BabylonTargetType = any, BabylonValueType = any>(key: string, accessor: IObjectAccessor<GLTFTargetType, BabylonTargetType, BabylonValueType
|
|
4088
|
+
export function AddObjectAccessorToKey<GLTFTargetType = any, BabylonTargetType = any, BabylonValueType = any>(key: string, accessor: IObjectAccessor<GLTFTargetType, BabylonTargetType, BabylonValueType>, mapping?: object): void;
|
|
4086
4089
|
|
|
4087
4090
|
|
|
4088
4091
|
|
|
@@ -5038,6 +5041,8 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
5038
5041
|
* The name of this extension.
|
|
5039
5042
|
*/
|
|
5040
5043
|
readonly name = "KHR_node_selectability";
|
|
5044
|
+
/** Applies node state before KHR_interactivity graphs start. */
|
|
5045
|
+
readonly order = 100;
|
|
5041
5046
|
/**
|
|
5042
5047
|
* Defines whether this extension is enabled.
|
|
5043
5048
|
*/
|
|
@@ -5105,6 +5110,8 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
5105
5110
|
* The name of this extension.
|
|
5106
5111
|
*/
|
|
5107
5112
|
readonly name = "KHR_node_hoverability";
|
|
5113
|
+
/** Applies node state before KHR_interactivity graphs start. */
|
|
5114
|
+
readonly order = 100;
|
|
5108
5115
|
/**
|
|
5109
5116
|
* Defines whether this extension is enabled.
|
|
5110
5117
|
*/
|
|
@@ -6645,12 +6652,74 @@ declare namespace BABYLON {
|
|
|
6645
6652
|
/**
|
|
6646
6653
|
* Defines options for the KHR_interactivity extension.
|
|
6647
6654
|
*/
|
|
6648
|
-
["KHR_interactivity"]: {
|
|
6655
|
+
["KHR_interactivity"]: {
|
|
6656
|
+
/**
|
|
6657
|
+
* Whether the selected default graph starts automatically after import.
|
|
6658
|
+
* Defaults to true.
|
|
6659
|
+
*/
|
|
6660
|
+
autoStart?: boolean;
|
|
6661
|
+
/**
|
|
6662
|
+
* Whether to retain only the canonical source model and executable
|
|
6663
|
+
* FlowGraph serialization without constructing runtime graphs.
|
|
6664
|
+
* Defaults to false.
|
|
6665
|
+
*/
|
|
6666
|
+
parseOnly?: boolean;
|
|
6667
|
+
/**
|
|
6668
|
+
* Whether to enforce the ratified graph validation rules.
|
|
6669
|
+
* Defaults to true. Set to false only for pre-ratification assets.
|
|
6670
|
+
*/
|
|
6671
|
+
strictValidation?: boolean;
|
|
6672
|
+
};
|
|
6649
6673
|
}
|
|
6650
6674
|
|
|
6651
6675
|
}
|
|
6652
6676
|
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
6653
6677
|
/**
|
|
6678
|
+
* Runtime projection of one canonical KHR_interactivity graph.
|
|
6679
|
+
*/
|
|
6680
|
+
export interface IKHRInteractivityGraphImportResult {
|
|
6681
|
+
/** Canonical source graph and diagnostics. */
|
|
6682
|
+
graph: BABYLON.GLTF2.Loader.Extensions.IKHRInteractivityGraphModel;
|
|
6683
|
+
/** Executable FlowGraph serialization when lowering succeeded. */
|
|
6684
|
+
serializedFlowGraph?: ISerializedFlowGraph;
|
|
6685
|
+
/** Runtime FlowGraph when runtime construction was requested. */
|
|
6686
|
+
flowGraph?: FlowGraph;
|
|
6687
|
+
/** Coordinator that owns the runtime FlowGraph. */
|
|
6688
|
+
coordinator?: FlowGraphCoordinator;
|
|
6689
|
+
/** Additional lowering/runtime diagnostics. */
|
|
6690
|
+
diagnostics: BABYLON.GLTF2.Loader.Extensions.IKHRInteractivityDiagnostic[];
|
|
6691
|
+
}
|
|
6692
|
+
/**
|
|
6693
|
+
* Completed KHR_interactivity import result associated with a loaded scene.
|
|
6694
|
+
*/
|
|
6695
|
+
export interface IKHRInteractivityImportResult {
|
|
6696
|
+
/** Stable zero-based identity of this interactivity asset among assets appended to the scene. */
|
|
6697
|
+
assetIndex: number;
|
|
6698
|
+
/** Canonical, lossless source document. */
|
|
6699
|
+
document: BABYLON.GLTF2.Loader.Extensions.IKHRInteractivityDocument;
|
|
6700
|
+
/** Graph import results in source order. */
|
|
6701
|
+
graphs: IKHRInteractivityGraphImportResult[];
|
|
6702
|
+
/** Shared path converter required by pointer blocks. */
|
|
6703
|
+
pathConverter: BABYLON.GLTF2.Loader.Extensions.CompositePathToObjectConverter<IObjectAccessor>;
|
|
6704
|
+
/** Live glTF loader data used by glTF data-provider blocks. */
|
|
6705
|
+
glTF: BABYLON.GLTF2.GLTFLoader["gltf"];
|
|
6706
|
+
/** Host resolver that supplies KHR reference semantics to executable graphs. */
|
|
6707
|
+
hostResolver: BABYLON.GLTF2.Loader.Extensions.InteractivityHostResolver;
|
|
6708
|
+
}
|
|
6709
|
+
/**
|
|
6710
|
+
* Gets the completed KHR_interactivity import result for a loaded scene.
|
|
6711
|
+
* @param scene scene loaded from the glTF asset
|
|
6712
|
+
* @returns the import result, or undefined when the scene has no KHR_interactivity data
|
|
6713
|
+
*/
|
|
6714
|
+
export function GetKHRInteractivityImportResult(scene: Scene): IKHRInteractivityImportResult | undefined;
|
|
6715
|
+
/**
|
|
6716
|
+
* Gets every completed KHR_interactivity import result appended to a loaded scene.
|
|
6717
|
+
* Results remain in asset load order and each result has a stable {@link IKHRInteractivityImportResult.assetIndex}.
|
|
6718
|
+
* @param scene scene containing the loaded glTF assets
|
|
6719
|
+
* @returns the scene's import results, or an empty array when it has no KHR_interactivity data
|
|
6720
|
+
*/
|
|
6721
|
+
export function GetKHRInteractivityImportResults(scene: Scene): readonly IKHRInteractivityImportResult[];
|
|
6722
|
+
/**
|
|
6654
6723
|
* Loader extension for KHR_interactivity
|
|
6655
6724
|
*/
|
|
6656
6725
|
export class KHR_interactivity implements BABYLON.GLTF2.IGLTFLoaderExtension {
|
|
@@ -6659,6 +6728,8 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
6659
6728
|
* The name of this extension.
|
|
6660
6729
|
*/
|
|
6661
6730
|
readonly name = "KHR_interactivity";
|
|
6731
|
+
/** Runs after extensions that contribute interactivity operations and object state. */
|
|
6732
|
+
readonly order = 200;
|
|
6662
6733
|
/**
|
|
6663
6734
|
* Defines whether this extension is enabled.
|
|
6664
6735
|
*/
|
|
@@ -6670,6 +6741,7 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
6670
6741
|
* @param _loader
|
|
6671
6742
|
*/
|
|
6672
6743
|
constructor(_loader: BABYLON.GLTF2.GLTFLoader);
|
|
6744
|
+
private _initializePathConverter;
|
|
6673
6745
|
dispose(): void;
|
|
6674
6746
|
onReady(): Promise<void>;
|
|
6675
6747
|
}
|
|
@@ -6677,7 +6749,7 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
6677
6749
|
* @internal
|
|
6678
6750
|
* populates the object model with the interactivity extension
|
|
6679
6751
|
*/
|
|
6680
|
-
export function _AddInteractivityObjectModel(scene: Scene): void;
|
|
6752
|
+
export function _AddInteractivityObjectModel(scene: Scene, targetFps: number, mapping: object): void;
|
|
6681
6753
|
/**
|
|
6682
6754
|
* @internal
|
|
6683
6755
|
* Registers KHR_interactivity runtime dependencies without changing the extension registry.
|
|
@@ -7549,6 +7621,37 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7549
7621
|
|
|
7550
7622
|
|
|
7551
7623
|
|
|
7624
|
+
}
|
|
7625
|
+
declare namespace BABYLON {
|
|
7626
|
+
|
|
7627
|
+
|
|
7628
|
+
}
|
|
7629
|
+
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
7630
|
+
type InteractivityNodeState = "hoverable" | "selectable";
|
|
7631
|
+
/**
|
|
7632
|
+
* Initializes authored and inherited selectability or hoverability state.
|
|
7633
|
+
* @param nodes all nodes in the glTF asset
|
|
7634
|
+
* @param state state kind to initialize
|
|
7635
|
+
* @param getAuthoredState reads the extension-authored local state
|
|
7636
|
+
*/
|
|
7637
|
+
export function InitializeInteractivityNodeState(nodes: readonly BABYLON.GLTF2.Loader.INode[], state: InteractivityNodeState, getAuthoredState: (node: BABYLON.GLTF2.Loader.INode) => boolean | undefined): void;
|
|
7638
|
+
/**
|
|
7639
|
+
* Gets the locally authored runtime state for a node.
|
|
7640
|
+
* @param node glTF node
|
|
7641
|
+
* @param state state kind
|
|
7642
|
+
* @returns local state, defaulting to true
|
|
7643
|
+
*/
|
|
7644
|
+
export function GetInteractivityNodeState(node: BABYLON.GLTF2.Loader.INode, state: InteractivityNodeState): boolean;
|
|
7645
|
+
/**
|
|
7646
|
+
* Updates local state and reapplies inherited state to the affected subtree.
|
|
7647
|
+
* @param node glTF node
|
|
7648
|
+
* @param state state kind
|
|
7649
|
+
* @param value new local state
|
|
7650
|
+
*/
|
|
7651
|
+
export function SetInteractivityNodeState(node: BABYLON.GLTF2.Loader.INode, state: InteractivityNodeState, value: boolean): void;
|
|
7652
|
+
|
|
7653
|
+
|
|
7654
|
+
|
|
7552
7655
|
}
|
|
7553
7656
|
declare namespace BABYLON {
|
|
7554
7657
|
|
|
@@ -7574,9 +7677,10 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7574
7677
|
decodeEventReference(reference: string): string | undefined;
|
|
7575
7678
|
/**
|
|
7576
7679
|
* @param reference the reference to decode
|
|
7680
|
+
* @param collection optional glTF root collection the reference must address
|
|
7577
7681
|
* @returns the index the reference denotes, or `undefined` when it is not an indexed JSON Pointer
|
|
7578
7682
|
*/
|
|
7579
|
-
decodeIndexReference(reference: string): number | undefined;
|
|
7683
|
+
decodeIndexReference(reference: string, collection?: string): number | undefined;
|
|
7580
7684
|
/**
|
|
7581
7685
|
* Maps a Babylon object loaded from the glTF back to a JSON Pointer addressing it.
|
|
7582
7686
|
*
|
|
@@ -7621,13 +7725,6 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7621
7725
|
value?: any;
|
|
7622
7726
|
}[];
|
|
7623
7727
|
}
|
|
7624
|
-
export var gltfTypeToBabylonType: {
|
|
7625
|
-
[key: string]: {
|
|
7626
|
-
length: number;
|
|
7627
|
-
flowGraphType: FlowGraphTypes;
|
|
7628
|
-
elementType: "number" | "boolean" | "string";
|
|
7629
|
-
};
|
|
7630
|
-
};
|
|
7631
7728
|
/**
|
|
7632
7729
|
* Parses a KHR_interactivity graph definition (the raw glTF JSON object) into
|
|
7633
7730
|
* the serialized FlowGraph form consumed by {@link ParseFlowGraphAsync}.
|
|
@@ -7637,9 +7734,11 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7637
7734
|
* {@link serializeToFlowGraph}.
|
|
7638
7735
|
*/
|
|
7639
7736
|
export class InteractivityGraphToFlowGraphParser {
|
|
7640
|
-
private _interactivityGraph;
|
|
7641
7737
|
private _gltf;
|
|
7642
7738
|
_animationTargetFps: number;
|
|
7739
|
+
private _graphIndex;
|
|
7740
|
+
private _supportedExtensions?;
|
|
7741
|
+
private _declarationModels?;
|
|
7643
7742
|
/**
|
|
7644
7743
|
* Note - the graph should be rejected if the same type is defined twice.
|
|
7645
7744
|
* We currently don't validate that.
|
|
@@ -7657,16 +7756,22 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7657
7756
|
* the last block) is not disturbed, then concatenated into the serialized graph.
|
|
7658
7757
|
*/
|
|
7659
7758
|
private _insertedBlocks;
|
|
7660
|
-
constructor(
|
|
7759
|
+
constructor(interactivityGraph: BABYLON.GLTF2.IKHRInteractivity_Graph, _gltf: BABYLON.GLTF2.Loader.IGLTF, _animationTargetFps?: number, _graphIndex?: number, _supportedExtensions?: ReadonlySet<string> | undefined, _declarationModels?: readonly BABYLON.GLTF2.Loader.Extensions.IKHRInteractivityDeclarationModel[] | undefined);
|
|
7760
|
+
private _interactivityGraph;
|
|
7761
|
+
private get _strictValidation();
|
|
7762
|
+
private _hasDefaultFlowInput;
|
|
7763
|
+
private _getAllowedDynamicValueSockets;
|
|
7764
|
+
private _getAllowedDynamicFlowSockets;
|
|
7661
7765
|
get arrays(): {
|
|
7662
7766
|
types: {
|
|
7663
7767
|
length: number;
|
|
7664
7768
|
flowGraphType: FlowGraphTypes;
|
|
7665
|
-
elementType: "number" | "boolean" | "string";
|
|
7769
|
+
elementType: "number" | "boolean" | "string" | "any";
|
|
7666
7770
|
}[];
|
|
7667
7771
|
mappings: {
|
|
7668
7772
|
flowGraphMapping: BABYLON.GLTF2.Loader.Extensions.IGLTFToFlowGraphMapping;
|
|
7669
7773
|
fullOperationName: string;
|
|
7774
|
+
declaration: BABYLON.GLTF2.Loader.Extensions.IKHRInteractivityDeclarationModel;
|
|
7670
7775
|
}[];
|
|
7671
7776
|
staticVariables: {
|
|
7672
7777
|
type: FlowGraphTypes;
|
|
@@ -7682,12 +7787,15 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7682
7787
|
private _parseDeclarations;
|
|
7683
7788
|
private _parseVariables;
|
|
7684
7789
|
private _parseVariable;
|
|
7790
|
+
private _normalizeStaticReference;
|
|
7685
7791
|
private _parseEvents;
|
|
7686
7792
|
private _parseNodes;
|
|
7687
7793
|
private _getEmptyBlock;
|
|
7794
|
+
private _createUnsupportedExtensionBlock;
|
|
7688
7795
|
private _parseNodeConfiguration;
|
|
7689
7796
|
private _parseNodeConnections;
|
|
7690
7797
|
private _createNewSocketConnection;
|
|
7798
|
+
private _isUnsupportedExtensionBlock;
|
|
7691
7799
|
/**
|
|
7692
7800
|
* Wires an upstream data output into a downstream data input through a runtime multiply block that
|
|
7693
7801
|
* scales the value by the animation target fps. This converts a KHR animation time (seconds),
|
|
@@ -7697,6 +7805,8 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7697
7805
|
* @param context the serialized flow graph context that stores literal socket values
|
|
7698
7806
|
* @param upstreamOutput the data output socket providing the time value (in seconds)
|
|
7699
7807
|
* @param downstreamInput the data input socket that expects the time in frames
|
|
7808
|
+
* @param nodeIndex source node receiving the converted value
|
|
7809
|
+
* @param declarationIndex source declaration used by the receiving node
|
|
7700
7810
|
*/
|
|
7701
7811
|
private _connectWithSecondsToFramesConversion;
|
|
7702
7812
|
private _connectFlowGraphNodes;
|
|
@@ -7718,6 +7828,125 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7718
7828
|
|
|
7719
7829
|
|
|
7720
7830
|
|
|
7831
|
+
}
|
|
7832
|
+
declare namespace BABYLON {
|
|
7833
|
+
|
|
7834
|
+
|
|
7835
|
+
}
|
|
7836
|
+
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
7837
|
+
/**
|
|
7838
|
+
* Ratified KHR_interactivity specification baseline used by this importer.
|
|
7839
|
+
*/
|
|
7840
|
+
export const KHR_INTERACTIVITY_SPECIFICATION_COMMIT = "f798712c5685bc9223a628140fba707db8889300";
|
|
7841
|
+
/**
|
|
7842
|
+
* Runtime representation of every ratified built-in KHR_interactivity type.
|
|
7843
|
+
*/
|
|
7844
|
+
export var gltfTypeToBabylonType: {
|
|
7845
|
+
[key: string]: {
|
|
7846
|
+
length: number;
|
|
7847
|
+
flowGraphType: FlowGraphTypes;
|
|
7848
|
+
elementType: "number" | "boolean" | "string" | "any";
|
|
7849
|
+
};
|
|
7850
|
+
};
|
|
7851
|
+
/**
|
|
7852
|
+
* Classification of a KHR_interactivity declaration.
|
|
7853
|
+
*/
|
|
7854
|
+
export type KHRInteractivityDeclarationSupport = "core" | "extension" | "unsupported-extension" | "unknown-core";
|
|
7855
|
+
/**
|
|
7856
|
+
* A structured KHR_interactivity import diagnostic.
|
|
7857
|
+
*/
|
|
7858
|
+
export interface IKHRInteractivityDiagnostic {
|
|
7859
|
+
/** JSON pointer identifying the source location. */
|
|
7860
|
+
path: string;
|
|
7861
|
+
/** Human-readable diagnostic text. */
|
|
7862
|
+
message: string;
|
|
7863
|
+
/** Diagnostic severity. */
|
|
7864
|
+
severity: "error" | "warning";
|
|
7865
|
+
}
|
|
7866
|
+
/**
|
|
7867
|
+
* Canonical declaration information retained during import.
|
|
7868
|
+
*/
|
|
7869
|
+
export interface IKHRInteractivityDeclarationModel {
|
|
7870
|
+
/** Declaration index in the source graph. */
|
|
7871
|
+
index: number;
|
|
7872
|
+
/** Full operation name, including the defining extension when present. */
|
|
7873
|
+
operation: string;
|
|
7874
|
+
/** Whether Babylon can execute the declaration. */
|
|
7875
|
+
support: KHRInteractivityDeclarationSupport;
|
|
7876
|
+
/** Exact source declaration. */
|
|
7877
|
+
source: BABYLON.GLTF2.IKHRInteractivity_Declaration;
|
|
7878
|
+
}
|
|
7879
|
+
/**
|
|
7880
|
+
* Canonical graph information retained during import.
|
|
7881
|
+
*/
|
|
7882
|
+
export interface IKHRInteractivityGraphModel {
|
|
7883
|
+
/** Graph index in the root extension. */
|
|
7884
|
+
index: number;
|
|
7885
|
+
/** Stable source path. */
|
|
7886
|
+
path: string;
|
|
7887
|
+
/** Human-readable graph name. */
|
|
7888
|
+
name: string;
|
|
7889
|
+
/** Exact source graph, including extension and extras payloads. */
|
|
7890
|
+
source: BABYLON.GLTF2.IKHRInteractivity_Graph;
|
|
7891
|
+
/** Executable graph with specification defaults and fallbacks applied. */
|
|
7892
|
+
effectiveSource: BABYLON.GLTF2.IKHRInteractivity_Graph;
|
|
7893
|
+
/** Canonical declarations in source order. */
|
|
7894
|
+
declarations: IKHRInteractivityDeclarationModel[];
|
|
7895
|
+
/** Validation diagnostics for this graph. */
|
|
7896
|
+
diagnostics: IKHRInteractivityDiagnostic[];
|
|
7897
|
+
/** Whether this graph is valid and can be lowered to FlowGraph. */
|
|
7898
|
+
valid: boolean;
|
|
7899
|
+
}
|
|
7900
|
+
/**
|
|
7901
|
+
* Lossless canonical representation of a KHR_interactivity root extension.
|
|
7902
|
+
*/
|
|
7903
|
+
export interface IKHRInteractivityDocument {
|
|
7904
|
+
/** Ratified specification revision used for validation. */
|
|
7905
|
+
specificationCommit: string;
|
|
7906
|
+
/** Exact source extension, including unknown extensions and extras. */
|
|
7907
|
+
source: BABYLON.GLTF2.IKHRInteractivity;
|
|
7908
|
+
/** Default graph index, or -1 when the source selection is invalid. */
|
|
7909
|
+
defaultGraphIndex: number;
|
|
7910
|
+
/** Canonical graph models in source order. */
|
|
7911
|
+
graphs: IKHRInteractivityGraphModel[];
|
|
7912
|
+
/** Root-level validation diagnostics. */
|
|
7913
|
+
diagnostics: IKHRInteractivityDiagnostic[];
|
|
7914
|
+
}
|
|
7915
|
+
/**
|
|
7916
|
+
* Creates a detached JSON copy of a KHR_interactivity graph.
|
|
7917
|
+
* @param graph source graph
|
|
7918
|
+
* @returns a lossless JSON copy
|
|
7919
|
+
*/
|
|
7920
|
+
export function CloneKHRInteractivityGraph(graph: BABYLON.GLTF2.IKHRInteractivity_Graph): BABYLON.GLTF2.IKHRInteractivity_Graph;
|
|
7921
|
+
/**
|
|
7922
|
+
* Creates the executable graph view with all ratified configuration defaults and fallback rules
|
|
7923
|
+
* applied without modifying the lossless source graph.
|
|
7924
|
+
* @param graph source graph
|
|
7925
|
+
* @param declarations canonical declarations
|
|
7926
|
+
* @param assetNodeCount number of glTF nodes in the containing asset
|
|
7927
|
+
* @returns normalized executable graph
|
|
7928
|
+
*/
|
|
7929
|
+
export function CreateEffectiveKHRInteractivityGraph(graph: BABYLON.GLTF2.IKHRInteractivity_Graph, declarations: readonly IKHRInteractivityDeclarationModel[], assetNodeCount?: number): BABYLON.GLTF2.IKHRInteractivity_Graph;
|
|
7930
|
+
/**
|
|
7931
|
+
* Creates and validates a canonical copy of one KHR_interactivity graph.
|
|
7932
|
+
* @param graph source graph
|
|
7933
|
+
* @param index graph index in the root extension
|
|
7934
|
+
* @param supportedExtensions enabled extensions that may provide executable operations
|
|
7935
|
+
* @param assetNodeCount number of nodes in the containing glTF asset
|
|
7936
|
+
* @returns the canonical graph model
|
|
7937
|
+
*/
|
|
7938
|
+
export function CreateKHRInteractivityGraphModel(graph: BABYLON.GLTF2.IKHRInteractivity_Graph | null | undefined, index?: number, supportedExtensions?: ReadonlySet<string>, assetNodeCount?: number): IKHRInteractivityGraphModel;
|
|
7939
|
+
/**
|
|
7940
|
+
* Creates an immutable canonical KHR_interactivity document and validates all graph-local references.
|
|
7941
|
+
* @param extension source extension object from the glTF document
|
|
7942
|
+
* @param supportedExtensions enabled extensions that may provide executable operations
|
|
7943
|
+
* @param assetNodeCount number of nodes in the containing glTF asset
|
|
7944
|
+
* @returns the canonical document
|
|
7945
|
+
*/
|
|
7946
|
+
export function CreateKHRInteractivityDocument(extension: BABYLON.GLTF2.IKHRInteractivity, supportedExtensions?: ReadonlySet<string>, assetNodeCount?: number): IKHRInteractivityDocument;
|
|
7947
|
+
|
|
7948
|
+
|
|
7949
|
+
|
|
7721
7950
|
}
|
|
7722
7951
|
declare namespace BABYLON {
|
|
7723
7952
|
|
|
@@ -7727,6 +7956,82 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7727
7956
|
|
|
7728
7957
|
|
|
7729
7958
|
|
|
7959
|
+
}
|
|
7960
|
+
declare namespace BABYLON {
|
|
7961
|
+
|
|
7962
|
+
|
|
7963
|
+
}
|
|
7964
|
+
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
7965
|
+
/**
|
|
7966
|
+
* Socket definition retained for an unsupported extension operation.
|
|
7967
|
+
*/
|
|
7968
|
+
export interface IFlowGraphUnsupportedInteractivitySocket {
|
|
7969
|
+
/** Socket name. */
|
|
7970
|
+
name: string;
|
|
7971
|
+
/** FlowGraph runtime type name. */
|
|
7972
|
+
type?: string;
|
|
7973
|
+
/** Exact KHR_interactivity type signature. */
|
|
7974
|
+
signature?: string;
|
|
7975
|
+
}
|
|
7976
|
+
/**
|
|
7977
|
+
* Configuration for an unsupported KHR_interactivity extension operation.
|
|
7978
|
+
*/
|
|
7979
|
+
export interface IFlowGraphUnsupportedInteractivityBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
7980
|
+
/** Full extension operation name. */
|
|
7981
|
+
operation: string;
|
|
7982
|
+
/** Input value sockets declared by the extension. */
|
|
7983
|
+
inputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];
|
|
7984
|
+
/** Output value sockets declared by the extension. */
|
|
7985
|
+
outputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];
|
|
7986
|
+
/** Input flow sockets used by the source graph. */
|
|
7987
|
+
inputFlowSockets: string[];
|
|
7988
|
+
/** Output flow sockets used by the source graph. */
|
|
7989
|
+
outputFlowSockets: string[];
|
|
7990
|
+
}
|
|
7991
|
+
/**
|
|
7992
|
+
* Inspectable runtime no-op for an operation owned by an unsupported glTF extension.
|
|
7993
|
+
*/
|
|
7994
|
+
export class FlowGraphUnsupportedInteractivityBlock extends FlowGraphExecutionBlock {
|
|
7995
|
+
config: IFlowGraphUnsupportedInteractivityBlockConfiguration;
|
|
7996
|
+
constructor(config: IFlowGraphUnsupportedInteractivityBlockConfiguration);
|
|
7997
|
+
/** @internal */
|
|
7998
|
+
_execute(_context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void;
|
|
7999
|
+
/** @returns the serialized class name */
|
|
8000
|
+
getClassName(): string;
|
|
8001
|
+
}
|
|
8002
|
+
|
|
8003
|
+
|
|
8004
|
+
|
|
8005
|
+
}
|
|
8006
|
+
declare namespace BABYLON {
|
|
8007
|
+
|
|
8008
|
+
|
|
8009
|
+
}
|
|
8010
|
+
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
8011
|
+
/**
|
|
8012
|
+
* Resolves a runtime object to its owning glTF node reference.
|
|
8013
|
+
* @param context active FlowGraph context
|
|
8014
|
+
* @param value runtime object, usually a picked primitive
|
|
8015
|
+
* @returns the owning node reference or the null reference
|
|
8016
|
+
*/
|
|
8017
|
+
export function GetInteractivityObjectReference(context: FlowGraphContext, value: object | undefined): string;
|
|
8018
|
+
/**
|
|
8019
|
+
* Converts a runtime object into the opaque reference used by KHR_interactivity.
|
|
8020
|
+
*/
|
|
8021
|
+
export class FlowGraphObjectReferenceBlock extends FlowGraphBlock {
|
|
8022
|
+
/** Runtime object to encode. */
|
|
8023
|
+
readonly object: FlowGraphDataConnection<object | undefined>;
|
|
8024
|
+
/** Opaque KHR_interactivity reference. */
|
|
8025
|
+
readonly value: FlowGraphDataConnection<string>;
|
|
8026
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
8027
|
+
/** @internal */
|
|
8028
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
8029
|
+
/** @returns the serialized class name */
|
|
8030
|
+
getClassName(): string;
|
|
8031
|
+
}
|
|
8032
|
+
|
|
8033
|
+
|
|
8034
|
+
|
|
7730
8035
|
}
|
|
7731
8036
|
declare namespace BABYLON {
|
|
7732
8037
|
|
|
@@ -7740,7 +8045,7 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7740
8045
|
/**
|
|
7741
8046
|
* the glTF object to provide data from
|
|
7742
8047
|
*/
|
|
7743
|
-
glTF
|
|
8048
|
+
glTF?: BABYLON.GLTF2.Loader.IGLTF;
|
|
7744
8049
|
}
|
|
7745
8050
|
/**
|
|
7746
8051
|
* a glTF-based FlowGraph block that provides arrays with babylon object, based on the glTF tree
|
|
@@ -7757,7 +8062,7 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7757
8062
|
* Corresponds directly to the glTF nodes array
|
|
7758
8063
|
*/
|
|
7759
8064
|
readonly nodes: FlowGraphDataConnection<TransformNode[]>;
|
|
7760
|
-
constructor(config
|
|
8065
|
+
constructor(config?: IFlowGraphGLTFDataProviderBlockConfiguration);
|
|
7761
8066
|
getClassName(): string;
|
|
7762
8067
|
}
|
|
7763
8068
|
|
|
@@ -7769,11 +8074,71 @@ declare namespace BABYLON {
|
|
|
7769
8074
|
|
|
7770
8075
|
}
|
|
7771
8076
|
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
7772
|
-
|
|
8077
|
+
/**
|
|
8078
|
+
* Configuration for a KHR event reference output.
|
|
8079
|
+
*/
|
|
8080
|
+
export interface IFlowGraphEventReferenceBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
8081
|
+
/** Stable key shared by equivalent event operations. */
|
|
8082
|
+
eventKey?: string;
|
|
8083
|
+
}
|
|
8084
|
+
/**
|
|
8085
|
+
* Produces the opaque reference associated with a KHR event operation.
|
|
8086
|
+
*/
|
|
8087
|
+
export class FlowGraphEventReferenceBlock extends FlowGraphExecutionBlock {
|
|
8088
|
+
config: IFlowGraphEventReferenceBlockConfiguration;
|
|
8089
|
+
private readonly _assetInverse;
|
|
8090
|
+
private readonly _selectionPointValue;
|
|
8091
|
+
private readonly _selectionRayOriginValue;
|
|
8092
|
+
/** Output flow activated after event values are captured. */
|
|
8093
|
+
readonly out: FlowGraphSignalConnection;
|
|
8094
|
+
/** Runtime node associated with the event. */
|
|
8095
|
+
readonly node: FlowGraphDataConnection<object | undefined>;
|
|
8096
|
+
/** Controller index associated with the event. */
|
|
8097
|
+
readonly controllerIndexInput: FlowGraphDataConnection<number>;
|
|
8098
|
+
/** Selection point associated with the event. */
|
|
8099
|
+
readonly selectionPointInput: FlowGraphDataConnection<Vector3>;
|
|
8100
|
+
/** Selection ray origin associated with the event. */
|
|
8101
|
+
readonly selectionRayOriginInput: FlowGraphDataConnection<Vector3>;
|
|
8102
|
+
/** Opaque node reference. */
|
|
8103
|
+
readonly nodeReference: FlowGraphDataConnection<string>;
|
|
8104
|
+
/** Retained controller index. */
|
|
8105
|
+
readonly controllerIndex: FlowGraphDataConnection<number>;
|
|
8106
|
+
/** Retained selection point. */
|
|
8107
|
+
readonly selectionPoint: FlowGraphDataConnection<Vector3>;
|
|
8108
|
+
/** Retained selection ray origin. */
|
|
8109
|
+
readonly selectionRayOrigin: FlowGraphDataConnection<Vector3>;
|
|
8110
|
+
/** Opaque event reference. */
|
|
8111
|
+
readonly value: FlowGraphDataConnection<string>;
|
|
8112
|
+
constructor(config: IFlowGraphEventReferenceBlockConfiguration);
|
|
8113
|
+
/** @internal */
|
|
8114
|
+
_execute(context: FlowGraphContext): void;
|
|
8115
|
+
/** @returns the serialized class name */
|
|
8116
|
+
getClassName(): string;
|
|
8117
|
+
}
|
|
8118
|
+
|
|
8119
|
+
|
|
8120
|
+
|
|
8121
|
+
}
|
|
8122
|
+
declare namespace BABYLON {
|
|
8123
|
+
|
|
8124
|
+
|
|
8125
|
+
}
|
|
8126
|
+
declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
8127
|
+
/**
|
|
8128
|
+
* Describes how one KHR_interactivity configuration or socket property maps to FlowGraph.
|
|
8129
|
+
*
|
|
8130
|
+
* The same contract is used for fixed sockets, wildcard sockets, configuration validation,
|
|
8131
|
+
* defaulting, and multi-block routing during strict graph lowering.
|
|
8132
|
+
*/
|
|
8133
|
+
export interface IGLTFToFlowGraphMappingObject {
|
|
7773
8134
|
/**
|
|
7774
8135
|
* The name of the property in the FlowGraph block.
|
|
7775
8136
|
*/
|
|
7776
8137
|
name: string;
|
|
8138
|
+
/**
|
|
8139
|
+
* Whether this socket mapping exists only for pre-ratification compatibility input.
|
|
8140
|
+
*/
|
|
8141
|
+
compatibilityOnly?: boolean;
|
|
7777
8142
|
/**
|
|
7778
8143
|
* The type of the property in the glTF specs.
|
|
7779
8144
|
* If not provided will be inferred.
|
|
@@ -7806,7 +8171,7 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7806
8171
|
* This is used if we generate more than one block for a single glTF node.
|
|
7807
8172
|
* Defaults to the first block in the mapping.
|
|
7808
8173
|
*/
|
|
7809
|
-
toBlock?: FlowGraphBlockNames;
|
|
8174
|
+
toBlock?: FlowGraphBlockNames | string;
|
|
7810
8175
|
/**
|
|
7811
8176
|
* Used in configuration values. If defined, this will be the default value, if no value is provided.
|
|
7812
8177
|
*/
|
|
@@ -7820,6 +8185,75 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7820
8185
|
* be fed by a `pointer/get` (e.g. the read-only `maxTime` animation pointer).
|
|
7821
8186
|
*/
|
|
7822
8187
|
convertConnectedTimeToFrames?: boolean;
|
|
8188
|
+
/**
|
|
8189
|
+
* KHR configuration value type used by canonical validation.
|
|
8190
|
+
*/
|
|
8191
|
+
configurationType?: "bool" | "int" | "int[]" | "string";
|
|
8192
|
+
/**
|
|
8193
|
+
* Whether this configuration entry exists only for canonical validation.
|
|
8194
|
+
*/
|
|
8195
|
+
validationOnly?: boolean;
|
|
8196
|
+
/**
|
|
8197
|
+
* Whether an operation without a complete default configuration requires this property.
|
|
8198
|
+
*/
|
|
8199
|
+
required?: boolean;
|
|
8200
|
+
/**
|
|
8201
|
+
* Graph array referenced by an integer configuration value.
|
|
8202
|
+
*/
|
|
8203
|
+
indexSource?: "types" | "variables" | "events" | "nodes" | "assetNodes";
|
|
8204
|
+
/**
|
|
8205
|
+
* Minimum number of values required for an array configuration.
|
|
8206
|
+
*/
|
|
8207
|
+
minItems?: number;
|
|
8208
|
+
/**
|
|
8209
|
+
* Whether the configured indices generate required input value sockets.
|
|
8210
|
+
*/
|
|
8211
|
+
generatesInputValueSockets?: boolean;
|
|
8212
|
+
/**
|
|
8213
|
+
* Whether integer case values generate required input value sockets.
|
|
8214
|
+
*/
|
|
8215
|
+
generatesCaseInputValueSockets?: boolean;
|
|
8216
|
+
/**
|
|
8217
|
+
* Whether this string configuration generates JSON Pointer Template sockets.
|
|
8218
|
+
*/
|
|
8219
|
+
pointerTemplate?: boolean;
|
|
8220
|
+
/**
|
|
8221
|
+
* Whether an invalid value falls back to the operation's default configuration.
|
|
8222
|
+
*/
|
|
8223
|
+
invalidUsesDefault?: boolean;
|
|
8224
|
+
/**
|
|
8225
|
+
* Allowed KHR type signatures for a type-index configuration.
|
|
8226
|
+
*/
|
|
8227
|
+
allowedSignatures?: readonly ("bool" | "float" | "float2" | "float3" | "float4" | "float2x2" | "float3x3" | "float4x4" | "int" | "ref" | "custom")[];
|
|
8228
|
+
/**
|
|
8229
|
+
* Input socket whose effective type determines this output socket type.
|
|
8230
|
+
*/
|
|
8231
|
+
typeSourceInput?: string;
|
|
8232
|
+
/** Inclusive minimum for an integer configuration value. */
|
|
8233
|
+
minimum?: number;
|
|
8234
|
+
/** Inclusive maximum for an integer configuration value. */
|
|
8235
|
+
maximum?: number;
|
|
8236
|
+
/**
|
|
8237
|
+
* Whether this configuration value generates numbered input flow sockets.
|
|
8238
|
+
*/
|
|
8239
|
+
generatesInputFlowSockets?: boolean;
|
|
8240
|
+
/**
|
|
8241
|
+
* Whether this configuration array generates output flow sockets.
|
|
8242
|
+
*/
|
|
8243
|
+
generatesOutputFlowSockets?: boolean;
|
|
8244
|
+
/**
|
|
8245
|
+
* Properties in the same group fall back to their defaults together when any member is
|
|
8246
|
+
* missing or invalid.
|
|
8247
|
+
*/
|
|
8248
|
+
configurationGroup?: string;
|
|
8249
|
+
/**
|
|
8250
|
+
* Whether duplicate array values are removed from the effective configuration.
|
|
8251
|
+
*/
|
|
8252
|
+
uniqueValues?: boolean;
|
|
8253
|
+
/**
|
|
8254
|
+
* Whether a string configuration value is a `debug/log` message template.
|
|
8255
|
+
*/
|
|
8256
|
+
debugLogTemplate?: boolean;
|
|
7823
8257
|
}
|
|
7824
8258
|
/**
|
|
7825
8259
|
* Description of how a KHR_interactivity declaration (op such as
|
|
@@ -7834,6 +8268,13 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7834
8268
|
* When adding blocks defined in this module use the KHR_interactivity prefix.
|
|
7835
8269
|
*/
|
|
7836
8270
|
blocks: (FlowGraphBlockNames | string)[];
|
|
8271
|
+
/**
|
|
8272
|
+
* Exact value socket contract for an operation supplied by another extension.
|
|
8273
|
+
*/
|
|
8274
|
+
declarationSchema?: {
|
|
8275
|
+
inputValueSockets: Record<string, "bool" | "float" | "float2" | "float3" | "float4" | "float2x2" | "float3x3" | "float4x4" | "int" | "ref" | "custom">;
|
|
8276
|
+
outputValueSockets: Record<string, "bool" | "float" | "float2" | "float3" | "float4" | "float2x2" | "float3x3" | "float4x4" | "int" | "ref" | "custom">;
|
|
8277
|
+
};
|
|
7837
8278
|
/**
|
|
7838
8279
|
* The inputs of the glTF node mapped to the FlowGraph block.
|
|
7839
8280
|
*/
|
|
@@ -7942,6 +8383,12 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7942
8383
|
}
|
|
7943
8384
|
export function getMappingForFullOperationName(fullOperationName: string): IGLTFToFlowGraphMapping | undefined;
|
|
7944
8385
|
export function getMappingForDeclaration(declaration: BABYLON.GLTF2.IKHRInteractivity_Declaration, returnNoOpIfNotAvailable?: boolean): IGLTFToFlowGraphMapping | undefined;
|
|
8386
|
+
/**
|
|
8387
|
+
* Creates the typed no-op mapping required for an unsupported extension declaration.
|
|
8388
|
+
* @param declaration unsupported extension declaration
|
|
8389
|
+
* @returns a mapping that preserves the declared value sockets
|
|
8390
|
+
*/
|
|
8391
|
+
export function getNoOpMappingForDeclaration(declaration: BABYLON.GLTF2.IKHRInteractivity_Declaration): IGLTFToFlowGraphMapping;
|
|
7945
8392
|
/**
|
|
7946
8393
|
* This function will add new mapping to glTF interactivity.
|
|
7947
8394
|
* Other extensions can define new types of blocks, this is the way to let interactivity know how to parse them.
|
|
@@ -7950,6 +8397,22 @@ declare namespace BABYLON.GLTF2.Loader.Extensions {
|
|
|
7950
8397
|
* @param mapping The mapping object. See documentation or examples below.
|
|
7951
8398
|
*/
|
|
7952
8399
|
export function addNewInteractivityFlowGraphMapping(key: string, extension: string, mapping: IGLTFToFlowGraphMapping): void;
|
|
8400
|
+
/**
|
|
8401
|
+
* Result of parsing a ratified `debug/log` message template.
|
|
8402
|
+
*/
|
|
8403
|
+
export interface IDebugLogTemplateParseResult {
|
|
8404
|
+
/** Whether all literal braces are doubled and every parameter is well formed. */
|
|
8405
|
+
valid: boolean;
|
|
8406
|
+
/** Unique parameter socket ids in first-occurrence order. */
|
|
8407
|
+
sockets: string[];
|
|
8408
|
+
}
|
|
8409
|
+
/**
|
|
8410
|
+
* Parses a ratified `debug/log` message template.
|
|
8411
|
+
* Literal braces must be doubled; non-empty text inside a single brace pair defines a socket id.
|
|
8412
|
+
* @param message message template to parse
|
|
8413
|
+
* @returns template validity and its exact dynamic socket ids
|
|
8414
|
+
*/
|
|
8415
|
+
export function ParseDebugLogTemplate(message: string): IDebugLogTemplateParseResult;
|
|
7953
8416
|
export function getAllSupportedNativeNodeTypes(): string[];
|
|
7954
8417
|
/**
|
|
7955
8418
|
*
|
|
@@ -9207,7 +9670,7 @@ declare namespace BABYLON {
|
|
|
9207
9670
|
|
|
9208
9671
|
|
|
9209
9672
|
export const COMMAND_MAGIC = 1111774037;
|
|
9210
|
-
export const PROTOCOL_VERSION =
|
|
9673
|
+
export const PROTOCOL_VERSION = 5;
|
|
9211
9674
|
export const MISSING_OFFSET = 4294967295;
|
|
9212
9675
|
export enum Command {
|
|
9213
9676
|
Scene = 1,
|
|
@@ -9219,7 +9682,9 @@ declare namespace BABYLON {
|
|
|
9219
9682
|
Mesh = 7,
|
|
9220
9683
|
Instance = 8,
|
|
9221
9684
|
Animation = 9,
|
|
9222
|
-
AnalyticPrimitive = 10
|
|
9685
|
+
AnalyticPrimitive = 10,
|
|
9686
|
+
ThinInstances = 11,
|
|
9687
|
+
MorphTarget = 12
|
|
9223
9688
|
}
|
|
9224
9689
|
export enum AnalyticPrimitiveType {
|
|
9225
9690
|
Cube = 0,
|
|
@@ -9234,19 +9699,33 @@ declare namespace BABYLON {
|
|
|
9234
9699
|
}
|
|
9235
9700
|
export enum AnimationTarget {
|
|
9236
9701
|
Node = 0,
|
|
9237
|
-
Bone = 1
|
|
9702
|
+
Bone = 1,
|
|
9703
|
+
MorphTarget = 2
|
|
9238
9704
|
}
|
|
9239
9705
|
export enum AnimationProperty {
|
|
9240
9706
|
Position = 0,
|
|
9241
9707
|
RotationQuaternion = 1,
|
|
9242
9708
|
Scaling = 2,
|
|
9243
|
-
Matrix = 3
|
|
9709
|
+
Matrix = 3,
|
|
9710
|
+
Influence = 4
|
|
9244
9711
|
}
|
|
9245
9712
|
export enum MaterialFlags {
|
|
9246
9713
|
DoubleSided = 1,
|
|
9247
9714
|
Unlit = 2,
|
|
9248
9715
|
AlphaBlend = 4
|
|
9249
9716
|
}
|
|
9717
|
+
export enum TextureOutputChannel {
|
|
9718
|
+
R = 0,
|
|
9719
|
+
G = 1,
|
|
9720
|
+
B = 2,
|
|
9721
|
+
A = 3,
|
|
9722
|
+
RGB = 4
|
|
9723
|
+
}
|
|
9724
|
+
export enum USDTextureColorSpace {
|
|
9725
|
+
Auto = 0,
|
|
9726
|
+
Raw = 1,
|
|
9727
|
+
SRGB = 2
|
|
9728
|
+
}
|
|
9250
9729
|
export enum MeshFlags {
|
|
9251
9730
|
DoubleSided = 1,
|
|
9252
9731
|
LeftHanded = 2
|
|
@@ -10306,17 +10785,20 @@ declare namespace BABYLON {
|
|
|
10306
10785
|
/** Number of times a failed file download is retried before giving up. PlayCanvas default `2`. */
|
|
10307
10786
|
maxDownloadRetries?: number;
|
|
10308
10787
|
/**
|
|
10309
|
-
* GPU memory
|
|
10310
|
-
*
|
|
10311
|
-
*
|
|
10312
|
-
*
|
|
10313
|
-
*
|
|
10788
|
+
* Initial GPU/CPU memory estimate (in megabytes) for resident splats. It is converted to a splat count
|
|
10789
|
+
* using the per-splat cost (core data plus any baked SH and rotation/scale textures), combined with
|
|
10790
|
+
* {@link maxResidentSplats} by taking the smaller limit, then raised when necessary to fit the complete
|
|
10791
|
+
* coarse layer. The work buffer has a fixed lifetime capacity; construct a new stream to use another limit.
|
|
10792
|
+
* Finite non-positive values leave this limit unset; non-finite values are rejected.
|
|
10314
10793
|
*/
|
|
10315
10794
|
memoryBudgetMb?: number;
|
|
10316
10795
|
/**
|
|
10317
|
-
*
|
|
10318
|
-
*
|
|
10319
|
-
*
|
|
10796
|
+
* Initial maximum number of splats kept resident in the fixed-size work buffer. It is raised when necessary
|
|
10797
|
+
* to fit the complete coarse layer. When unset and the complete source size is known, streams retain the complete
|
|
10798
|
+
* source. Streams that defer finer metadata use a bounded device-tiered default with coarse-derived refinement
|
|
10799
|
+
* headroom.
|
|
10800
|
+
* Finite non-positive values leave this limit unset; non-finite or unsafe positive counts are rejected.
|
|
10801
|
+
* Positive fractional counts are floored to at least one splat before applying the coarse minimum.
|
|
10320
10802
|
*/
|
|
10321
10803
|
maxResidentSplats?: number;
|
|
10322
10804
|
/**
|
|
@@ -10346,10 +10828,10 @@ declare namespace BABYLON {
|
|
|
10346
10828
|
/**
|
|
10347
10829
|
* When true, higher-order spherical-harmonics carried by the SOG files (`shN`) are GPU-decoded into baked
|
|
10348
10830
|
* packed-u32 SH textures so the streamed splats render with view-dependent lighting (matching the non-stream
|
|
10349
|
-
* `.spz`/`.sog` path) instead of flat DC-only color.
|
|
10350
|
-
*
|
|
10351
|
-
*
|
|
10352
|
-
*
|
|
10831
|
+
* `.spz`/`.sog` path) instead of flat DC-only color. Streams with complete initial metadata use the maximum
|
|
10832
|
+
* source SH degree. Streams that defer finer metadata reserve the supported degree-4 layout before it is known,
|
|
10833
|
+
* even if the files ultimately carry no `shN`; lower-degree files neutral-fill the unused bands.
|
|
10834
|
+
* Defaults to `true`; set to `false` to force flat DC-only color and avoid the SH decode cost/texture memory.
|
|
10353
10835
|
*/
|
|
10354
10836
|
decodeSh?: boolean;
|
|
10355
10837
|
/**
|
|
@@ -10394,6 +10876,7 @@ declare namespace BABYLON {
|
|
|
10394
10876
|
private _hostBudgetAllocation;
|
|
10395
10877
|
private _frustumCulling;
|
|
10396
10878
|
private readonly _frustumPlanes;
|
|
10879
|
+
private readonly _cullCameraViewProj;
|
|
10397
10880
|
private readonly _cullViewProj;
|
|
10398
10881
|
private readonly _frustumScratch;
|
|
10399
10882
|
private _workBuffer;
|
|
@@ -10407,6 +10890,7 @@ declare namespace BABYLON {
|
|
|
10407
10890
|
private _residency;
|
|
10408
10891
|
private readonly _fileCounts;
|
|
10409
10892
|
private readonly _fileMeta;
|
|
10893
|
+
private readonly _baseFileIds;
|
|
10410
10894
|
private readonly _decodedFiles;
|
|
10411
10895
|
private readonly _loadingFiles;
|
|
10412
10896
|
private readonly _decodeQueue;
|
|
@@ -10414,6 +10898,7 @@ declare namespace BABYLON {
|
|
|
10414
10898
|
private readonly _cancelledDecodes;
|
|
10415
10899
|
private _evictionEnabled;
|
|
10416
10900
|
private _residentBudget;
|
|
10901
|
+
private _minimumResidentSplats;
|
|
10417
10902
|
private _maxResidentSplats;
|
|
10418
10903
|
private _memoryBudgetMb;
|
|
10419
10904
|
private _evictionCooldownFrames;
|
|
@@ -10425,6 +10910,7 @@ declare namespace BABYLON {
|
|
|
10425
10910
|
private _environmentFiles;
|
|
10426
10911
|
private _lodObserver;
|
|
10427
10912
|
private _baseLayerReady;
|
|
10913
|
+
private _metadataReady;
|
|
10428
10914
|
private _framesSinceLodUpdate;
|
|
10429
10915
|
private readonly _lastLodCamPositions;
|
|
10430
10916
|
private _lastLodSignature;
|
|
@@ -10547,10 +11033,19 @@ declare namespace BABYLON {
|
|
|
10547
11033
|
/**
|
|
10548
11034
|
* The resolved maximum number of splats kept resident in the work buffer. This combines
|
|
10549
11035
|
* {@link IGaussianSplattingStreamOptions.maxResidentSplats} and {@link IGaussianSplattingStreamOptions.memoryBudgetMb},
|
|
10550
|
-
* taking the smaller limit
|
|
11036
|
+
* taking the smaller positive limit and raising it to {@link minimumResidentSplats}. With neither limit set,
|
|
11037
|
+
* the complete source size is retained when known; otherwise a bounded device-tiered default is used.
|
|
11038
|
+
* The fixed capacity is capped at the device texture limit. `0` means initial capacity has not been resolved.
|
|
10551
11039
|
* @experimental
|
|
10552
11040
|
*/
|
|
10553
11041
|
get residentSplatBudget(): number;
|
|
11042
|
+
/**
|
|
11043
|
+
* Minimum fixed work-buffer capacity required for the complete coarse representation: one invisible padding
|
|
11044
|
+
* splat, the included environment, and every unique whole coarse source file. It is `0` until the required
|
|
11045
|
+
* coarse metadata has resolved. Initial residency options below this value are raised to it.
|
|
11046
|
+
* @experimental
|
|
11047
|
+
*/
|
|
11048
|
+
get minimumResidentSplats(): number;
|
|
10554
11049
|
/**
|
|
10555
11050
|
* The total number of splats represented by valid level-0 leaf entries. This remains pending while source
|
|
10556
11051
|
* metadata is loading and is unavailable when no applicable level-0 entries exist or required metadata fails.
|
|
@@ -10625,14 +11120,14 @@ declare namespace BABYLON {
|
|
|
10625
11120
|
set debugLodSource(value: GaussianSplattingStreamDebugLodSource);
|
|
10626
11121
|
dispose(doNotRecurse?: boolean): void;
|
|
10627
11122
|
/**
|
|
10628
|
-
* Disposes this stream
|
|
10629
|
-
*
|
|
11123
|
+
* Disposes this stream and, when hosted, compacts the host once to reclaim its tombstoned region's reserved
|
|
11124
|
+
* rows. Used on a definitive load failure / empty result — a discrete, one-off reclaim, versus a bare
|
|
10630
11125
|
* {@link dispose} that only tombstones so tearing down several parts doesn't rebuild the atlas repeatedly.
|
|
10631
11126
|
*/
|
|
10632
11127
|
private _disposeAndReclaim;
|
|
10633
11128
|
/**
|
|
10634
11129
|
* The world matrix that actually places this stream's splats, used to map the camera into the space the
|
|
10635
|
-
* node bounds live in (for LOD distance) and to build
|
|
11130
|
+
* node bounds live in (for LOD distance) and to build camera-local frusta (for frustum culling). Standalone:
|
|
10636
11131
|
* this controller mesh carries the transform. Hosted: this controller is a hidden, unplaced node — the splats
|
|
10637
11132
|
* are placed by the reserved part's proxy (SOG up-axis basis composed with the host's placement), so LOD and
|
|
10638
11133
|
* culling MUST use the proxy's world matrix or they compute distances/frustum tests in the wrong space
|
|
@@ -10700,9 +11195,9 @@ declare namespace BABYLON {
|
|
|
10700
11195
|
*/
|
|
10701
11196
|
private _collectLodEntries;
|
|
10702
11197
|
/**
|
|
10703
|
-
* Streams the scene
|
|
10704
|
-
*
|
|
10705
|
-
*
|
|
11198
|
+
* Streams the scene. Large streams fetch only required coarse metadata before allocating and decoding the
|
|
11199
|
+
* complete coarse layer; finer metadata starts afterwards so it cannot occupy the download queue ahead of
|
|
11200
|
+
* visible geometry. Small streams and streams containing only coarse files retain an exact all-file capacity upper bound.
|
|
10706
11201
|
*/
|
|
10707
11202
|
private _streamAllAsync;
|
|
10708
11203
|
/**
|
|
@@ -10715,26 +11210,47 @@ declare namespace BABYLON {
|
|
|
10715
11210
|
*/
|
|
10716
11211
|
private _waitForCanBackupAsync;
|
|
10717
11212
|
/**
|
|
10718
|
-
* Resolves the
|
|
10719
|
-
*
|
|
10720
|
-
*
|
|
10721
|
-
*
|
|
11213
|
+
* Resolves the fixed initial work-buffer capacity. Explicit count/MB limits are combined by taking the smaller
|
|
11214
|
+
* and then raised to the complete coarse minimum. Without an explicit limit, a known complete source retains
|
|
11215
|
+
* legacy full residency. When finer metadata is deferred and the complete size is unknown, the device-tiered
|
|
11216
|
+
* memory estimate is given at least one largest-coarse-file of headroom so one replacement file can refine
|
|
11217
|
+
* while all coarse fallback files remain pinned.
|
|
11218
|
+
* @param fullCapacity exact complete source capacity, or null when unavailable
|
|
11219
|
+
* @param largestBaseFileCount largest whole coarse source file, used as modest replacement headroom
|
|
11220
|
+
* @returns the fixed initial work-buffer capacity
|
|
10722
11221
|
*/
|
|
10723
11222
|
private _resolveResidentBudget;
|
|
11223
|
+
/**
|
|
11224
|
+
* Returns the estimated combined GPU/CPU bytes occupied by one resident splat.
|
|
11225
|
+
* @returns estimated bytes per resident splat
|
|
11226
|
+
*/
|
|
11227
|
+
private _bytesPerResidentSplat;
|
|
10724
11228
|
/**
|
|
10725
11229
|
* Collects the unique set of source file indices referenced by any LOD of any leaf, sorted ascending.
|
|
10726
11230
|
* @returns sorted unique file indices
|
|
10727
11231
|
*/
|
|
10728
11232
|
private _collectAllFileIds;
|
|
11233
|
+
/**
|
|
11234
|
+
* Collects unique whole source files required by the coarsest entry of every valid leaf.
|
|
11235
|
+
* @returns sorted unique coarse file indices
|
|
11236
|
+
*/
|
|
11237
|
+
private _collectBaseFileIds;
|
|
11238
|
+
/**
|
|
11239
|
+
* Resolves the immutable minimum initial capacity from padding, environment, and unique whole coarse files.
|
|
11240
|
+
* @param baseFileIds unique coarse source file indices
|
|
11241
|
+
* @param environmentCount included environment splat count
|
|
11242
|
+
*/
|
|
11243
|
+
private _resolveMinimumResidentSplats;
|
|
10729
11244
|
/**
|
|
10730
11245
|
* Settles the level-0 diagnostic from normalized renderable leaf entries after their source metadata resolves.
|
|
10731
11246
|
* A file may back several leaf ranges, so its source count is deliberately not used in the total.
|
|
10732
11247
|
*/
|
|
10733
11248
|
private _resolveLod0SplatCount;
|
|
10734
11249
|
/**
|
|
10735
|
-
* Fetches the environment bundle and
|
|
10736
|
-
* each file's parsed metadata for the later on-demand decode.
|
|
11250
|
+
* Fetches the environment bundle and the supplied referenced files' metadata to learn splat counts, caching
|
|
11251
|
+
* each file's parsed metadata for the later on-demand decode. File metadata fetches run in parallel.
|
|
10737
11252
|
* @param fileIds file indices to fetch metadata for
|
|
11253
|
+
* @param includeEnvironment whether to fetch the optional environment bundle in this phase
|
|
10738
11254
|
* @returns the environment splat count (0 when there is no environment)
|
|
10739
11255
|
*/
|
|
10740
11256
|
private _gatherCountsAsync;
|
|
@@ -10802,6 +11318,7 @@ declare namespace BABYLON {
|
|
|
10802
11318
|
* Concurrent or repeat requests for the same file are ignored. If the file is cancelled mid-flight
|
|
10803
11319
|
* (because every node that wanted it retargeted), the decode bails cooperatively at the next checkpoint.
|
|
10804
11320
|
* @param fileId file index to decode
|
|
11321
|
+
* @returns whether the file was decoded and published successfully
|
|
10805
11322
|
*/
|
|
10806
11323
|
private _decodeFileAsync;
|
|
10807
11324
|
/**
|
|
@@ -10966,6 +11483,22 @@ declare namespace BABYLON {
|
|
|
10966
11483
|
* @returns whether any node's in-frustum state changed
|
|
10967
11484
|
*/
|
|
10968
11485
|
private _updateNodeFrustum;
|
|
11486
|
+
/**
|
|
11487
|
+
* Normalizes an initial residency option, preserving finite non-positive values as an unset limit.
|
|
11488
|
+
* @param value option value
|
|
11489
|
+
* @param name option name used in errors
|
|
11490
|
+
* @param integer whether the normalized value must be an integer splat count
|
|
11491
|
+
* @returns normalized value
|
|
11492
|
+
*/
|
|
11493
|
+
private static _NormalizeResidentLimit;
|
|
11494
|
+
/**
|
|
11495
|
+
* Adds trusted non-negative integer counts without allowing unsafe capacity arithmetic.
|
|
11496
|
+
* @param left first count
|
|
11497
|
+
* @param right second count
|
|
11498
|
+
* @param label capacity name used in errors
|
|
11499
|
+
* @returns the safe integer sum
|
|
11500
|
+
*/
|
|
11501
|
+
private static _SafeAddCounts;
|
|
10969
11502
|
/**
|
|
10970
11503
|
* Reads the splat count from SOG metadata, coerced to a finite non-negative integer (metadata is untrusted, so
|
|
10971
11504
|
* `count` / `shape[0]` may be a string or malformed — a non-numeric value must not leak into count arithmetic).
|
|
@@ -11888,12 +12421,83 @@ declare namespace BABYLON {
|
|
|
11888
12421
|
* Defines options for the FBX loader.
|
|
11889
12422
|
*/
|
|
11890
12423
|
export interface FBXFileLoaderOptions {
|
|
12424
|
+
/**
|
|
12425
|
+
* Bundle of defaults for the options that change what the loaded scene looks like.
|
|
12426
|
+
* - "compatible" (default): the behaviour of the loader as first shipped: StandardMaterial for every material,
|
|
12427
|
+
* one Babylon geometry per model, curve geometry skipped, constraints recorded as metadata only, clips rebased
|
|
12428
|
+
* to start at frame 0, cameras and lights placed in world space.
|
|
12429
|
+
* - "full": everything the loader can do: PBRMaterial for physically based shaders, geometry shared between
|
|
12430
|
+
* instances, curves as lines meshes, constraints solved at runtime, authored clip times, cameras and lights
|
|
12431
|
+
* parented to their nodes so they animate.
|
|
12432
|
+
* An option set explicitly always wins over the preset.
|
|
12433
|
+
*/
|
|
12434
|
+
preset?: "compatible" | "full";
|
|
11891
12435
|
/**
|
|
11892
12436
|
* Source convention for tangent-space normal maps connected through FBX normal-map slots.
|
|
11893
12437
|
* FBX does not standardize this convention, so the loader defaults to the glTF/USD-style Y-up convention.
|
|
11894
12438
|
* Set to "y-down" for assets authored with inverted green/Y normal maps.
|
|
11895
12439
|
*/
|
|
11896
12440
|
normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;
|
|
12441
|
+
/**
|
|
12442
|
+
* Which Babylon material to build.
|
|
12443
|
+
* - "standard" (default, "full" preset: "auto"): always StandardMaterial (PBR parameters are approximated).
|
|
12444
|
+
* - "auto": PBRMaterial for physically based FBX materials (Standard Surface, Arnold, 3ds Max Physical,
|
|
12445
|
+
* 3ds Max PBR, glTF, OpenPBR, Stingray PBS) and StandardMaterial for classic Lambert/Phong materials.
|
|
12446
|
+
* - "pbr": always PBRMaterial (Lambert/Phong parameters are converted).
|
|
12447
|
+
*/
|
|
12448
|
+
materials?: "auto" | "standard" | "pbr";
|
|
12449
|
+
/**
|
|
12450
|
+
* Unit conversion applied at the root of the loaded hierarchy.
|
|
12451
|
+
* - "preserve" (default): keep the file's units (1 Babylon unit = 1 FBX unit).
|
|
12452
|
+
* - "meters": scale so that 1 Babylon unit is 1 meter, using the file's UnitScaleFactor.
|
|
12453
|
+
* - a number: centimeters per Babylon unit (100 = meters, 1 = centimeters, 2.54 = inches).
|
|
12454
|
+
*/
|
|
12455
|
+
unitScale?: "preserve" | "meters" | number;
|
|
12456
|
+
/**
|
|
12457
|
+
* Share vertex data between models that reference the same FBX geometry (default false, "full" preset: true).
|
|
12458
|
+
* Skinned meshes are never shared.
|
|
12459
|
+
*/
|
|
12460
|
+
shareGeometry?: boolean;
|
|
12461
|
+
/**
|
|
12462
|
+
* Called for every recoverable issue found while loading (unsupported features, malformed data that was
|
|
12463
|
+
* skipped, approximations). The same list is stored on the root node's metadata as `fbxDiagnostics`.
|
|
12464
|
+
*/
|
|
12465
|
+
onWarning?: (warning: FBXLoaderWarning) => void;
|
|
12466
|
+
/**
|
|
12467
|
+
* Segments per knot span when tessellating NURBS surfaces. Zero or undefined uses the subdivision stored in
|
|
12468
|
+
* the file (usually 4), capped at 16.
|
|
12469
|
+
*/
|
|
12470
|
+
nurbsSubdivision?: number;
|
|
12471
|
+
/** How curve geometry (Line, NurbsCurve) is imported: skipped (default) or as lines meshes ("full" preset). */
|
|
12472
|
+
curves?: "lines" | "skip";
|
|
12473
|
+
/**
|
|
12474
|
+
* Constraints (aim, parent, position, rotation, scale): "metadata" (default) only records them on the nodes,
|
|
12475
|
+
* "apply" ("full" preset) attaches an `FBXConstraintBehavior` to each constrained node so it is solved before
|
|
12476
|
+
* every render. IK chains are always metadata only.
|
|
12477
|
+
*/
|
|
12478
|
+
constraints?: "apply" | "metadata";
|
|
12479
|
+
/**
|
|
12480
|
+
* Shift every clip so its first keyframe sits at frame 0 (default true). With false ("full" preset) keys keep
|
|
12481
|
+
* the times authored in the file, so clips of one file stay aligned with each other and with their declared
|
|
12482
|
+
* ranges.
|
|
12483
|
+
*/
|
|
12484
|
+
rebaseAnimations?: boolean;
|
|
12485
|
+
/**
|
|
12486
|
+
* Parent cameras and lights to their FBX node so they follow its animation (default false, "full" preset:
|
|
12487
|
+
* true). Otherwise they are created at the node's world position and orientation, unparented.
|
|
12488
|
+
*/
|
|
12489
|
+
attachCamerasAndLights?: boolean;
|
|
12490
|
+
}
|
|
12491
|
+
/** A recoverable issue reported while loading an FBX file. */
|
|
12492
|
+
export interface FBXLoaderWarning {
|
|
12493
|
+
/** Which part of the loader reported the issue */
|
|
12494
|
+
source: "scene" | "model" | "geometry" | "skin" | "rig" | "animation" | "blendShape" | "camera" | "light";
|
|
12495
|
+
/** Human readable description */
|
|
12496
|
+
message: string;
|
|
12497
|
+
/** Name of the affected object, when known */
|
|
12498
|
+
objectName?: string;
|
|
12499
|
+
/** Structured details from the interpreter, when any */
|
|
12500
|
+
details?: unknown;
|
|
11897
12501
|
}
|
|
11898
12502
|
/**
|
|
11899
12503
|
* FBX file loader plugin for Babylon.js.
|
|
@@ -11916,6 +12520,22 @@ declare namespace BABYLON {
|
|
|
11916
12520
|
private readonly _bindRestBones;
|
|
11917
12521
|
private readonly _sourceBonesBySkeleton;
|
|
11918
12522
|
private readonly _scaleCompensationHelpersBySkeleton;
|
|
12523
|
+
/** Frame rate of the file being loaded (GlobalSettings TimeMode); animation is baked at this rate. */
|
|
12524
|
+
private _frameRate;
|
|
12525
|
+
/** Layers of the animation stack currently being converted; used by the transform samplers. */
|
|
12526
|
+
private _activeLayers;
|
|
12527
|
+
/** Parent model per model id, for inherit-mode aware sampling. */
|
|
12528
|
+
private _parentModelById;
|
|
12529
|
+
/** Curve nodes per model id for the stack currently being converted. */
|
|
12530
|
+
private _curveNodesByModelId;
|
|
12531
|
+
/** Helper nodes inserted above models whose InheritType is not RSrs. */
|
|
12532
|
+
private _inheritScaleHelpers;
|
|
12533
|
+
/** First mesh built per (geometry, geometric transform), for geometry sharing between instances. */
|
|
12534
|
+
private _meshByGeometryKey;
|
|
12535
|
+
/** Instance mesh -> source mesh whose geometry it shares. */
|
|
12536
|
+
private _instanceSource;
|
|
12537
|
+
/** Property curve nodes that were mapped onto Babylon animations; their "not evaluated" diagnostics are dropped. */
|
|
12538
|
+
private _evaluatedCurveNodeIds;
|
|
11919
12539
|
/**
|
|
11920
12540
|
* Creates a new FBX loader.
|
|
11921
12541
|
* @param options - Options controlling FBX loading behavior
|
|
@@ -11958,6 +12578,11 @@ declare namespace BABYLON {
|
|
|
11958
12578
|
* @returns A promise containing the loaded asset container
|
|
11959
12579
|
*/
|
|
11960
12580
|
loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<AssetContainer>;
|
|
12581
|
+
/**
|
|
12582
|
+
* Parses and interprets the file. Parsing is synchronous, so no progress events are emitted: the scene loader's
|
|
12583
|
+
* progress callback reports download bytes and must not be fed synthetic counts.
|
|
12584
|
+
*/
|
|
12585
|
+
private _parseAndInterpret;
|
|
11961
12586
|
private _parse;
|
|
11962
12587
|
private _parseFromArrayBuffer;
|
|
11963
12588
|
private _buildScene;
|
|
@@ -11969,6 +12594,15 @@ declare namespace BABYLON {
|
|
|
11969
12594
|
private _linkSkeletonsToTransformNodes;
|
|
11970
12595
|
private static _modelSubtreeMatchesNameFilter;
|
|
11971
12596
|
private static _applyModelMetadata;
|
|
12597
|
+
/**
|
|
12598
|
+
* Wires a LodGroup's children as Babylon LOD levels: the first child holds the highest detail; every further
|
|
12599
|
+
* child replaces it beyond the group's threshold distance (or screen coverage when thresholds are percentages).
|
|
12600
|
+
* Each child's display mode is honoured first: level 1 (show) stays visible outside the LOD chain, level 2
|
|
12601
|
+
* (hide) is disabled, and only level 0 (use LOD) children take part in the distance switching.
|
|
12602
|
+
*/
|
|
12603
|
+
private static _applyLodGroup;
|
|
12604
|
+
/** Builds a lines mesh from Line or tessellated NurbsCurve geometry, applying the model's geometric transform. */
|
|
12605
|
+
private _createLinesMesh;
|
|
11972
12606
|
private _createMesh;
|
|
11973
12607
|
/**
|
|
11974
12608
|
* Apply multi-material to a mesh by creating sub-meshes grouped by material index.
|
|
@@ -11992,6 +12626,11 @@ declare namespace BABYLON {
|
|
|
11992
12626
|
*/
|
|
11993
12627
|
private _buildSkinningData;
|
|
11994
12628
|
private _createMaterial;
|
|
12629
|
+
private _createPbrMaterial;
|
|
12630
|
+
/** Alpha of a classic Lambert/Phong material: Opacity when present, otherwise 1 - TransparentColor * TransparencyFactor. */
|
|
12631
|
+
private static _alphaFromClassicTransparency;
|
|
12632
|
+
private static _applyTextureSettings;
|
|
12633
|
+
private _createStandardMaterial;
|
|
11995
12634
|
private _configureNormalTexture;
|
|
11996
12635
|
private _getNormalMapTangentHandednessScale;
|
|
11997
12636
|
private static _isSupportedMaterialTextureSlot;
|
|
@@ -12015,11 +12654,27 @@ declare namespace BABYLON {
|
|
|
12015
12654
|
private _createCamera;
|
|
12016
12655
|
private _createLight;
|
|
12017
12656
|
private _createSkeleton;
|
|
12657
|
+
private _rigBoneModelIds;
|
|
12658
|
+
private _isRigBone;
|
|
12018
12659
|
private _getSourceBone;
|
|
12019
12660
|
private _getScaleCompensationHelper;
|
|
12020
12661
|
private static _computeFBXAbsoluteMatrices;
|
|
12662
|
+
/**
|
|
12663
|
+
* Effective ("inherit") scale of every bone, following the FBX SDK: the local scale for RSrs bones, and for
|
|
12664
|
+
* RrSs / Rrs bones the local scale multiplied by the scale of the bone's inherit-scale node (the parent for RrSs,
|
|
12665
|
+
* the parent's inherit-scale node for Rrs). Bones are ordered parents first.
|
|
12666
|
+
*/
|
|
12667
|
+
private static _computeBoneInheritScales;
|
|
12668
|
+
private static _getBoneInheritScaleNode;
|
|
12669
|
+
/** Scale a bone inherits into its own scale (RrSs chains), or unit scale. */
|
|
12670
|
+
private static _getBoneInheritedScale;
|
|
12021
12671
|
private static _computeFBXRuntimeLocalMatrix;
|
|
12022
12672
|
private static _applyParentScaleCompensation;
|
|
12673
|
+
/**
|
|
12674
|
+
* Splits a bone's FBX local matrix into a helper (which cancels the parent scale and carries the translation,
|
|
12675
|
+
* so the translation still follows the parent scale as the SDK does) and the bone's own rotation/scale. For RrSs
|
|
12676
|
+
* bones the inherited scale is folded into the bone scale.
|
|
12677
|
+
*/
|
|
12023
12678
|
private static _splitParentScaleCompensatedLocalMatrix;
|
|
12024
12679
|
private static _safeInverseScale;
|
|
12025
12680
|
private static _getInverseScaleVector;
|
|
@@ -12036,13 +12691,8 @@ declare namespace BABYLON {
|
|
|
12036
12691
|
* In row-vector convention: v' = v * M
|
|
12037
12692
|
*/
|
|
12038
12693
|
private static _computeFBXLocalMatrix;
|
|
12039
|
-
|
|
12040
|
-
* Apply the FBX transform chain to a Babylon TransformNode or Mesh.
|
|
12041
|
-
* Decomposes the full local matrix into position/rotation/scale.
|
|
12042
|
-
*/
|
|
12043
|
-
private static _applyFBXTransform;
|
|
12694
|
+
private _applyRestTRS;
|
|
12044
12695
|
private static _computeFBXModelLocalMatrix;
|
|
12045
|
-
private static _getBoneReferenceWorldMatrix;
|
|
12046
12696
|
private static _applyMatrixToTransform;
|
|
12047
12697
|
private _createAnimationGroup;
|
|
12048
12698
|
private _buildInheritedRigBoneAnimations;
|
|
@@ -12052,9 +12702,61 @@ declare namespace BABYLON {
|
|
|
12052
12702
|
* Computes the full FBX transform matrix at each keyframe and decomposes into TRS.
|
|
12053
12703
|
*/
|
|
12054
12704
|
private _buildNodeAnimations;
|
|
12705
|
+
/**
|
|
12706
|
+
* Baked keys are interpolated linearly by Babylon. Between two frames an FBX cubic segment can deviate from that
|
|
12707
|
+
* line, so sample times are refined (midpoints inserted, up to two levels) wherever the interpolated transform
|
|
12708
|
+
* differs noticeably from the curve. Flat and linear segments stay at frame resolution.
|
|
12709
|
+
*/
|
|
12710
|
+
private static _refineSampleTimes;
|
|
12711
|
+
/**
|
|
12712
|
+
* Keys of a scalar property animated by one or more layers: the authored keys when a single layer drives it,
|
|
12713
|
+
* otherwise the frame grid evaluated through the layer stack.
|
|
12714
|
+
* @param sources - Per-layer curves of the property (each with at least one curve)
|
|
12715
|
+
* @param animStack - Stack being converted
|
|
12716
|
+
* @param mapValue - Conversion from the FBX value to the Babylon property value
|
|
12717
|
+
* @returns Animation keys
|
|
12718
|
+
*/
|
|
12719
|
+
private _layeredScalarKeys;
|
|
12720
|
+
/**
|
|
12721
|
+
* Maps an animated FBX property (anything other than node transforms and blend shape weights) onto the Babylon
|
|
12722
|
+
* property that carries it: mesh visibility, camera field of view and clip planes, light intensity, colour and
|
|
12723
|
+
* cone angles, and material colours, alpha, roughness and metalness. `group` holds the curve nodes of every
|
|
12724
|
+
* layer animating that property, in layer order; several layers are evaluated through the layer stack.
|
|
12725
|
+
*/
|
|
12726
|
+
private _buildPropertyAnimations;
|
|
12727
|
+
/** Records constraints on their nodes and, unless disabled, attaches the runtime behavior that solves them. */
|
|
12728
|
+
private _applyConstraints;
|
|
12729
|
+
/** Collects every recoverable issue the interpreter recorded, stores it on the root node and notifies the caller. */
|
|
12730
|
+
private _reportDiagnostics;
|
|
12731
|
+
/** Curve nodes affecting the inherit scale of a model: its own scale curves and those of its inherit-scale chain. */
|
|
12732
|
+
private _collectInheritScaleCurves;
|
|
12055
12733
|
private _isVector3KeysConstant;
|
|
12734
|
+
/** Samples the animated Lcl Translation / Rotation / Scaling of a model, blending all layers of the active stack. */
|
|
12735
|
+
private _sampleModelTRS;
|
|
12736
|
+
/**
|
|
12737
|
+
* Local position/rotation/scale of a model from FBX Lcl values. Without pivots and offsets the components map
|
|
12738
|
+
* directly (rotation = pre * lcl * post⁻¹), which keeps zero and negative scales exact. With pivots the full
|
|
12739
|
+
* matrix is built and decomposed.
|
|
12740
|
+
*/
|
|
12741
|
+
private static _computeLocalTRS;
|
|
12742
|
+
/** Applies inherit-mode adjustments to a local TRS (see _computeInheritAwareLocalMatrix). */
|
|
12743
|
+
private _adjustTRSForInheritMode;
|
|
12056
12744
|
private _sampleModelLocalMatrix;
|
|
12057
12745
|
private _sampleModelScale;
|
|
12746
|
+
/**
|
|
12747
|
+
* Effective scale of a model for inherit-mode math (`inherit_scale` in ufbx terms): its own local scale, multiplied
|
|
12748
|
+
* componentwise by the inherited scale when the model uses RrSs inheritance. `time` samples animation; undefined
|
|
12749
|
+
* uses the rest pose.
|
|
12750
|
+
*/
|
|
12751
|
+
private _getInheritScale;
|
|
12752
|
+
/** RrSs nodes inherit scale from their parent; Rrs nodes skip their immediate parent (chaining through Rrs parents). */
|
|
12753
|
+
private _getInheritScaleNode;
|
|
12754
|
+
/**
|
|
12755
|
+
* Local matrix of a model relative to its Babylon parent frame, accounting for inherit modes. For RSrs (the
|
|
12756
|
+
* default) this is the FBX local matrix. For RrSs / Rrs the node sits under a helper that removes the parent's
|
|
12757
|
+
* scale, so translation is pre-scaled by the parent scale and (for RrSs) scale accumulates componentwise.
|
|
12758
|
+
*/
|
|
12759
|
+
private _computeInheritAwareLocalMatrix;
|
|
12058
12760
|
/**
|
|
12059
12761
|
* Build matrix-baked bone animation from full FBX local transforms.
|
|
12060
12762
|
* The bind matrix carries the skinning offset, so animation curves drive
|
|
@@ -12089,6 +12791,189 @@ declare namespace BABYLON {
|
|
|
12089
12791
|
*/
|
|
12090
12792
|
|
|
12091
12793
|
|
|
12794
|
+
/**
|
|
12795
|
+
* Runtime evaluation of FBX constraints. An `FBXConstraintBehavior` is attached to each constrained node; all
|
|
12796
|
+
* behaviors of a scene register with one `FBXConstraintSolver`, which solves them in dependency order (a constraint
|
|
12797
|
+
* whose target or parent is driven by another constraint is solved after it) and reuses scratch objects, so solving
|
|
12798
|
+
* allocates nothing per frame.
|
|
12799
|
+
*
|
|
12800
|
+
* The solver brackets the scene's animation phase: before animations run it writes each node's unconstrained
|
|
12801
|
+
* transform back, after they ran it captures the result as the new unconstrained transform and solves. A partial
|
|
12802
|
+
* weight therefore always blends from what animation (or nothing) produced this frame, never from the previous
|
|
12803
|
+
* solve's output, so a 50% weight stays a 50% blend instead of converging on the target.
|
|
12804
|
+
*
|
|
12805
|
+
* All maths happen in FBX space, i.e. relative to the loader's root node, so the handedness conversion applied
|
|
12806
|
+
* at the root never enters the solve.
|
|
12807
|
+
*/
|
|
12808
|
+
/** Resolved target of a constraint. */
|
|
12809
|
+
export interface FBXConstraintBehaviorTarget {
|
|
12810
|
+
/** Target node */
|
|
12811
|
+
node: TransformNode;
|
|
12812
|
+
/** Normalized target weight (0..1) */
|
|
12813
|
+
weight: number;
|
|
12814
|
+
/** Offset matrix for parent constraints (in the target's space) */
|
|
12815
|
+
offset: Matrix;
|
|
12816
|
+
}
|
|
12817
|
+
/** Options resolved by the loader when creating the behavior. */
|
|
12818
|
+
export interface FBXConstraintBehaviorOptions {
|
|
12819
|
+
/** Root of the loaded asset; world matrices are made relative to it */
|
|
12820
|
+
root: TransformNode;
|
|
12821
|
+
/** Resolved targets of the constraint, in file order */
|
|
12822
|
+
targets: FBXConstraintBehaviorTarget[];
|
|
12823
|
+
/** World up object of an aim constraint, when it has one */
|
|
12824
|
+
upNode: Nullable<TransformNode>;
|
|
12825
|
+
/** Scene up axis in FBX space */
|
|
12826
|
+
sceneUp: Vector3;
|
|
12827
|
+
}
|
|
12828
|
+
/**
|
|
12829
|
+
* Solves every FBX constraint of a scene once per frame, in dependency order, from the scene's animation phase
|
|
12830
|
+
* observers (`beginFrame` before animations, `solve` after them). Created on demand by the first
|
|
12831
|
+
* `FBXConstraintBehavior` attached in the scene and removed with the last one.
|
|
12832
|
+
*/
|
|
12833
|
+
export class FBXConstraintSolver {
|
|
12834
|
+
private readonly _scene;
|
|
12835
|
+
private readonly _behaviors;
|
|
12836
|
+
private _ordered;
|
|
12837
|
+
private _cyclic;
|
|
12838
|
+
private _dirty;
|
|
12839
|
+
private _beforeAnimations;
|
|
12840
|
+
private _afterAnimations;
|
|
12841
|
+
private constructor();
|
|
12842
|
+
/**
|
|
12843
|
+
* Solver of a scene, if any constraint behavior is attached in it.
|
|
12844
|
+
* @param scene - Scene to look up
|
|
12845
|
+
* @returns The solver, or undefined
|
|
12846
|
+
*/
|
|
12847
|
+
static Get(scene: Scene): FBXConstraintSolver | undefined;
|
|
12848
|
+
/**
|
|
12849
|
+
* Solver of a scene, created when missing.
|
|
12850
|
+
* @param scene - Scene to look up
|
|
12851
|
+
* @returns The solver
|
|
12852
|
+
*/
|
|
12853
|
+
static GetOrCreate(scene: Scene): FBXConstraintSolver;
|
|
12854
|
+
/** Registered behaviors in solve order (a target's constraint before the constraints that read it). */
|
|
12855
|
+
get constraints(): readonly FBXConstraintBehavior[];
|
|
12856
|
+
/**
|
|
12857
|
+
* Behaviors that take part in a dependency cycle (A targets B while B targets A). They are solved after all
|
|
12858
|
+
* acyclic constraints, in registration order, so each sees the other's result from the previous solve.
|
|
12859
|
+
*/
|
|
12860
|
+
get cyclicConstraints(): readonly FBXConstraintBehavior[];
|
|
12861
|
+
/**
|
|
12862
|
+
* Adds a behavior to the solve set.
|
|
12863
|
+
* @param behavior - Behavior to add
|
|
12864
|
+
*/
|
|
12865
|
+
register(behavior: FBXConstraintBehavior): void;
|
|
12866
|
+
/**
|
|
12867
|
+
* Removes a behavior from the solve set; the solver disposes itself with the last one.
|
|
12868
|
+
* @param behavior - Behavior to remove
|
|
12869
|
+
*/
|
|
12870
|
+
unregister(behavior: FBXConstraintBehavior): void;
|
|
12871
|
+
/** Marks the solve order stale, e.g. after re-parenting a constrained node. */
|
|
12872
|
+
invalidateOrder(): void;
|
|
12873
|
+
/**
|
|
12874
|
+
* Start of a frame, before animations run: every constrained node gets its unconstrained transform back, so
|
|
12875
|
+
* that animation either overwrites it or leaves it untouched.
|
|
12876
|
+
*/
|
|
12877
|
+
beginFrame(): void;
|
|
12878
|
+
/**
|
|
12879
|
+
* End of the animation phase: takes every constrained node's current transform as its unconstrained value,
|
|
12880
|
+
* then solves every registered constraint once, in dependency order.
|
|
12881
|
+
*/
|
|
12882
|
+
solve(): void;
|
|
12883
|
+
private _ensureOrder;
|
|
12884
|
+
private static _IsAncestorOrSelf;
|
|
12885
|
+
}
|
|
12886
|
+
/** Babylon behavior evaluating an FBX aim, parent, position, rotation or scale constraint. */
|
|
12887
|
+
export class FBXConstraintBehavior implements Behavior<TransformNode> {
|
|
12888
|
+
/** Constraint data extracted from the file */
|
|
12889
|
+
readonly constraint: FBXConstraintData;
|
|
12890
|
+
private readonly _options;
|
|
12891
|
+
/** Behavior name (`fbxConstraint:` followed by the constraint name) */
|
|
12892
|
+
readonly name: string;
|
|
12893
|
+
/** Node the behavior is attached to */
|
|
12894
|
+
attachedNode: Nullable<TransformNode>;
|
|
12895
|
+
/** Set to false to pause the constraint without detaching it */
|
|
12896
|
+
enabled: boolean;
|
|
12897
|
+
private readonly _offsetTranslation;
|
|
12898
|
+
private readonly _offsetRotation;
|
|
12899
|
+
private readonly _offsetScale;
|
|
12900
|
+
private readonly _localBasisTransposed;
|
|
12901
|
+
/** Unconstrained transform of the current frame (what animation produced), blended towards the constraint's result. */
|
|
12902
|
+
private readonly _base;
|
|
12903
|
+
private _hasBase;
|
|
12904
|
+
/**
|
|
12905
|
+
* Creates the behavior.
|
|
12906
|
+
* @param constraint - Constraint data extracted from the file
|
|
12907
|
+
* @param _options - Resolved targets and scene information
|
|
12908
|
+
*/
|
|
12909
|
+
constructor(
|
|
12910
|
+
/** Constraint data extracted from the file */
|
|
12911
|
+
constraint: FBXConstraintData, _options: FBXConstraintBehaviorOptions);
|
|
12912
|
+
/** Nothing to initialize */
|
|
12913
|
+
init(): void;
|
|
12914
|
+
/**
|
|
12915
|
+
* Registers the behavior with the scene's solver, takes the node's current transform as the unconstrained
|
|
12916
|
+
* value and solves the constraint once.
|
|
12917
|
+
* @param target - Node to constrain
|
|
12918
|
+
*/
|
|
12919
|
+
attach(target: TransformNode): void;
|
|
12920
|
+
/** Unregisters the behavior; the node keeps its last solved transform. */
|
|
12921
|
+
detach(): void;
|
|
12922
|
+
/**
|
|
12923
|
+
* Takes the node's current transform as the unconstrained value the next solve blends from. The solver calls
|
|
12924
|
+
* this after the scene's animations ran; call it yourself after writing a transform by hand.
|
|
12925
|
+
*/
|
|
12926
|
+
captureBase(): void;
|
|
12927
|
+
/**
|
|
12928
|
+
* Writes the unconstrained transform back to the node. The solver calls this before the scene's animations
|
|
12929
|
+
* run, so a node nothing animates keeps its unconstrained value between frames instead of the solved one.
|
|
12930
|
+
*/
|
|
12931
|
+
restoreBase(): void;
|
|
12932
|
+
/**
|
|
12933
|
+
* Nodes whose world transform the solve reads: the targets, the up node and the constrained node's parent.
|
|
12934
|
+
* @returns The nodes, used by the solver to order constraints
|
|
12935
|
+
*/
|
|
12936
|
+
dependencyNodes(): Nullable<Node>[];
|
|
12937
|
+
/**
|
|
12938
|
+
* Solves the constraint from the captured unconstrained transform and writes the node's local transform.
|
|
12939
|
+
* Blends are relative to the value captured by `captureBase`, not to whatever the node holds now.
|
|
12940
|
+
*/
|
|
12941
|
+
evaluate(): void;
|
|
12942
|
+
/**
|
|
12943
|
+
* World matrix of a node relative to the asset root (FBX space).
|
|
12944
|
+
* @param node - node to evaluate
|
|
12945
|
+
* @param out - matrix receiving the result
|
|
12946
|
+
* @returns `out`
|
|
12947
|
+
*/
|
|
12948
|
+
private _fbxWorld;
|
|
12949
|
+
/**
|
|
12950
|
+
* Weighted blend of the targets' world transforms (relative to the root).
|
|
12951
|
+
* @param position - Receives the blended translation
|
|
12952
|
+
* @param rotation - Receives the blended rotation
|
|
12953
|
+
* @param scale - Receives the blended scale
|
|
12954
|
+
* @returns The total target weight, 0 when no target contributes
|
|
12955
|
+
*/
|
|
12956
|
+
private _blendTargets;
|
|
12957
|
+
private _applyWeighted;
|
|
12958
|
+
private _applyRotation;
|
|
12959
|
+
private _writePosition;
|
|
12960
|
+
private _writeScaling;
|
|
12961
|
+
private _solvePosition;
|
|
12962
|
+
private _solveRotation;
|
|
12963
|
+
private _solveScale;
|
|
12964
|
+
private _solveParent;
|
|
12965
|
+
private _solveAim;
|
|
12966
|
+
/**
|
|
12967
|
+
* Builds a rotation matrix whose rows are `first`, `second` made orthogonal to it, and their cross product.
|
|
12968
|
+
* @param first - primary axis
|
|
12969
|
+
* @param second - secondary axis
|
|
12970
|
+
* @param out - matrix receiving the basis
|
|
12971
|
+
* @returns false when the axes are parallel or degenerate (`out` is then unchanged)
|
|
12972
|
+
*/
|
|
12973
|
+
private static _OrthonormalBasisToRef;
|
|
12974
|
+
}
|
|
12975
|
+
|
|
12976
|
+
|
|
12092
12977
|
/**
|
|
12093
12978
|
* Intermediate representation for parsed FBX data.
|
|
12094
12979
|
* Both binary and ASCII parsers produce this same structure.
|
|
@@ -12103,6 +12988,11 @@ declare namespace BABYLON {
|
|
|
12103
12988
|
type: FBXPropertyType;
|
|
12104
12989
|
/** Parsed property value. */
|
|
12105
12990
|
value: FBXPropertyValue;
|
|
12991
|
+
/**
|
|
12992
|
+
* Exact decimal text of an int64 whose magnitude exceeds 2^53; `value` then holds the rounded double. Object
|
|
12993
|
+
* ids are the only int64 values where the last bits matter, and `resolveConnections` keys them by this text.
|
|
12994
|
+
*/
|
|
12995
|
+
raw?: string;
|
|
12106
12996
|
}
|
|
12107
12997
|
/** A node in the FBX document tree */
|
|
12108
12998
|
export interface FBXNode {
|
|
@@ -12129,11 +13019,22 @@ declare namespace BABYLON {
|
|
|
12129
13019
|
/** Extract a property value by index, with type narrowing */
|
|
12130
13020
|
export function getPropertyValue<T extends FBXPropertyValue>(node: FBXNode, index: number): T | undefined;
|
|
12131
13021
|
/**
|
|
12132
|
-
*
|
|
13022
|
+
* Validates an FBX object ID value: IDs are 64-bit integers, so anything non-numeric, non-finite or fractional is
|
|
13023
|
+
* rejected. IDs beyond 2^53 are carried losslessly through the property's `raw` text by `resolveConnections`.
|
|
12133
13024
|
* @param value - Parsed FBX object ID value
|
|
12134
|
-
* @returns The object ID, or undefined when the value
|
|
13025
|
+
* @returns The object ID, or undefined when the value cannot be an ID
|
|
12135
13026
|
*/
|
|
12136
13027
|
export function getSafeFBXObjectId(value: unknown): number | undefined;
|
|
13028
|
+
/** Typed array payload types produced by the parsers. */
|
|
13029
|
+
export type FBXArrayValue = Float32Array | Float64Array | Int32Array | Uint8Array;
|
|
13030
|
+
/**
|
|
13031
|
+
* Returns the array payload of a node.
|
|
13032
|
+
* FBX 7.x stores arrays as a single array property. FBX 6.x (and some 7.x ASCII exporters) store them as a run of
|
|
13033
|
+
* scalar properties, and a one-element array degenerates to a single scalar. All of these are coalesced here.
|
|
13034
|
+
* @param node - Node whose properties hold the array
|
|
13035
|
+
* @returns The array, or null when the node has no numeric payload
|
|
13036
|
+
*/
|
|
13037
|
+
export function getNodeArray(node: FBXNode | undefined | null): FBXArrayValue | null;
|
|
12137
13038
|
/** Get the numeric ID from a node (first property is typically the int64 UID) */
|
|
12138
13039
|
export function getNodeId(node: FBXNode): number | undefined;
|
|
12139
13040
|
/**
|
|
@@ -12261,25 +13162,9 @@ declare namespace BABYLON {
|
|
|
12261
13162
|
/** Recoverable skinning/bind diagnostics */
|
|
12262
13163
|
diagnostics: FBXSkinDiagnostic[];
|
|
12263
13164
|
}
|
|
12264
|
-
|
|
12265
|
-
* Extract all skin deformers from the FBX scene.
|
|
12266
|
-
* Returns skin data including bone hierarchy and vertex weights.
|
|
12267
|
-
*/
|
|
12268
|
-
export function extractSkins(objectMap: FBXObjectMap): FBXSkinData[];
|
|
13165
|
+
export function extractSkins(objectMap: FBXObjectMap, propertyTemplates?: FBXPropertyTemplateMap): FBXSkinData[];
|
|
12269
13166
|
export function isSkeletonModel(modelNode: FBXNode): boolean;
|
|
12270
|
-
export function extractBoneTransform(modelNode: FBXNode):
|
|
12271
|
-
translation: [number, number, number];
|
|
12272
|
-
rotation: [number, number, number];
|
|
12273
|
-
preRotation: [number, number, number];
|
|
12274
|
-
postRotation: [number, number, number];
|
|
12275
|
-
rotationPivot: [number, number, number];
|
|
12276
|
-
scalingPivot: [number, number, number];
|
|
12277
|
-
rotationOffset: [number, number, number];
|
|
12278
|
-
scalingOffset: [number, number, number];
|
|
12279
|
-
scale: [number, number, number];
|
|
12280
|
-
rotationOrder: number;
|
|
12281
|
-
inheritType: number;
|
|
12282
|
-
};
|
|
13167
|
+
export function extractBoneTransform(modelNode: FBXNode, template?: FBXPropertyTemplate): FBXNodeTransformData;
|
|
12283
13168
|
|
|
12284
13169
|
|
|
12285
13170
|
export type FBXSceneDiagnosticType = "unsupported-constraint" | "unsupported-helper" | "unsupported-deformer" | "unsupported-node-attribute" | "unsupported-pose" | "unsupported-layered-texture" | "connection-graph";
|
|
@@ -12338,6 +13223,160 @@ declare namespace BABYLON {
|
|
|
12338
13223
|
export function resolveVector2Property(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string, fallback: [number, number]): [number, number];
|
|
12339
13224
|
export function resolveVector3Property(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string, fallback: [number, number, number]): [number, number, number];
|
|
12340
13225
|
export function resolvePropertyValues(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string): FBXPropertyValue[] | undefined;
|
|
13226
|
+
/** A property from a Properties70 ("P") or Properties60 ("Property") block. */
|
|
13227
|
+
export interface FBXPropertyEntry {
|
|
13228
|
+
name: string;
|
|
13229
|
+
type: string;
|
|
13230
|
+
flags: string;
|
|
13231
|
+
values: FBXPropertyValue[];
|
|
13232
|
+
}
|
|
13233
|
+
/**
|
|
13234
|
+
* Lists the properties declared directly on an object, from both the 7.x and 6.x property blocks.
|
|
13235
|
+
* @param node - Object node
|
|
13236
|
+
* @returns Property entries in declaration order (empty when the node has no property block)
|
|
13237
|
+
*/
|
|
13238
|
+
export function getPropertyEntries(node: FBXNode | undefined): FBXPropertyEntry[];
|
|
13239
|
+
/** Value of a user property: scalars as-is, vectors and colours as number arrays. */
|
|
13240
|
+
export type FBXUserPropertyValue = string | number | boolean | number[];
|
|
13241
|
+
/**
|
|
13242
|
+
* User-defined properties of an object: those flagged "U" (user) in the property flags. Every DCC exports custom
|
|
13243
|
+
* attributes this way (Maya extra attributes, 3ds Max user properties, Blender custom properties).
|
|
13244
|
+
* @param node - Object node
|
|
13245
|
+
* @returns Map of property name to value, or undefined when the object has none
|
|
13246
|
+
*/
|
|
13247
|
+
export function extractUserProperties(node: FBXNode): Record<string, FBXUserPropertyValue> | undefined;
|
|
13248
|
+
export function userPropertyValue(values: FBXPropertyValue[], typeName?: string): FBXUserPropertyValue | undefined;
|
|
13249
|
+
|
|
13250
|
+
|
|
13251
|
+
/**
|
|
13252
|
+
* NURBS curves and surfaces, and polyline ("Line") geometry.
|
|
13253
|
+
*
|
|
13254
|
+
* The basis evaluation and tessellation follow the FBX SDK conventions as implemented by ufbx: knot spans are
|
|
13255
|
+
* subdivided uniformly, closed and periodic curves wrap their control points, and surfaces are tessellated into
|
|
13256
|
+
* quads (degenerate quads at poles become triangles) with welded positions along the wrapped edges.
|
|
13257
|
+
*/
|
|
13258
|
+
export type FBXNurbsTopology = "open" | "closed" | "periodic";
|
|
13259
|
+
/** Knot vector and derived data of one parametric direction. */
|
|
13260
|
+
export interface FBXNurbsBasis {
|
|
13261
|
+
order: number;
|
|
13262
|
+
topology: FBXNurbsTopology;
|
|
13263
|
+
knots: Float64Array;
|
|
13264
|
+
/** Parameter range that the curve is defined on */
|
|
13265
|
+
tMin: number;
|
|
13266
|
+
tMax: number;
|
|
13267
|
+
/** Distinct knot values inside [tMin, tMax], i.e. the boundaries of the non-empty spans */
|
|
13268
|
+
spans: Float64Array;
|
|
13269
|
+
/** False when the knot vector is too short or not monotonic */
|
|
13270
|
+
valid: boolean;
|
|
13271
|
+
}
|
|
13272
|
+
/** NURBS curve: homogeneous control points (x, y, z, w) and a basis. */
|
|
13273
|
+
export interface FBXNurbsCurveData {
|
|
13274
|
+
basis: FBXNurbsBasis;
|
|
13275
|
+
/** Control points as x,y,z,w */
|
|
13276
|
+
controlPoints: Float64Array;
|
|
13277
|
+
numControlPoints: number;
|
|
13278
|
+
}
|
|
13279
|
+
/** NURBS surface: control points laid out as `v * numU + u`. */
|
|
13280
|
+
export interface FBXNurbsSurfaceData {
|
|
13281
|
+
basisU: FBXNurbsBasis;
|
|
13282
|
+
basisV: FBXNurbsBasis;
|
|
13283
|
+
numU: number;
|
|
13284
|
+
numV: number;
|
|
13285
|
+
/** Control points as x,y,z,w */
|
|
13286
|
+
controlPoints: Float64Array;
|
|
13287
|
+
flipNormals: boolean;
|
|
13288
|
+
/** Span subdivision stored in the file (Step), 0 when absent */
|
|
13289
|
+
stepU: number;
|
|
13290
|
+
stepV: number;
|
|
13291
|
+
}
|
|
13292
|
+
/** Polyline geometry ready for a lines mesh: one or more open or closed point runs. */
|
|
13293
|
+
export interface FBXCurveGeometryData {
|
|
13294
|
+
id: number;
|
|
13295
|
+
name: string;
|
|
13296
|
+
kind: "line" | "nurbsCurve";
|
|
13297
|
+
/** Each polyline as x,y,z triples; closed runs repeat their first point at the end */
|
|
13298
|
+
polylines: Float64Array[];
|
|
13299
|
+
/** Display colour from the geometry's Color property */
|
|
13300
|
+
color: [number, number, number] | null;
|
|
13301
|
+
diagnostics: FBXGeometryDiagnostic[];
|
|
13302
|
+
}
|
|
13303
|
+
export function createNurbsBasis(order: number, form: string | undefined, knots: Float64Array): FBXNurbsBasis;
|
|
13304
|
+
/**
|
|
13305
|
+
* Evaluates the basis functions (and their derivatives) that are non-zero at `u`.
|
|
13306
|
+
* @returns index of the first influencing control point, or -1 when the basis cannot be evaluated
|
|
13307
|
+
*/
|
|
13308
|
+
export function evaluateNurbsBasis(basis: FBXNurbsBasis, u: number, weights: Float64Array, derivatives: Float64Array | null): number;
|
|
13309
|
+
/** Evaluates a curve point; `out` receives position (0..2) and derivative (3..5). */
|
|
13310
|
+
export function evaluateNurbsCurve(curve: FBXNurbsCurveData, u: number, out: Float64Array, weights: Float64Array, derivs: Float64Array): boolean;
|
|
13311
|
+
/** Evaluates a surface point; `out` receives position (0..2), du (3..5) and dv (6..8). */
|
|
13312
|
+
export function evaluateNurbsSurface(surface: FBXNurbsSurfaceData, u: number, v: number, out: Float64Array, scratch: {
|
|
13313
|
+
wu: Float64Array;
|
|
13314
|
+
wv: Float64Array;
|
|
13315
|
+
du: Float64Array;
|
|
13316
|
+
dv: Float64Array;
|
|
13317
|
+
}): boolean;
|
|
13318
|
+
/**
|
|
13319
|
+
* Tessellates a curve into a polyline with `subdivision` segments per knot span. Closed and periodic curves
|
|
13320
|
+
* end on a copy of their first point.
|
|
13321
|
+
*/
|
|
13322
|
+
export function tessellateNurbsCurve(curve: FBXNurbsCurveData, subdivision?: number): Float64Array | null;
|
|
13323
|
+
/** Span subdivision to use for a surface direction: an explicit override, else the file's Step, else 4. */
|
|
13324
|
+
export function resolveSpanSubdivision(fileStep: number, override: number | undefined): number;
|
|
13325
|
+
/**
|
|
13326
|
+
* Tessellates a surface into triangles. Positions on wrapped (closed/periodic) edges and at poles are welded
|
|
13327
|
+
* exactly like the FBX SDK does, so degenerate quads collapse into triangles.
|
|
13328
|
+
*/
|
|
13329
|
+
export function tessellateNurbsSurface(surface: FBXNurbsSurfaceData, subU: number, subV: number): {
|
|
13330
|
+
positions: Float64Array;
|
|
13331
|
+
indices: Uint32Array;
|
|
13332
|
+
normals: Float64Array;
|
|
13333
|
+
uvs: Float64Array;
|
|
13334
|
+
} | null;
|
|
13335
|
+
/** Reads a NurbsCurve geometry node. */
|
|
13336
|
+
export function extractNurbsCurve(node: FBXNode): FBXNurbsCurveData | null;
|
|
13337
|
+
/** Reads a NurbsSurface geometry node. */
|
|
13338
|
+
export function extractNurbsSurface(node: FBXNode): FBXNurbsSurfaceData | null;
|
|
13339
|
+
/** Tessellates a NurbsSurface geometry node into mesh geometry. */
|
|
13340
|
+
export function nurbsSurfaceToGeometry(node: FBXNode, geometryId: number, subdivisionOverride: number | undefined): FBXGeometryData | null;
|
|
13341
|
+
/** Reads a NurbsCurve geometry node into a tessellated polyline. */
|
|
13342
|
+
export function extractNurbsCurveGeometry(node: FBXNode, geometryId: number, subdivision?: number): FBXCurveGeometryData;
|
|
13343
|
+
/**
|
|
13344
|
+
* Reads a Line geometry node: Points plus PointsIndex where a negative index (~index) ends a segment, as in
|
|
13345
|
+
* polygon vertex indices.
|
|
13346
|
+
*/
|
|
13347
|
+
export function extractLineGeometry(node: FBXNode, geometryId: number): FBXCurveGeometryData;
|
|
13348
|
+
|
|
13349
|
+
|
|
13350
|
+
/** Transform properties resolved from an FBX Model, with template defaults applied. */
|
|
13351
|
+
export interface FBXNodeTransformData {
|
|
13352
|
+
translation: [number, number, number];
|
|
13353
|
+
rotation: [number, number, number];
|
|
13354
|
+
scale: [number, number, number];
|
|
13355
|
+
preRotation: [number, number, number];
|
|
13356
|
+
postRotation: [number, number, number];
|
|
13357
|
+
rotationPivot: [number, number, number];
|
|
13358
|
+
scalingPivot: [number, number, number];
|
|
13359
|
+
rotationOffset: [number, number, number];
|
|
13360
|
+
scalingOffset: [number, number, number];
|
|
13361
|
+
geometricTranslation: [number, number, number];
|
|
13362
|
+
geometricRotation: [number, number, number];
|
|
13363
|
+
geometricScaling: [number, number, number];
|
|
13364
|
+
/** Rotation order: 0=XYZ, 1=XZY, 2=YZX, 3=YXZ, 4=ZXY, 5=ZYX, 6=SphericXYZ */
|
|
13365
|
+
rotationOrder: number;
|
|
13366
|
+
/** FBX transform inheritance mode. 0=RrSs, 1=RSrs, 2=Rrs */
|
|
13367
|
+
inheritType: number;
|
|
13368
|
+
/** Whether the rotation space (rotation order, pre/post rotation) is active for this node */
|
|
13369
|
+
rotationActive: boolean;
|
|
13370
|
+
diagnostics: string[];
|
|
13371
|
+
}
|
|
13372
|
+
/**
|
|
13373
|
+
* Resolves the transform properties of a Model node the way the FBX SDK evaluates them.
|
|
13374
|
+
*
|
|
13375
|
+
* `RotationActive` gates the whole rotation space: when it is false (the FbxNode template default), the SDK
|
|
13376
|
+
* composes `Lcl Rotation` in plain XYZ order and ignores `RotationOrder`, `PreRotation` and `PostRotation`.
|
|
13377
|
+
* `RotationSpaceForLimitOnly` restricts the rotation space to limits, which has the same effect for us.
|
|
13378
|
+
*/
|
|
13379
|
+
export function extractNodeTransform(modelNode: FBXNode, template?: FBXPropertyTemplate): FBXNodeTransformData;
|
|
12341
13380
|
|
|
12342
13381
|
|
|
12343
13382
|
/** Parsed material data */
|
|
@@ -12347,6 +13386,10 @@ declare namespace BABYLON {
|
|
|
12347
13386
|
type: "Lambert" | "Phong";
|
|
12348
13387
|
properties: FBXMaterialProperties;
|
|
12349
13388
|
textures: FBXTextureRef[];
|
|
13389
|
+
/** Unified classic + PBR parameter model resolved from whichever shader flavour the file uses */
|
|
13390
|
+
model: FBXMaterialModel<FBXTextureRef>;
|
|
13391
|
+
/** User-defined properties */
|
|
13392
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
12350
13393
|
}
|
|
12351
13394
|
export interface FBXMaterialProperties {
|
|
12352
13395
|
diffuseColor?: [number, number, number];
|
|
@@ -12382,11 +13425,102 @@ declare namespace BABYLON {
|
|
|
12382
13425
|
uvSetIndex?: number;
|
|
12383
13426
|
/** Which named UV set this texture uses */
|
|
12384
13427
|
uvSetName?: string;
|
|
13428
|
+
/** WrapModeU: 0 = repeat, 1 = clamp */
|
|
13429
|
+
wrapU?: number;
|
|
13430
|
+
/** WrapModeV: 0 = repeat, 1 = clamp */
|
|
13431
|
+
wrapV?: number;
|
|
13432
|
+
/** Set when the texture came from a LayeredTexture (only the first layer is used) */
|
|
13433
|
+
layeredTextureId?: number;
|
|
12385
13434
|
}
|
|
12386
13435
|
/**
|
|
12387
13436
|
* Extract material data from an FBX Material node.
|
|
12388
13437
|
*/
|
|
12389
13438
|
export function extractMaterial(materialNode: FBXNode, materialId: number, objectMap: FBXObjectMap, templates?: FBXPropertyTemplateMap): FBXMaterialData;
|
|
13439
|
+
export function extractTextureRef(id: number, node: FBXNode, propertyName: string | undefined, objectMap: FBXObjectMap, template?: FBXPropertyTemplate): FBXTextureRef;
|
|
13440
|
+
|
|
13441
|
+
|
|
13442
|
+
/**
|
|
13443
|
+
* Unified material model.
|
|
13444
|
+
*
|
|
13445
|
+
* FBX materials come in many vendor flavours: the classic FbxSurfaceLambert / FbxSurfacePhong, Autodesk Standard
|
|
13446
|
+
* Surface (OSL), Arnold aiStandardSurface, 3ds Max Physical Material, 3ds Max PBR (metal/rough and spec/gloss),
|
|
13447
|
+
* the 3ds Max glTF material, OpenPBR, and Maya's Stingray PBS ShaderFX graph. Each stores its parameters under
|
|
13448
|
+
* different property names, sometimes behind a shader binding table.
|
|
13449
|
+
*
|
|
13450
|
+
* This module resolves any of them into two parameter sets, mirroring how the FBX SDK / ufbx expose materials:
|
|
13451
|
+
* `fbx` (the classic Lambert/Phong parameters) and `pbr` (a physically based parameter set), plus feature flags.
|
|
13452
|
+
*/
|
|
13453
|
+
export type FBXShaderType = "unknown" | "fbxLambert" | "fbxPhong" | "oslStandardSurface" | "arnoldStandardSurface" | "3dsMaxPhysicalMaterial" | "3dsMaxPbrMetalRough" | "3dsMaxPbrSpecGloss" | "gltfMaterial" | "openPbrMaterial" | "shaderFxGraph";
|
|
13454
|
+
/** One resolved material parameter: a constant value and/or a texture. */
|
|
13455
|
+
export interface FBXMaterialMap<TTexture> {
|
|
13456
|
+
/** Constant value (r,g,b,a for colours, x for scalars) */
|
|
13457
|
+
value?: number[];
|
|
13458
|
+
/** Number of meaningful components in `value` (1 for scalars, 3 or 4 for colours) */
|
|
13459
|
+
valueComponents: number;
|
|
13460
|
+
/** Texture bound to the parameter */
|
|
13461
|
+
texture?: TTexture;
|
|
13462
|
+
/** Whether the texture is enabled (some vendors carry an explicit toggle) */
|
|
13463
|
+
textureEnabled: boolean;
|
|
13464
|
+
}
|
|
13465
|
+
export type FBXFbxMapName = "diffuseFactor" | "diffuseColor" | "specularFactor" | "specularColor" | "specularExponent" | "reflectionFactor" | "reflectionColor" | "transparencyFactor" | "transparencyColor" | "emissionFactor" | "emissionColor" | "ambientFactor" | "ambientColor" | "normalMap" | "bump" | "bumpFactor" | "displacement" | "displacementFactor" | "vectorDisplacement" | "vectorDisplacementFactor";
|
|
13466
|
+
export type FBXPbrMapName = "baseFactor" | "baseColor" | "roughness" | "metalness" | "diffuseRoughness" | "specularFactor" | "specularColor" | "specularIor" | "specularAnisotropy" | "specularRotation" | "transmissionFactor" | "transmissionColor" | "transmissionDepth" | "transmissionScatter" | "transmissionScatterAnisotropy" | "transmissionDispersion" | "transmissionRoughness" | "transmissionExtraRoughness" | "transmissionPriority" | "transmissionEnableInAov" | "subsurfaceFactor" | "subsurfaceColor" | "subsurfaceRadius" | "subsurfaceScale" | "subsurfaceAnisotropy" | "subsurfaceTintColor" | "subsurfaceType" | "sheenFactor" | "sheenColor" | "sheenRoughness" | "coatFactor" | "coatColor" | "coatRoughness" | "coatIor" | "coatAnisotropy" | "coatRotation" | "coatNormal" | "coatAffectBaseColor" | "coatAffectBaseRoughness" | "thinFilmFactor" | "thinFilmThickness" | "thinFilmIor" | "emissionFactor" | "emissionColor" | "opacity" | "indirectDiffuse" | "indirectSpecular" | "normalMap" | "tangentMap" | "displacementMap" | "matteFactor" | "matteColor" | "ambientOcclusion" | "glossiness" | "coatGlossiness" | "transmissionGlossiness";
|
|
13467
|
+
export type FBXMaterialFeatureName = "pbr" | "metalness" | "diffuse" | "specular" | "emission" | "transmission" | "coat" | "sheen" | "opacity" | "ambientOcclusion" | "matte" | "unlit" | "ior" | "diffuseRoughness" | "transmissionRoughness" | "thinWalled" | "caustics" | "exitToBackground" | "internalReflections" | "doubleSided" | "roughnessAsGlossiness" | "coatRoughnessAsGlossiness" | "transmissionRoughnessAsGlossiness";
|
|
13468
|
+
export interface FBXMaterialModel<TTexture> {
|
|
13469
|
+
shaderType: FBXShaderType;
|
|
13470
|
+
/** Prefix material property names carry for this shader (e.g. "3dsMax|Parameters|") */
|
|
13471
|
+
shaderPropPrefix: string;
|
|
13472
|
+
fbx: Partial<Record<FBXFbxMapName, FBXMaterialMap<TTexture>>>;
|
|
13473
|
+
pbr: Partial<Record<FBXPbrMapName, FBXMaterialMap<TTexture>>>;
|
|
13474
|
+
features: Partial<Record<FBXMaterialFeatureName, {
|
|
13475
|
+
enabled: boolean;
|
|
13476
|
+
explicit: boolean;
|
|
13477
|
+
}>>;
|
|
13478
|
+
}
|
|
13479
|
+
/** Inputs needed to resolve a material, independent of the parse representation. */
|
|
13480
|
+
export interface FBXMaterialSource<TTexture> {
|
|
13481
|
+
/** "lambert", "phong", "unknown", ... as written in the file */
|
|
13482
|
+
shadingModelName: string;
|
|
13483
|
+
/** Property values by full property name (e.g. "DiffuseColor", "Maya|baseColor", "3dsMax|Parameters|roughness") */
|
|
13484
|
+
props: Map<string, {
|
|
13485
|
+
type: string;
|
|
13486
|
+
values: FBXPropertyValue[];
|
|
13487
|
+
}>;
|
|
13488
|
+
/** Textures connected to the material by property name (OP connection property) */
|
|
13489
|
+
texturesByProp: Map<string, TTexture>;
|
|
13490
|
+
/** Connected shader implementation, when any */
|
|
13491
|
+
shader?: {
|
|
13492
|
+
renderApi: string;
|
|
13493
|
+
/** shader semantic name -> material property names */
|
|
13494
|
+
bindings: Map<string, string[]>;
|
|
13495
|
+
};
|
|
13496
|
+
}
|
|
13497
|
+
/** Shader types whose parameters are physically based; the loader emits PBR materials for them by default. */
|
|
13498
|
+
export function isPbrShaderType(type: FBXShaderType): boolean;
|
|
13499
|
+
/** Detects the shader flavour of a material from its shading model name, connected shader and 3ds Max class ids. */
|
|
13500
|
+
export function detectShaderType<T>(source: FBXMaterialSource<T>): {
|
|
13501
|
+
shaderType: FBXShaderType;
|
|
13502
|
+
shaderPropPrefix: string;
|
|
13503
|
+
};
|
|
13504
|
+
/**
|
|
13505
|
+
* Resolves the unified material model from raw material data.
|
|
13506
|
+
*/
|
|
13507
|
+
export function resolveMaterialModel<T>(source: FBXMaterialSource<T>): FBXMaterialModel<T>;
|
|
13508
|
+
/** Colour (first three components) of a map, or undefined. */
|
|
13509
|
+
export function mapColor<T>(map: FBXMaterialMap<T> | undefined): [number, number, number] | undefined;
|
|
13510
|
+
/** Scalar (first component) of a map, or undefined. */
|
|
13511
|
+
export function mapScalar<T>(map: FBXMaterialMap<T> | undefined): number | undefined;
|
|
13512
|
+
|
|
13513
|
+
|
|
13514
|
+
/**
|
|
13515
|
+
* FBX 5.x (and older) documents store everything at the top level: one `Model` node per object with inline
|
|
13516
|
+
* geometry, materials, skin links, lights and cameras, and `Children` lists instead of connections. This module
|
|
13517
|
+
* rewrites such a document into the 6.x layout (`Objects`, `Connections`, `Takes`) so the rest of the importer
|
|
13518
|
+
* can treat both the same way. The rules follow the FBX SDK's legacy reader as implemented by ufbx.
|
|
13519
|
+
*/
|
|
13520
|
+
/** True for pre-6000 files: no `Objects` section but top-level `Model` nodes. */
|
|
13521
|
+
export function isLegacyDocument(doc: FBXDocument): boolean;
|
|
13522
|
+
/** Rewrites a legacy document into the 6.x object/connection layout. */
|
|
13523
|
+
export function upgradeLegacyDocument(doc: FBXDocument): FBXDocument;
|
|
12390
13524
|
|
|
12391
13525
|
|
|
12392
13526
|
/** A named UV set */
|
|
@@ -12399,7 +13533,7 @@ declare namespace BABYLON {
|
|
|
12399
13533
|
/** Recoverable geometry import issue. */
|
|
12400
13534
|
export interface FBXGeometryDiagnostic {
|
|
12401
13535
|
/** Diagnostic category. */
|
|
12402
|
-
type: "degenerate-polygon" | "triangulation-fallback" | "layer-index-out-of-bounds" | "layer-data-too-short";
|
|
13536
|
+
type: "degenerate-polygon" | "triangulation-fallback" | "layer-index-out-of-bounds" | "layer-data-too-short" | "nurbs-invalid" | "nurbs-trim-ignored" | "nurbs-deformer-ignored";
|
|
12403
13537
|
/** Human-readable diagnostic message. */
|
|
12404
13538
|
message: string;
|
|
12405
13539
|
/** Polygon index associated with the diagnostic, if applicable. */
|
|
@@ -12450,8 +13584,10 @@ declare namespace BABYLON {
|
|
|
12450
13584
|
id: number;
|
|
12451
13585
|
name: string;
|
|
12452
13586
|
subType: string;
|
|
12453
|
-
/** Geometry attached to this model (
|
|
13587
|
+
/** Geometry attached to this model (meshes and tessellated NURBS surfaces) */
|
|
12454
13588
|
geometry?: FBXGeometryData;
|
|
13589
|
+
/** Curve geometry attached to this model (Line and NurbsCurve) */
|
|
13590
|
+
curve?: FBXCurveGeometryData;
|
|
12455
13591
|
/** Materials assigned to this model */
|
|
12456
13592
|
materials: FBXMaterialData[];
|
|
12457
13593
|
/** Child models */
|
|
@@ -12483,18 +13619,68 @@ declare namespace BABYLON {
|
|
|
12483
13619
|
/** Whether backface culling is disabled ("CullingOff") */
|
|
12484
13620
|
cullingOff: boolean;
|
|
12485
13621
|
/** User-defined custom properties from Properties70 */
|
|
12486
|
-
customProperties?: Record<string,
|
|
13622
|
+
customProperties?: Record<string, FBXUserPropertyValue>;
|
|
13623
|
+
/** LOD group settings when this model is a LodGroup; children are the levels in order */
|
|
13624
|
+
lodGroup?: FBXLodGroupData;
|
|
13625
|
+
/** Display layer (CollectionExclusive) the model belongs to */
|
|
13626
|
+
displayLayer?: FBXDisplayLayerData;
|
|
12487
13627
|
/** Recoverable model import diagnostics */
|
|
12488
13628
|
diagnostics: string[];
|
|
12489
13629
|
}
|
|
13630
|
+
/** LOD group settings (NodeAttribute "LodGroup") */
|
|
13631
|
+
export interface FBXLodGroupData {
|
|
13632
|
+
/** Switch distance for level i+1 (level 0 has none). In scene units, or percent of screen when `relative`. */
|
|
13633
|
+
thresholds: number[];
|
|
13634
|
+
/** ThresholdsUsedAsPercentage */
|
|
13635
|
+
relative: boolean;
|
|
13636
|
+
/** DisplayLevels|LevelN: 0 use LOD, 1 show, 2 hide */
|
|
13637
|
+
displayLevels: number[];
|
|
13638
|
+
}
|
|
13639
|
+
/** Display layer (CollectionExclusive "DisplayLayer") */
|
|
13640
|
+
export interface FBXDisplayLayerData {
|
|
13641
|
+
id: number;
|
|
13642
|
+
name: string;
|
|
13643
|
+
show: boolean;
|
|
13644
|
+
freeze: boolean;
|
|
13645
|
+
color: [number, number, number];
|
|
13646
|
+
modelIds: number[];
|
|
13647
|
+
}
|
|
13648
|
+
/** One member of a selection set: a model, optionally with a component selection on its mesh */
|
|
13649
|
+
export interface FBXSelectionNodeData {
|
|
13650
|
+
modelId: number;
|
|
13651
|
+
/** IsTheNodeInSet: the whole node is selected (as opposed to only components) */
|
|
13652
|
+
includeNode: boolean;
|
|
13653
|
+
/** Selected control point indices (VertexIndexArray) */
|
|
13654
|
+
vertices?: number[];
|
|
13655
|
+
/** Selected edge indices (EdgeIndexArray) */
|
|
13656
|
+
edges?: number[];
|
|
13657
|
+
/** Selected polygon indices (PolygonIndexArray) */
|
|
13658
|
+
faces?: number[];
|
|
13659
|
+
}
|
|
13660
|
+
/** Selection set (Collection "SelectionSet") */
|
|
13661
|
+
export interface FBXSelectionSetData {
|
|
13662
|
+
id: number;
|
|
13663
|
+
name: string;
|
|
13664
|
+
members: FBXSelectionNodeData[];
|
|
13665
|
+
}
|
|
12490
13666
|
/** Camera data extracted from FBX */
|
|
12491
13667
|
export interface FBXCameraData {
|
|
12492
13668
|
/** Model ID this camera is attached to */
|
|
12493
13669
|
modelId: number;
|
|
13670
|
+
/** NodeAttribute object ID (animation curves target this) */
|
|
13671
|
+
attributeId: number;
|
|
12494
13672
|
/** Camera name */
|
|
12495
13673
|
name: string;
|
|
12496
|
-
/**
|
|
13674
|
+
/** Vertical field of view in degrees */
|
|
12497
13675
|
fieldOfView: number;
|
|
13676
|
+
/** Horizontal field of view in degrees */
|
|
13677
|
+
fieldOfViewX: number;
|
|
13678
|
+
/** ApertureMode: 0 horizontal and vertical, 1 horizontal, 2 vertical, 3 focal length */
|
|
13679
|
+
apertureMode: number;
|
|
13680
|
+
/** Aperture (film gate after gate fit) size in inches */
|
|
13681
|
+
apertureSizeInch: [number, number];
|
|
13682
|
+
/** Orthographic view size (width, height) in scene units */
|
|
13683
|
+
orthographicSize: [number, number];
|
|
12498
13684
|
/** Near clip plane */
|
|
12499
13685
|
nearPlane: number;
|
|
12500
13686
|
/** Far clip plane */
|
|
@@ -12513,6 +13699,8 @@ declare namespace BABYLON {
|
|
|
12513
13699
|
orthoZoom?: number;
|
|
12514
13700
|
/** Camera roll in degrees when present */
|
|
12515
13701
|
roll?: number;
|
|
13702
|
+
/** User-defined properties on the camera attribute */
|
|
13703
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
12516
13704
|
/** Known unsupported or unrecognized camera properties */
|
|
12517
13705
|
unknownProperties: string[];
|
|
12518
13706
|
/** Recoverable camera import diagnostics */
|
|
@@ -12522,6 +13710,8 @@ declare namespace BABYLON {
|
|
|
12522
13710
|
export interface FBXLightData {
|
|
12523
13711
|
/** Model ID this light is attached to */
|
|
12524
13712
|
modelId: number;
|
|
13713
|
+
/** NodeAttribute object ID (animation curves target this) */
|
|
13714
|
+
attributeId: number;
|
|
12525
13715
|
/** Light name */
|
|
12526
13716
|
name: string;
|
|
12527
13717
|
/** Light type: 0=Point, 1=Directional, 2=Spot */
|
|
@@ -12546,6 +13736,15 @@ declare namespace BABYLON {
|
|
|
12546
13736
|
enableFarAttenuation?: boolean;
|
|
12547
13737
|
/** Whether the source light requested shadow casting */
|
|
12548
13738
|
castShadows?: boolean;
|
|
13739
|
+
/** Near/far attenuation ranges in scene units (when enabled) */
|
|
13740
|
+
nearAttenuationStart?: number;
|
|
13741
|
+
nearAttenuationEnd?: number;
|
|
13742
|
+
farAttenuationStart?: number;
|
|
13743
|
+
farAttenuationEnd?: number;
|
|
13744
|
+
/** Area light shape: 0 rectangle, 1 sphere */
|
|
13745
|
+
areaLightShape?: number;
|
|
13746
|
+
/** User-defined properties on the light attribute */
|
|
13747
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
12549
13748
|
/** Known unsupported or unrecognized light properties */
|
|
12550
13749
|
unknownProperties: string[];
|
|
12551
13750
|
/** Recoverable light import diagnostics */
|
|
@@ -12557,6 +13756,8 @@ declare namespace BABYLON {
|
|
|
12557
13756
|
rootModels: FBXModelData[];
|
|
12558
13757
|
/** All geometries in the scene */
|
|
12559
13758
|
geometries: FBXGeometryData[];
|
|
13759
|
+
/** All curve geometries (lines and tessellated NURBS curves) */
|
|
13760
|
+
curves: FBXCurveGeometryData[];
|
|
12560
13761
|
/** All materials in the scene */
|
|
12561
13762
|
materials: FBXMaterialData[];
|
|
12562
13763
|
/** Skin deformers (skeletons + vertex weights) */
|
|
@@ -12573,6 +13774,12 @@ declare namespace BABYLON {
|
|
|
12573
13774
|
lights: FBXLightData[];
|
|
12574
13775
|
/** Scene-level unsupported feature diagnostics */
|
|
12575
13776
|
diagnostics: FBXSceneDiagnostic[];
|
|
13777
|
+
/** Constraints (aim, parent, position, rotation, scale, IK) */
|
|
13778
|
+
constraints: FBXConstraintData[];
|
|
13779
|
+
/** Display layers */
|
|
13780
|
+
displayLayers: FBXDisplayLayerData[];
|
|
13781
|
+
/** Selection sets */
|
|
13782
|
+
selectionSets: FBXSelectionSetData[];
|
|
12576
13783
|
/** Global settings */
|
|
12577
13784
|
upAxis: number;
|
|
12578
13785
|
upAxisSign: number;
|
|
@@ -12581,11 +13788,89 @@ declare namespace BABYLON {
|
|
|
12581
13788
|
coordAxis: number;
|
|
12582
13789
|
coordAxisSign: number;
|
|
12583
13790
|
unitScaleFactor: number;
|
|
13791
|
+
/** Scene frame rate derived from GlobalSettings TimeMode / CustomFrameRate */
|
|
13792
|
+
frameRate: number;
|
|
12584
13793
|
}
|
|
12585
13794
|
/**
|
|
12586
13795
|
* Interpret a parsed FBX document into scene data.
|
|
12587
13796
|
*/
|
|
12588
|
-
|
|
13797
|
+
/** Options controlling how the document is interpreted. */
|
|
13798
|
+
export interface FBXInterpretOptions {
|
|
13799
|
+
/** Segments per knot span when tessellating NURBS surfaces; defaults to the Step stored in the file */
|
|
13800
|
+
nurbsSubdivision?: number;
|
|
13801
|
+
/** Shift every clip so its first key sits at time 0 (default true); false keeps the authored times */
|
|
13802
|
+
rebaseKeyframes?: boolean;
|
|
13803
|
+
}
|
|
13804
|
+
export function interpretFBX(doc: FBXDocument, options?: FBXInterpretOptions): FBXSceneData;
|
|
13805
|
+
|
|
13806
|
+
|
|
13807
|
+
export type FBXConstraintType = "aim" | "parent" | "position" | "rotation" | "scale" | "singleChainIK" | "unknown";
|
|
13808
|
+
export type Vec3 = [number, number, number];
|
|
13809
|
+
export type Bool3 = [boolean, boolean, boolean];
|
|
13810
|
+
/** One weighted target of a constraint. */
|
|
13811
|
+
export interface FBXConstraintTarget {
|
|
13812
|
+
/** Model id of the target node */
|
|
13813
|
+
modelId: number;
|
|
13814
|
+
/** Normalized weight (file value / 100, or as-is for IK pole targets) */
|
|
13815
|
+
weight: number;
|
|
13816
|
+
/** Parent constraint translation offset expressed in the target's space */
|
|
13817
|
+
offsetTranslation: Vec3;
|
|
13818
|
+
/** Parent constraint rotation offset in degrees, expressed in the target's space */
|
|
13819
|
+
offsetRotation: Vec3;
|
|
13820
|
+
/** Parent constraint scale offset expressed in the target's space */
|
|
13821
|
+
offsetScale: Vec3;
|
|
13822
|
+
}
|
|
13823
|
+
/** A constraint object of the file, with its targets and parameters resolved. */
|
|
13824
|
+
export interface FBXConstraintData {
|
|
13825
|
+
/** Constraint object id */
|
|
13826
|
+
id: number;
|
|
13827
|
+
/** Constraint name */
|
|
13828
|
+
name: string;
|
|
13829
|
+
/** Resolved constraint kind */
|
|
13830
|
+
type: FBXConstraintType;
|
|
13831
|
+
/** Constraint type name as written in the file (e.g. "Parent-Child") */
|
|
13832
|
+
typeName: string;
|
|
13833
|
+
/** Constrained model */
|
|
13834
|
+
nodeId?: number;
|
|
13835
|
+
/** Weighted targets in file order */
|
|
13836
|
+
targets: FBXConstraintTarget[];
|
|
13837
|
+
/** Global weight (file value / 100) */
|
|
13838
|
+
weight: number;
|
|
13839
|
+
/** False when the constraint is switched off in the file */
|
|
13840
|
+
active: boolean;
|
|
13841
|
+
/** Which translation axes the constraint drives */
|
|
13842
|
+
affectTranslation: Bool3;
|
|
13843
|
+
/** Which rotation axes the constraint drives */
|
|
13844
|
+
affectRotation: Bool3;
|
|
13845
|
+
/** Which scale axes the constraint drives */
|
|
13846
|
+
affectScale: Bool3;
|
|
13847
|
+
/** Translation offset of the constrained node */
|
|
13848
|
+
offsetTranslation: Vec3;
|
|
13849
|
+
/** Rotation offset of the constrained node, in degrees */
|
|
13850
|
+
offsetRotation: Vec3;
|
|
13851
|
+
/** Scale offset of the constrained node */
|
|
13852
|
+
offsetScale: Vec3;
|
|
13853
|
+
/** Aim: local axis that points at the target */
|
|
13854
|
+
aimVector: Vec3;
|
|
13855
|
+
/** Aim: local axis aligned with the up direction */
|
|
13856
|
+
upVector: Vec3;
|
|
13857
|
+
/** Aim: world up direction (world up modes 2 and 3) */
|
|
13858
|
+
worldUpVector: Vec3;
|
|
13859
|
+
/** Aim: 0 scene up, 1 aim up node, 2 align to node, 3 vector, 4 none */
|
|
13860
|
+
worldUpType: number;
|
|
13861
|
+
/** Aim: model id of the world up object (world up modes 1 and 2) */
|
|
13862
|
+
worldUpNodeId?: number;
|
|
13863
|
+
/** Single chain IK: model id of the first joint of the chain */
|
|
13864
|
+
ikFirstJointId?: number;
|
|
13865
|
+
/** Single chain IK: model id of the last joint of the chain */
|
|
13866
|
+
ikEndJointId?: number;
|
|
13867
|
+
/** Single chain IK: model id of the effector */
|
|
13868
|
+
ikEffectorId?: number;
|
|
13869
|
+
/** Single chain IK: pole vector */
|
|
13870
|
+
ikPoleVector: Vec3;
|
|
13871
|
+
}
|
|
13872
|
+
/** Reads every constraint object of the scene. */
|
|
13873
|
+
export function extractConstraints(objectMap: FBXObjectMap): FBXConstraintData[];
|
|
12589
13874
|
|
|
12590
13875
|
|
|
12591
13876
|
/** Connection type: OO = object-to-object, OP = object-to-property */
|
|
@@ -12608,7 +13893,7 @@ declare namespace BABYLON {
|
|
|
12608
13893
|
/** Object node. */
|
|
12609
13894
|
node: FBXNode;
|
|
12610
13895
|
/** Source of the object entry. */
|
|
12611
|
-
source: "Objects" | "legacySyntheticGeometry";
|
|
13896
|
+
source: "Objects" | "legacySyntheticGeometry" | "legacySyntheticAttribute" | "legacySyntheticBlendShape";
|
|
12612
13897
|
/** Legacy string object name, when applicable. */
|
|
12613
13898
|
legacyName?: string;
|
|
12614
13899
|
/** True if the object was synthesized for legacy compatibility. */
|
|
@@ -12729,7 +14014,23 @@ declare namespace BABYLON {
|
|
|
12729
14014
|
export function extractBlendShapes(objectMap: FBXObjectMap): FBXBlendShapeData[];
|
|
12730
14015
|
|
|
12731
14016
|
|
|
14017
|
+
/**
|
|
14018
|
+
* FBX animation curve model and evaluator.
|
|
14019
|
+
*
|
|
14020
|
+
* Keys carry cubic Bezier tangents expressed the way the FBX SDK stores them: a left and right tangent with a time
|
|
14021
|
+
* extent (dx, as a fraction of the segment scaled by the tangent weight) and a value extent (dy). Linear and constant
|
|
14022
|
+
* segments are represented the same way so that a single evaluator handles every case, including the weighted
|
|
14023
|
+
* tangents Maya and MotionBuilder write, TCB keys, and the pre/post extrapolation modes.
|
|
14024
|
+
*/
|
|
14025
|
+
/** FBX time units: 46186158000 ticks per second */
|
|
14026
|
+
export const FBX_TIME_UNIT = 46186158000;
|
|
12732
14027
|
export type FBXInterpolationType = "constant" | "linear" | "cubic";
|
|
14028
|
+
export type FBXExtrapolationMode = "constant" | "repeat" | "mirror" | "slope" | "repeatRelative";
|
|
14029
|
+
export interface FBXExtrapolation {
|
|
14030
|
+
mode: FBXExtrapolationMode;
|
|
14031
|
+
/** Number of repetitions, or -1 for infinite */
|
|
14032
|
+
repeatCount: number;
|
|
14033
|
+
}
|
|
12733
14034
|
/** A single keyframe */
|
|
12734
14035
|
export interface FBXKeyframe {
|
|
12735
14036
|
/** Time in seconds */
|
|
@@ -12740,9 +14041,15 @@ declare namespace BABYLON {
|
|
|
12740
14041
|
interpolation: FBXInterpolationType;
|
|
12741
14042
|
/** Constant interpolation variant */
|
|
12742
14043
|
constantMode?: "standard" | "next";
|
|
12743
|
-
/**
|
|
14044
|
+
/** Left (incoming) tangent: time extent in seconds and value extent */
|
|
14045
|
+
leftDx: number;
|
|
14046
|
+
leftDy: number;
|
|
14047
|
+
/** Right (outgoing) tangent: time extent in seconds and value extent */
|
|
14048
|
+
rightDx: number;
|
|
14049
|
+
rightDy: number;
|
|
14050
|
+
/** Cubic outgoing slope in value units per second (derived, kept for consumers that export hermite keys) */
|
|
12744
14051
|
rightSlope?: number;
|
|
12745
|
-
/** Cubic incoming slope for the next key, in value units per second */
|
|
14052
|
+
/** Cubic incoming slope for the next key, in value units per second (derived) */
|
|
12746
14053
|
nextLeftSlope?: number;
|
|
12747
14054
|
}
|
|
12748
14055
|
/** An animation curve (one axis of one property) */
|
|
@@ -12753,7 +14060,53 @@ declare namespace BABYLON {
|
|
|
12753
14060
|
keys: FBXKeyframe[];
|
|
12754
14061
|
/** True for baked sample curves that should be connected as linear samples */
|
|
12755
14062
|
isSampled?: boolean;
|
|
14063
|
+
preExtrapolation?: FBXExtrapolation;
|
|
14064
|
+
postExtrapolation?: FBXExtrapolation;
|
|
14065
|
+
}
|
|
14066
|
+
/** Raw key attribute data for one key, after run-length decoding. */
|
|
14067
|
+
export interface FBXKeyAttributes {
|
|
14068
|
+
flags: number;
|
|
14069
|
+
data: [number, number, number, number];
|
|
14070
|
+
}
|
|
14071
|
+
/**
|
|
14072
|
+
* Builds keyframes from parallel time/value arrays and their (run-length encoded) attributes, resolving every
|
|
14073
|
+
* tangent mode the FBX SDK writes: user, broken, auto (with clamp / progressive clamp / time-independent flags and
|
|
14074
|
+
* auto bias), TCB, weighted, linear and constant.
|
|
14075
|
+
*/
|
|
14076
|
+
export function buildKeyframes(times: ArrayLike<number>, values: ArrayLike<number>, attributes: (index: number) => FBXKeyAttributes): FBXKeyframe[];
|
|
14077
|
+
/** Auto tangent as the FBX SDK computes it, including clamping and auto bias. */
|
|
14078
|
+
export function solveAutoTangent(prevTime: number, time: number, nextTime: number, prevValue: number, value: number, nextValue: number, weightLeft: number, weightRight: number, autoBias: number, flags: number): number;
|
|
14079
|
+
/** Builds a keyframe list from explicit per-key slopes (legacy Takes and synthetic curves). */
|
|
14080
|
+
export function keyframesFromSlopes(times: number[], values: number[], interpolation: FBXInterpolationType[], constantNext: boolean[], leftSlope: number[], rightSlope: number[], leftWeight?: number[], rightWeight?: number[]): FBXKeyframe[];
|
|
14081
|
+
/** Reads a `Pre-Extrapolation` / `Post-Extrapolation` block: `Type` is a character code, `Repetition` a count. */
|
|
14082
|
+
export function parseExtrapolation(typeValue: unknown, repetitionValue: unknown): FBXExtrapolation;
|
|
14083
|
+
export function evaluateCurve(curve: FBXCurveData | undefined, time: number, defaultValue: number, noExtrapolation?: boolean): number;
|
|
14084
|
+
export type Vec3 = [number, number, number];
|
|
14085
|
+
export type Quat = [number, number, number, number];
|
|
14086
|
+
/** Euler angles in degrees with an FBX rotation order (0=XYZ ... 5=ZYX; spheric falls back to XYZ) to a quaternion. */
|
|
14087
|
+
export function eulerToQuat(v: Vec3, order: number): Quat;
|
|
14088
|
+
/** Quaternion to Euler angles in degrees for an FBX rotation order (inverse of eulerToQuat). */
|
|
14089
|
+
export function quatToEuler(q: Quat, order: number): Vec3;
|
|
14090
|
+
/** Blend semantics of an animation layer, derived from its BlendMode and accumulation modes. */
|
|
14091
|
+
export interface FBXLayerBlend {
|
|
14092
|
+
/** Layer participates in blending (BlendMode Additive or Override Passthrough) */
|
|
14093
|
+
blended: boolean;
|
|
14094
|
+
/** Layer adds onto the result instead of replacing it (BlendMode Additive) */
|
|
14095
|
+
additive: boolean;
|
|
14096
|
+
/** Rotations compose as quaternions (RotationAccumulationMode ByLayer) */
|
|
14097
|
+
composeRotation: boolean;
|
|
14098
|
+
/** Scales compose multiplicatively (ScaleAccumulationMode Multiply) */
|
|
14099
|
+
composeScale: boolean;
|
|
14100
|
+
/** Layer weight in [0, 1] */
|
|
14101
|
+
weight: number;
|
|
12756
14102
|
}
|
|
14103
|
+
/**
|
|
14104
|
+
* Combines one animation layer's value into the running result, exactly as the FBX SDK evaluator does.
|
|
14105
|
+
* `kind` selects the accumulation rule: "R" rotations (degrees, rotation order given), "S" scales, anything else linear.
|
|
14106
|
+
*/
|
|
14107
|
+
export function combineLayerValue(result: Vec3, value: Vec3, layer: FBXLayerBlend, kind: "T" | "R" | "S" | "other", rotationOrder: number): Vec3;
|
|
14108
|
+
|
|
14109
|
+
|
|
12757
14110
|
/** An animation curve node (T/R/S for one bone) */
|
|
12758
14111
|
export interface FBXCurveNodeData {
|
|
12759
14112
|
/** Property type: "T" (translation), "R" (rotation), "S" (scale) */
|
|
@@ -12762,13 +14115,19 @@ declare namespace BABYLON {
|
|
|
12762
14115
|
targetModelId: number;
|
|
12763
14116
|
/** Curves for each axis */
|
|
12764
14117
|
curves: FBXCurveData[];
|
|
14118
|
+
/** Index of the owning layer within the stack's layer list */
|
|
14119
|
+
layerIndex: number;
|
|
14120
|
+
/** Default channel values (`d|X`, `d|Y`, `d|Z`) used for channels without a curve */
|
|
14121
|
+
defaultValues?: [number, number, number];
|
|
12765
14122
|
}
|
|
12766
|
-
/**
|
|
14123
|
+
/** Non-transform animation curve node (property animation), evaluated by the loader when a Babylon mapping exists. */
|
|
12767
14124
|
export interface FBXUnsupportedCurveNodeData {
|
|
12768
14125
|
/** Raw AnimationCurveNode property type/name */
|
|
12769
14126
|
type: string;
|
|
12770
14127
|
/** CurveNode object ID */
|
|
12771
14128
|
id: number;
|
|
14129
|
+
/** Index of the owning layer within the stack's layer list */
|
|
14130
|
+
layerIndex: number;
|
|
12772
14131
|
/** Target object ID if the curve node is connected to an object/property */
|
|
12773
14132
|
targetId: number | null;
|
|
12774
14133
|
/** OP connection property name on the target, e.g. Visibility */
|
|
@@ -12807,6 +14166,10 @@ declare namespace BABYLON {
|
|
|
12807
14166
|
normalizedWeight: number;
|
|
12808
14167
|
/** Blend mode: 0=Additive, 1=Override, 2=OverridePassthrough */
|
|
12809
14168
|
blendMode: number;
|
|
14169
|
+
/** Resolved blend semantics used by the evaluator */
|
|
14170
|
+
blend: FBXLayerBlend;
|
|
14171
|
+
/** Animated layer weight (0-100), when the Weight property carries a curve */
|
|
14172
|
+
weightCurve?: FBXCurveData;
|
|
12810
14173
|
/** Curve nodes in this layer */
|
|
12811
14174
|
curveNodes: FBXCurveNodeData[];
|
|
12812
14175
|
/** Unsupported/non-TRS curve nodes preserved for diagnostics */
|
|
@@ -12814,6 +14177,14 @@ declare namespace BABYLON {
|
|
|
12814
14177
|
/** Recoverable layer diagnostics */
|
|
12815
14178
|
diagnostics: FBXAnimationDiagnostic[];
|
|
12816
14179
|
}
|
|
14180
|
+
/** Options for animation extraction. */
|
|
14181
|
+
export interface FBXAnimationExtractOptions {
|
|
14182
|
+
/**
|
|
14183
|
+
* Shift each clip so its first key sits at time 0 (default true). False keeps the times authored in the file, so
|
|
14184
|
+
* clips of one file stay aligned with each other and with the declared stack range.
|
|
14185
|
+
*/
|
|
14186
|
+
rebaseKeyframes?: boolean;
|
|
14187
|
+
}
|
|
12817
14188
|
/** One animation clip (AnimationStack) */
|
|
12818
14189
|
export interface FBXAnimationStackData {
|
|
12819
14190
|
/** Animation name */
|
|
@@ -12836,13 +14207,7 @@ declare namespace BABYLON {
|
|
|
12836
14207
|
/**
|
|
12837
14208
|
* Extract all animation stacks from the FBX scene.
|
|
12838
14209
|
*/
|
|
12839
|
-
export function extractAnimations(objectMap: FBXObjectMap): FBXAnimationStackData[];
|
|
12840
|
-
/**
|
|
12841
|
-
* Determines whether a key sequence appears to be a uniformly frame-baked sampled curve.
|
|
12842
|
-
* @param keys - Keyframes to inspect
|
|
12843
|
-
* @returns true if the keys look like sampled frame data rather than authored interpolation
|
|
12844
|
-
*/
|
|
12845
|
-
export function isFrameBakedSampledCurve(keys: readonly FBXKeyframe[]): boolean;
|
|
14210
|
+
export function extractAnimations(objectMap: FBXObjectMap, doc?: FBXDocument, options?: FBXAnimationExtractOptions): FBXAnimationStackData[];
|
|
12846
14211
|
/**
|
|
12847
14212
|
* Samples an FBX animation curve at a specific time.
|
|
12848
14213
|
* @param curveData - Curve data to sample
|
|
@@ -12850,6 +14215,54 @@ declare namespace BABYLON {
|
|
|
12850
14215
|
* @returns The sampled value, or null when the curve has no keys
|
|
12851
14216
|
*/
|
|
12852
14217
|
export function sampleFBXCurveAtTime(curveData: FBXCurveData | undefined, time: number): number | null;
|
|
14218
|
+
/**
|
|
14219
|
+
* Pre-7000 files store animation in a top-level `Takes` block instead of AnimationStack/Layer/CurveNode objects:
|
|
14220
|
+
*
|
|
14221
|
+
* Takes: { Take: "name" { LocalTime: start, stop
|
|
14222
|
+
* Model: "Model::joint1" { Channel: "Transform" { Channel: "T" { Channel: "X" { Default, KeyVer, KeyCount, Key } } } } } }
|
|
14223
|
+
*
|
|
14224
|
+
* Each take becomes one animation stack with a single layer. Models are matched through the same legacy string ids
|
|
14225
|
+
* that the connection resolver synthesizes for 6.x objects.
|
|
14226
|
+
*/
|
|
14227
|
+
export function extractLegacyTakes(doc: FBXDocument, objectMap: FBXObjectMap, rebaseKeyframes?: boolean): FBXAnimationStackData[];
|
|
14228
|
+
/**
|
|
14229
|
+
* Evaluates one transform channel (T, R or S) of a target at `time`, blending every animation layer of the stack the
|
|
14230
|
+
* way the FBX SDK does: the first layer animating the channel replaces the static value, later layers are combined
|
|
14231
|
+
* according to their blend mode, weight and accumulation modes.
|
|
14232
|
+
* @param curveNodes - Curve nodes targeting this model (any layers, any types)
|
|
14233
|
+
* @param layers - Stack layers, in order
|
|
14234
|
+
* @param type - Channel to evaluate
|
|
14235
|
+
* @param staticValue - Value when nothing animates the channel
|
|
14236
|
+
* @param rotationOrder - Rotation order of the target (for rotation composition)
|
|
14237
|
+
* @param time - Time in seconds
|
|
14238
|
+
*/
|
|
14239
|
+
export function evaluateLayeredChannel(curveNodes: readonly FBXCurveNodeData[], layers: readonly FBXAnimationLayerData[], type: "T" | "R" | "S", staticValue: readonly [number, number, number], rotationOrder: number, time: number): [number, number, number];
|
|
14240
|
+
/** Curves of one animated property (or blend shape weight) contributed by one animation layer. */
|
|
14241
|
+
export interface FBXLayeredPropertySource {
|
|
14242
|
+
/** Index of the owning layer within the stack's layer list */
|
|
14243
|
+
layerIndex: number;
|
|
14244
|
+
/** Curves of the property, keyed by channel name (`d|X`, `d|DeformPercent`, ...) */
|
|
14245
|
+
curves: readonly FBXCurveData[];
|
|
14246
|
+
/** Default channel values stored on the curve node */
|
|
14247
|
+
defaultValues?: Record<string, number>;
|
|
14248
|
+
}
|
|
14249
|
+
/**
|
|
14250
|
+
* Evaluates an animated property through the animation layers: the base layer replaces the static value, every
|
|
14251
|
+
* further layer blends onto the running result according to its blend mode and (possibly animated) weight, like
|
|
14252
|
+
* `evaluateLayeredChannel` does for transforms.
|
|
14253
|
+
* @param sources - Per-layer curves of the property
|
|
14254
|
+
* @param layers - Stack layers, in order
|
|
14255
|
+
* @param channels - Channel names to evaluate, in output order
|
|
14256
|
+
* @param staticValue - Value per channel when nothing animates it
|
|
14257
|
+
* @param time - Time in seconds
|
|
14258
|
+
* @returns One value per channel
|
|
14259
|
+
*/
|
|
14260
|
+
export function evaluateLayeredProperty(sources: readonly FBXLayeredPropertySource[], layers: readonly FBXAnimationLayerData[], channels: readonly string[], staticValue: readonly number[], time: number): number[];
|
|
14261
|
+
/**
|
|
14262
|
+
* True when every curve of the given channel is inside a constant (stepped) segment at `time`, so a baked key at
|
|
14263
|
+
* that time should hold its value instead of interpolating towards the next sample.
|
|
14264
|
+
*/
|
|
14265
|
+
export function isChannelSteppedAt(curveNodes: readonly FBXCurveNodeData[], type: "T" | "R" | "S", time: number): boolean;
|
|
12853
14266
|
|
|
12854
14267
|
|
|
12855
14268
|
/** Pure barrel — re-exports only side-effect-free modules */
|