babylonjs-loaders 9.26.0 → 9.26.1
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/babylonjs.loaders.d.ts +942 -46
- package/babylonjs.loaders.es5.js +11586 -8295
- 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 +1924 -96
- package/package.json +3 -3
|
@@ -9085,7 +9085,7 @@ export * from "babylonjs-loaders/USD/usdFileLoader.pure";
|
|
|
9085
9085
|
}
|
|
9086
9086
|
declare module "babylonjs-loaders/USD/usdCommandProtocol" {
|
|
9087
9087
|
export const COMMAND_MAGIC = 1111774037;
|
|
9088
|
-
export const PROTOCOL_VERSION =
|
|
9088
|
+
export const PROTOCOL_VERSION = 5;
|
|
9089
9089
|
export const MISSING_OFFSET = 4294967295;
|
|
9090
9090
|
export enum Command {
|
|
9091
9091
|
Scene = 1,
|
|
@@ -9097,7 +9097,9 @@ export enum Command {
|
|
|
9097
9097
|
Mesh = 7,
|
|
9098
9098
|
Instance = 8,
|
|
9099
9099
|
Animation = 9,
|
|
9100
|
-
AnalyticPrimitive = 10
|
|
9100
|
+
AnalyticPrimitive = 10,
|
|
9101
|
+
ThinInstances = 11,
|
|
9102
|
+
MorphTarget = 12
|
|
9101
9103
|
}
|
|
9102
9104
|
export enum AnalyticPrimitiveType {
|
|
9103
9105
|
Cube = 0,
|
|
@@ -9112,19 +9114,33 @@ export enum PrimitiveAxis {
|
|
|
9112
9114
|
}
|
|
9113
9115
|
export enum AnimationTarget {
|
|
9114
9116
|
Node = 0,
|
|
9115
|
-
Bone = 1
|
|
9117
|
+
Bone = 1,
|
|
9118
|
+
MorphTarget = 2
|
|
9116
9119
|
}
|
|
9117
9120
|
export enum AnimationProperty {
|
|
9118
9121
|
Position = 0,
|
|
9119
9122
|
RotationQuaternion = 1,
|
|
9120
9123
|
Scaling = 2,
|
|
9121
|
-
Matrix = 3
|
|
9124
|
+
Matrix = 3,
|
|
9125
|
+
Influence = 4
|
|
9122
9126
|
}
|
|
9123
9127
|
export enum MaterialFlags {
|
|
9124
9128
|
DoubleSided = 1,
|
|
9125
9129
|
Unlit = 2,
|
|
9126
9130
|
AlphaBlend = 4
|
|
9127
9131
|
}
|
|
9132
|
+
export enum TextureOutputChannel {
|
|
9133
|
+
R = 0,
|
|
9134
|
+
G = 1,
|
|
9135
|
+
B = 2,
|
|
9136
|
+
A = 3,
|
|
9137
|
+
RGB = 4
|
|
9138
|
+
}
|
|
9139
|
+
export enum USDTextureColorSpace {
|
|
9140
|
+
Auto = 0,
|
|
9141
|
+
Raw = 1,
|
|
9142
|
+
SRGB = 2
|
|
9143
|
+
}
|
|
9128
9144
|
export enum MeshFlags {
|
|
9129
9145
|
DoubleSided = 1,
|
|
9130
9146
|
LeftHanded = 2
|
|
@@ -11876,12 +11892,16 @@ declare module "babylonjs-loaders/FBX/pure" {
|
|
|
11876
11892
|
/** Pure barrel — re-exports only side-effect-free modules */
|
|
11877
11893
|
export { FBXFileLoader } from "babylonjs-loaders/FBX/fbxFileLoader.pure";
|
|
11878
11894
|
export { FBXFileLoaderMetadata } from "babylonjs-loaders/FBX/fbxFileLoader.metadata";
|
|
11895
|
+
export { FBXConstraintBehavior, FBXConstraintSolver } from "babylonjs-loaders/FBX/fbxConstraintBehavior";
|
|
11879
11896
|
|
|
11880
11897
|
}
|
|
11881
11898
|
declare module "babylonjs-loaders/FBX/index" {
|
|
11882
11899
|
export { FBXFileLoader } from "babylonjs-loaders/FBX/fbxFileLoader";
|
|
11883
|
-
export type { FBXFileLoaderOptions, FBXNormalMapCoordinateSystem } from "babylonjs-loaders/FBX/fbxFileLoader";
|
|
11900
|
+
export type { FBXFileLoaderOptions, FBXNormalMapCoordinateSystem, FBXLoaderWarning } from "babylonjs-loaders/FBX/fbxFileLoader";
|
|
11884
11901
|
export { FBXFileLoaderMetadata } from "babylonjs-loaders/FBX/fbxFileLoader.metadata";
|
|
11902
|
+
export { FBXConstraintBehavior, FBXConstraintSolver } from "babylonjs-loaders/FBX/fbxConstraintBehavior";
|
|
11903
|
+
export type { FBXConstraintBehaviorOptions, FBXConstraintBehaviorTarget } from "babylonjs-loaders/FBX/fbxConstraintBehavior";
|
|
11904
|
+
export type { FBXConstraintData, FBXConstraintTarget, FBXConstraintType } from "babylonjs-loaders/FBX/interpreter/constraints";
|
|
11885
11905
|
|
|
11886
11906
|
}
|
|
11887
11907
|
declare module "babylonjs-loaders/FBX/fbxFileLoader.types" {
|
|
@@ -11910,12 +11930,83 @@ export type FBXNormalMapCoordinateSystem = "y-up" | "y-down";
|
|
|
11910
11930
|
* Defines options for the FBX loader.
|
|
11911
11931
|
*/
|
|
11912
11932
|
export interface FBXFileLoaderOptions {
|
|
11933
|
+
/**
|
|
11934
|
+
* Bundle of defaults for the options that change what the loaded scene looks like.
|
|
11935
|
+
* - "compatible" (default): the behaviour of the loader as first shipped: StandardMaterial for every material,
|
|
11936
|
+
* one Babylon geometry per model, curve geometry skipped, constraints recorded as metadata only, clips rebased
|
|
11937
|
+
* to start at frame 0, cameras and lights placed in world space.
|
|
11938
|
+
* - "full": everything the loader can do: PBRMaterial for physically based shaders, geometry shared between
|
|
11939
|
+
* instances, curves as lines meshes, constraints solved at runtime, authored clip times, cameras and lights
|
|
11940
|
+
* parented to their nodes so they animate.
|
|
11941
|
+
* An option set explicitly always wins over the preset.
|
|
11942
|
+
*/
|
|
11943
|
+
preset?: "compatible" | "full";
|
|
11913
11944
|
/**
|
|
11914
11945
|
* Source convention for tangent-space normal maps connected through FBX normal-map slots.
|
|
11915
11946
|
* FBX does not standardize this convention, so the loader defaults to the glTF/USD-style Y-up convention.
|
|
11916
11947
|
* Set to "y-down" for assets authored with inverted green/Y normal maps.
|
|
11917
11948
|
*/
|
|
11918
11949
|
normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;
|
|
11950
|
+
/**
|
|
11951
|
+
* Which Babylon material to build.
|
|
11952
|
+
* - "standard" (default, "full" preset: "auto"): always StandardMaterial (PBR parameters are approximated).
|
|
11953
|
+
* - "auto": PBRMaterial for physically based FBX materials (Standard Surface, Arnold, 3ds Max Physical,
|
|
11954
|
+
* 3ds Max PBR, glTF, OpenPBR, Stingray PBS) and StandardMaterial for classic Lambert/Phong materials.
|
|
11955
|
+
* - "pbr": always PBRMaterial (Lambert/Phong parameters are converted).
|
|
11956
|
+
*/
|
|
11957
|
+
materials?: "auto" | "standard" | "pbr";
|
|
11958
|
+
/**
|
|
11959
|
+
* Unit conversion applied at the root of the loaded hierarchy.
|
|
11960
|
+
* - "preserve" (default): keep the file's units (1 Babylon unit = 1 FBX unit).
|
|
11961
|
+
* - "meters": scale so that 1 Babylon unit is 1 meter, using the file's UnitScaleFactor.
|
|
11962
|
+
* - a number: centimeters per Babylon unit (100 = meters, 1 = centimeters, 2.54 = inches).
|
|
11963
|
+
*/
|
|
11964
|
+
unitScale?: "preserve" | "meters" | number;
|
|
11965
|
+
/**
|
|
11966
|
+
* Share vertex data between models that reference the same FBX geometry (default false, "full" preset: true).
|
|
11967
|
+
* Skinned meshes are never shared.
|
|
11968
|
+
*/
|
|
11969
|
+
shareGeometry?: boolean;
|
|
11970
|
+
/**
|
|
11971
|
+
* Called for every recoverable issue found while loading (unsupported features, malformed data that was
|
|
11972
|
+
* skipped, approximations). The same list is stored on the root node's metadata as `fbxDiagnostics`.
|
|
11973
|
+
*/
|
|
11974
|
+
onWarning?: (warning: FBXLoaderWarning) => void;
|
|
11975
|
+
/**
|
|
11976
|
+
* Segments per knot span when tessellating NURBS surfaces. Zero or undefined uses the subdivision stored in
|
|
11977
|
+
* the file (usually 4), capped at 16.
|
|
11978
|
+
*/
|
|
11979
|
+
nurbsSubdivision?: number;
|
|
11980
|
+
/** How curve geometry (Line, NurbsCurve) is imported: skipped (default) or as lines meshes ("full" preset). */
|
|
11981
|
+
curves?: "lines" | "skip";
|
|
11982
|
+
/**
|
|
11983
|
+
* Constraints (aim, parent, position, rotation, scale): "metadata" (default) only records them on the nodes,
|
|
11984
|
+
* "apply" ("full" preset) attaches an `FBXConstraintBehavior` to each constrained node so it is solved before
|
|
11985
|
+
* every render. IK chains are always metadata only.
|
|
11986
|
+
*/
|
|
11987
|
+
constraints?: "apply" | "metadata";
|
|
11988
|
+
/**
|
|
11989
|
+
* Shift every clip so its first keyframe sits at frame 0 (default true). With false ("full" preset) keys keep
|
|
11990
|
+
* the times authored in the file, so clips of one file stay aligned with each other and with their declared
|
|
11991
|
+
* ranges.
|
|
11992
|
+
*/
|
|
11993
|
+
rebaseAnimations?: boolean;
|
|
11994
|
+
/**
|
|
11995
|
+
* Parent cameras and lights to their FBX node so they follow its animation (default false, "full" preset:
|
|
11996
|
+
* true). Otherwise they are created at the node's world position and orientation, unparented.
|
|
11997
|
+
*/
|
|
11998
|
+
attachCamerasAndLights?: boolean;
|
|
11999
|
+
}
|
|
12000
|
+
/** A recoverable issue reported while loading an FBX file. */
|
|
12001
|
+
export interface FBXLoaderWarning {
|
|
12002
|
+
/** Which part of the loader reported the issue */
|
|
12003
|
+
source: "scene" | "model" | "geometry" | "skin" | "rig" | "animation" | "blendShape" | "camera" | "light";
|
|
12004
|
+
/** Human readable description */
|
|
12005
|
+
message: string;
|
|
12006
|
+
/** Name of the affected object, when known */
|
|
12007
|
+
objectName?: string;
|
|
12008
|
+
/** Structured details from the interpreter, when any */
|
|
12009
|
+
details?: unknown;
|
|
11919
12010
|
}
|
|
11920
12011
|
/**
|
|
11921
12012
|
* FBX file loader plugin for Babylon.js.
|
|
@@ -11938,6 +12029,22 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
11938
12029
|
private readonly _bindRestBones;
|
|
11939
12030
|
private readonly _sourceBonesBySkeleton;
|
|
11940
12031
|
private readonly _scaleCompensationHelpersBySkeleton;
|
|
12032
|
+
/** Frame rate of the file being loaded (GlobalSettings TimeMode); animation is baked at this rate. */
|
|
12033
|
+
private _frameRate;
|
|
12034
|
+
/** Layers of the animation stack currently being converted; used by the transform samplers. */
|
|
12035
|
+
private _activeLayers;
|
|
12036
|
+
/** Parent model per model id, for inherit-mode aware sampling. */
|
|
12037
|
+
private _parentModelById;
|
|
12038
|
+
/** Curve nodes per model id for the stack currently being converted. */
|
|
12039
|
+
private _curveNodesByModelId;
|
|
12040
|
+
/** Helper nodes inserted above models whose InheritType is not RSrs. */
|
|
12041
|
+
private _inheritScaleHelpers;
|
|
12042
|
+
/** First mesh built per (geometry, geometric transform), for geometry sharing between instances. */
|
|
12043
|
+
private _meshByGeometryKey;
|
|
12044
|
+
/** Instance mesh -> source mesh whose geometry it shares. */
|
|
12045
|
+
private _instanceSource;
|
|
12046
|
+
/** Property curve nodes that were mapped onto Babylon animations; their "not evaluated" diagnostics are dropped. */
|
|
12047
|
+
private _evaluatedCurveNodeIds;
|
|
11941
12048
|
/**
|
|
11942
12049
|
* Creates a new FBX loader.
|
|
11943
12050
|
* @param options - Options controlling FBX loading behavior
|
|
@@ -11980,6 +12087,11 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
11980
12087
|
* @returns A promise containing the loaded asset container
|
|
11981
12088
|
*/
|
|
11982
12089
|
loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<AssetContainer>;
|
|
12090
|
+
/**
|
|
12091
|
+
* Parses and interprets the file. Parsing is synchronous, so no progress events are emitted: the scene loader's
|
|
12092
|
+
* progress callback reports download bytes and must not be fed synthetic counts.
|
|
12093
|
+
*/
|
|
12094
|
+
private _parseAndInterpret;
|
|
11983
12095
|
private _parse;
|
|
11984
12096
|
private _parseFromArrayBuffer;
|
|
11985
12097
|
private _buildScene;
|
|
@@ -11991,6 +12103,15 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
11991
12103
|
private _linkSkeletonsToTransformNodes;
|
|
11992
12104
|
private static _modelSubtreeMatchesNameFilter;
|
|
11993
12105
|
private static _applyModelMetadata;
|
|
12106
|
+
/**
|
|
12107
|
+
* Wires a LodGroup's children as Babylon LOD levels: the first child holds the highest detail; every further
|
|
12108
|
+
* child replaces it beyond the group's threshold distance (or screen coverage when thresholds are percentages).
|
|
12109
|
+
* Each child's display mode is honoured first: level 1 (show) stays visible outside the LOD chain, level 2
|
|
12110
|
+
* (hide) is disabled, and only level 0 (use LOD) children take part in the distance switching.
|
|
12111
|
+
*/
|
|
12112
|
+
private static _applyLodGroup;
|
|
12113
|
+
/** Builds a lines mesh from Line or tessellated NurbsCurve geometry, applying the model's geometric transform. */
|
|
12114
|
+
private _createLinesMesh;
|
|
11994
12115
|
private _createMesh;
|
|
11995
12116
|
/**
|
|
11996
12117
|
* Apply multi-material to a mesh by creating sub-meshes grouped by material index.
|
|
@@ -12014,6 +12135,11 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
12014
12135
|
*/
|
|
12015
12136
|
private _buildSkinningData;
|
|
12016
12137
|
private _createMaterial;
|
|
12138
|
+
private _createPbrMaterial;
|
|
12139
|
+
/** Alpha of a classic Lambert/Phong material: Opacity when present, otherwise 1 - TransparentColor * TransparencyFactor. */
|
|
12140
|
+
private static _alphaFromClassicTransparency;
|
|
12141
|
+
private static _applyTextureSettings;
|
|
12142
|
+
private _createStandardMaterial;
|
|
12017
12143
|
private _configureNormalTexture;
|
|
12018
12144
|
private _getNormalMapTangentHandednessScale;
|
|
12019
12145
|
private static _isSupportedMaterialTextureSlot;
|
|
@@ -12037,11 +12163,27 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
12037
12163
|
private _createCamera;
|
|
12038
12164
|
private _createLight;
|
|
12039
12165
|
private _createSkeleton;
|
|
12166
|
+
private _rigBoneModelIds;
|
|
12167
|
+
private _isRigBone;
|
|
12040
12168
|
private _getSourceBone;
|
|
12041
12169
|
private _getScaleCompensationHelper;
|
|
12042
12170
|
private static _computeFBXAbsoluteMatrices;
|
|
12171
|
+
/**
|
|
12172
|
+
* Effective ("inherit") scale of every bone, following the FBX SDK: the local scale for RSrs bones, and for
|
|
12173
|
+
* RrSs / Rrs bones the local scale multiplied by the scale of the bone's inherit-scale node (the parent for RrSs,
|
|
12174
|
+
* the parent's inherit-scale node for Rrs). Bones are ordered parents first.
|
|
12175
|
+
*/
|
|
12176
|
+
private static _computeBoneInheritScales;
|
|
12177
|
+
private static _getBoneInheritScaleNode;
|
|
12178
|
+
/** Scale a bone inherits into its own scale (RrSs chains), or unit scale. */
|
|
12179
|
+
private static _getBoneInheritedScale;
|
|
12043
12180
|
private static _computeFBXRuntimeLocalMatrix;
|
|
12044
12181
|
private static _applyParentScaleCompensation;
|
|
12182
|
+
/**
|
|
12183
|
+
* Splits a bone's FBX local matrix into a helper (which cancels the parent scale and carries the translation,
|
|
12184
|
+
* so the translation still follows the parent scale as the SDK does) and the bone's own rotation/scale. For RrSs
|
|
12185
|
+
* bones the inherited scale is folded into the bone scale.
|
|
12186
|
+
*/
|
|
12045
12187
|
private static _splitParentScaleCompensatedLocalMatrix;
|
|
12046
12188
|
private static _safeInverseScale;
|
|
12047
12189
|
private static _getInverseScaleVector;
|
|
@@ -12058,13 +12200,8 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
12058
12200
|
* In row-vector convention: v' = v * M
|
|
12059
12201
|
*/
|
|
12060
12202
|
private static _computeFBXLocalMatrix;
|
|
12061
|
-
|
|
12062
|
-
* Apply the FBX transform chain to a Babylon TransformNode or Mesh.
|
|
12063
|
-
* Decomposes the full local matrix into position/rotation/scale.
|
|
12064
|
-
*/
|
|
12065
|
-
private static _applyFBXTransform;
|
|
12203
|
+
private _applyRestTRS;
|
|
12066
12204
|
private static _computeFBXModelLocalMatrix;
|
|
12067
|
-
private static _getBoneReferenceWorldMatrix;
|
|
12068
12205
|
private static _applyMatrixToTransform;
|
|
12069
12206
|
private _createAnimationGroup;
|
|
12070
12207
|
private _buildInheritedRigBoneAnimations;
|
|
@@ -12074,9 +12211,61 @@ export class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
|
|
|
12074
12211
|
* Computes the full FBX transform matrix at each keyframe and decomposes into TRS.
|
|
12075
12212
|
*/
|
|
12076
12213
|
private _buildNodeAnimations;
|
|
12214
|
+
/**
|
|
12215
|
+
* Baked keys are interpolated linearly by Babylon. Between two frames an FBX cubic segment can deviate from that
|
|
12216
|
+
* line, so sample times are refined (midpoints inserted, up to two levels) wherever the interpolated transform
|
|
12217
|
+
* differs noticeably from the curve. Flat and linear segments stay at frame resolution.
|
|
12218
|
+
*/
|
|
12219
|
+
private static _refineSampleTimes;
|
|
12220
|
+
/**
|
|
12221
|
+
* Keys of a scalar property animated by one or more layers: the authored keys when a single layer drives it,
|
|
12222
|
+
* otherwise the frame grid evaluated through the layer stack.
|
|
12223
|
+
* @param sources - Per-layer curves of the property (each with at least one curve)
|
|
12224
|
+
* @param animStack - Stack being converted
|
|
12225
|
+
* @param mapValue - Conversion from the FBX value to the Babylon property value
|
|
12226
|
+
* @returns Animation keys
|
|
12227
|
+
*/
|
|
12228
|
+
private _layeredScalarKeys;
|
|
12229
|
+
/**
|
|
12230
|
+
* Maps an animated FBX property (anything other than node transforms and blend shape weights) onto the Babylon
|
|
12231
|
+
* property that carries it: mesh visibility, camera field of view and clip planes, light intensity, colour and
|
|
12232
|
+
* cone angles, and material colours, alpha, roughness and metalness. `group` holds the curve nodes of every
|
|
12233
|
+
* layer animating that property, in layer order; several layers are evaluated through the layer stack.
|
|
12234
|
+
*/
|
|
12235
|
+
private _buildPropertyAnimations;
|
|
12236
|
+
/** Records constraints on their nodes and, unless disabled, attaches the runtime behavior that solves them. */
|
|
12237
|
+
private _applyConstraints;
|
|
12238
|
+
/** Collects every recoverable issue the interpreter recorded, stores it on the root node and notifies the caller. */
|
|
12239
|
+
private _reportDiagnostics;
|
|
12240
|
+
/** Curve nodes affecting the inherit scale of a model: its own scale curves and those of its inherit-scale chain. */
|
|
12241
|
+
private _collectInheritScaleCurves;
|
|
12077
12242
|
private _isVector3KeysConstant;
|
|
12243
|
+
/** Samples the animated Lcl Translation / Rotation / Scaling of a model, blending all layers of the active stack. */
|
|
12244
|
+
private _sampleModelTRS;
|
|
12245
|
+
/**
|
|
12246
|
+
* Local position/rotation/scale of a model from FBX Lcl values. Without pivots and offsets the components map
|
|
12247
|
+
* directly (rotation = pre * lcl * post⁻¹), which keeps zero and negative scales exact. With pivots the full
|
|
12248
|
+
* matrix is built and decomposed.
|
|
12249
|
+
*/
|
|
12250
|
+
private static _computeLocalTRS;
|
|
12251
|
+
/** Applies inherit-mode adjustments to a local TRS (see _computeInheritAwareLocalMatrix). */
|
|
12252
|
+
private _adjustTRSForInheritMode;
|
|
12078
12253
|
private _sampleModelLocalMatrix;
|
|
12079
12254
|
private _sampleModelScale;
|
|
12255
|
+
/**
|
|
12256
|
+
* Effective scale of a model for inherit-mode math (`inherit_scale` in ufbx terms): its own local scale, multiplied
|
|
12257
|
+
* componentwise by the inherited scale when the model uses RrSs inheritance. `time` samples animation; undefined
|
|
12258
|
+
* uses the rest pose.
|
|
12259
|
+
*/
|
|
12260
|
+
private _getInheritScale;
|
|
12261
|
+
/** RrSs nodes inherit scale from their parent; Rrs nodes skip their immediate parent (chaining through Rrs parents). */
|
|
12262
|
+
private _getInheritScaleNode;
|
|
12263
|
+
/**
|
|
12264
|
+
* Local matrix of a model relative to its Babylon parent frame, accounting for inherit modes. For RSrs (the
|
|
12265
|
+
* default) this is the FBX local matrix. For RrSs / Rrs the node sits under a helper that removes the parent's
|
|
12266
|
+
* scale, so translation is pre-scaled by the parent scale and (for RrSs) scale accumulates componentwise.
|
|
12267
|
+
*/
|
|
12268
|
+
private _computeInheritAwareLocalMatrix;
|
|
12080
12269
|
/**
|
|
12081
12270
|
* Build matrix-baked bone animation from full FBX local transforms.
|
|
12082
12271
|
* The bind matrix carries the skinning offset, so animation curves drive
|
|
@@ -12114,6 +12303,197 @@ declare module "babylonjs-loaders/FBX/fbxFileLoader" {
|
|
|
12114
12303
|
export * from "babylonjs-loaders/FBX/fbxFileLoader.types";
|
|
12115
12304
|
export * from "babylonjs-loaders/FBX/fbxFileLoader.pure";
|
|
12116
12305
|
|
|
12306
|
+
}
|
|
12307
|
+
declare module "babylonjs-loaders/FBX/fbxConstraintBehavior" {
|
|
12308
|
+
/**
|
|
12309
|
+
* Runtime evaluation of FBX constraints. An `FBXConstraintBehavior` is attached to each constrained node; all
|
|
12310
|
+
* behaviors of a scene register with one `FBXConstraintSolver`, which solves them in dependency order (a constraint
|
|
12311
|
+
* whose target or parent is driven by another constraint is solved after it) and reuses scratch objects, so solving
|
|
12312
|
+
* allocates nothing per frame.
|
|
12313
|
+
*
|
|
12314
|
+
* The solver brackets the scene's animation phase: before animations run it writes each node's unconstrained
|
|
12315
|
+
* transform back, after they ran it captures the result as the new unconstrained transform and solves. A partial
|
|
12316
|
+
* weight therefore always blends from what animation (or nothing) produced this frame, never from the previous
|
|
12317
|
+
* solve's output, so a 50% weight stays a 50% blend instead of converging on the target.
|
|
12318
|
+
*
|
|
12319
|
+
* All maths happen in FBX space, i.e. relative to the loader's root node, so the handedness conversion applied
|
|
12320
|
+
* at the root never enters the solve.
|
|
12321
|
+
*/
|
|
12322
|
+
import { Behavior } from "babylonjs/Behaviors/behavior";
|
|
12323
|
+
import { Nullable } from "babylonjs/types";
|
|
12324
|
+
import { Node } from "babylonjs/node";
|
|
12325
|
+
import { Scene } from "babylonjs/scene";
|
|
12326
|
+
import { Matrix, Vector3 } from "babylonjs/Maths/math.vector.pure";
|
|
12327
|
+
import { TransformNode } from "babylonjs/Meshes/transformNode.pure";
|
|
12328
|
+
import { FBXConstraintData } from "babylonjs-loaders/FBX/interpreter/constraints";
|
|
12329
|
+
/** Resolved target of a constraint. */
|
|
12330
|
+
export interface FBXConstraintBehaviorTarget {
|
|
12331
|
+
/** Target node */
|
|
12332
|
+
node: TransformNode;
|
|
12333
|
+
/** Normalized target weight (0..1) */
|
|
12334
|
+
weight: number;
|
|
12335
|
+
/** Offset matrix for parent constraints (in the target's space) */
|
|
12336
|
+
offset: Matrix;
|
|
12337
|
+
}
|
|
12338
|
+
/** Options resolved by the loader when creating the behavior. */
|
|
12339
|
+
export interface FBXConstraintBehaviorOptions {
|
|
12340
|
+
/** Root of the loaded asset; world matrices are made relative to it */
|
|
12341
|
+
root: TransformNode;
|
|
12342
|
+
/** Resolved targets of the constraint, in file order */
|
|
12343
|
+
targets: FBXConstraintBehaviorTarget[];
|
|
12344
|
+
/** World up object of an aim constraint, when it has one */
|
|
12345
|
+
upNode: Nullable<TransformNode>;
|
|
12346
|
+
/** Scene up axis in FBX space */
|
|
12347
|
+
sceneUp: Vector3;
|
|
12348
|
+
}
|
|
12349
|
+
/**
|
|
12350
|
+
* Solves every FBX constraint of a scene once per frame, in dependency order, from the scene's animation phase
|
|
12351
|
+
* observers (`beginFrame` before animations, `solve` after them). Created on demand by the first
|
|
12352
|
+
* `FBXConstraintBehavior` attached in the scene and removed with the last one.
|
|
12353
|
+
*/
|
|
12354
|
+
export class FBXConstraintSolver {
|
|
12355
|
+
private readonly _scene;
|
|
12356
|
+
private readonly _behaviors;
|
|
12357
|
+
private _ordered;
|
|
12358
|
+
private _cyclic;
|
|
12359
|
+
private _dirty;
|
|
12360
|
+
private _beforeAnimations;
|
|
12361
|
+
private _afterAnimations;
|
|
12362
|
+
private constructor();
|
|
12363
|
+
/**
|
|
12364
|
+
* Solver of a scene, if any constraint behavior is attached in it.
|
|
12365
|
+
* @param scene - Scene to look up
|
|
12366
|
+
* @returns The solver, or undefined
|
|
12367
|
+
*/
|
|
12368
|
+
static Get(scene: Scene): FBXConstraintSolver | undefined;
|
|
12369
|
+
/**
|
|
12370
|
+
* Solver of a scene, created when missing.
|
|
12371
|
+
* @param scene - Scene to look up
|
|
12372
|
+
* @returns The solver
|
|
12373
|
+
*/
|
|
12374
|
+
static GetOrCreate(scene: Scene): FBXConstraintSolver;
|
|
12375
|
+
/** Registered behaviors in solve order (a target's constraint before the constraints that read it). */
|
|
12376
|
+
get constraints(): readonly FBXConstraintBehavior[];
|
|
12377
|
+
/**
|
|
12378
|
+
* Behaviors that take part in a dependency cycle (A targets B while B targets A). They are solved after all
|
|
12379
|
+
* acyclic constraints, in registration order, so each sees the other's result from the previous solve.
|
|
12380
|
+
*/
|
|
12381
|
+
get cyclicConstraints(): readonly FBXConstraintBehavior[];
|
|
12382
|
+
/**
|
|
12383
|
+
* Adds a behavior to the solve set.
|
|
12384
|
+
* @param behavior - Behavior to add
|
|
12385
|
+
*/
|
|
12386
|
+
register(behavior: FBXConstraintBehavior): void;
|
|
12387
|
+
/**
|
|
12388
|
+
* Removes a behavior from the solve set; the solver disposes itself with the last one.
|
|
12389
|
+
* @param behavior - Behavior to remove
|
|
12390
|
+
*/
|
|
12391
|
+
unregister(behavior: FBXConstraintBehavior): void;
|
|
12392
|
+
/** Marks the solve order stale, e.g. after re-parenting a constrained node. */
|
|
12393
|
+
invalidateOrder(): void;
|
|
12394
|
+
/**
|
|
12395
|
+
* Start of a frame, before animations run: every constrained node gets its unconstrained transform back, so
|
|
12396
|
+
* that animation either overwrites it or leaves it untouched.
|
|
12397
|
+
*/
|
|
12398
|
+
beginFrame(): void;
|
|
12399
|
+
/**
|
|
12400
|
+
* End of the animation phase: takes every constrained node's current transform as its unconstrained value,
|
|
12401
|
+
* then solves every registered constraint once, in dependency order.
|
|
12402
|
+
*/
|
|
12403
|
+
solve(): void;
|
|
12404
|
+
private _ensureOrder;
|
|
12405
|
+
private static _IsAncestorOrSelf;
|
|
12406
|
+
}
|
|
12407
|
+
/** Babylon behavior evaluating an FBX aim, parent, position, rotation or scale constraint. */
|
|
12408
|
+
export class FBXConstraintBehavior implements Behavior<TransformNode> {
|
|
12409
|
+
/** Constraint data extracted from the file */
|
|
12410
|
+
readonly constraint: FBXConstraintData;
|
|
12411
|
+
private readonly _options;
|
|
12412
|
+
/** Behavior name (`fbxConstraint:` followed by the constraint name) */
|
|
12413
|
+
readonly name: string;
|
|
12414
|
+
/** Node the behavior is attached to */
|
|
12415
|
+
attachedNode: Nullable<TransformNode>;
|
|
12416
|
+
/** Set to false to pause the constraint without detaching it */
|
|
12417
|
+
enabled: boolean;
|
|
12418
|
+
private readonly _offsetTranslation;
|
|
12419
|
+
private readonly _offsetRotation;
|
|
12420
|
+
private readonly _offsetScale;
|
|
12421
|
+
private readonly _localBasisTransposed;
|
|
12422
|
+
/** Unconstrained transform of the current frame (what animation produced), blended towards the constraint's result. */
|
|
12423
|
+
private readonly _base;
|
|
12424
|
+
private _hasBase;
|
|
12425
|
+
/**
|
|
12426
|
+
* Creates the behavior.
|
|
12427
|
+
* @param constraint - Constraint data extracted from the file
|
|
12428
|
+
* @param _options - Resolved targets and scene information
|
|
12429
|
+
*/
|
|
12430
|
+
constructor(
|
|
12431
|
+
/** Constraint data extracted from the file */
|
|
12432
|
+
constraint: FBXConstraintData, _options: FBXConstraintBehaviorOptions);
|
|
12433
|
+
/** Nothing to initialize */
|
|
12434
|
+
init(): void;
|
|
12435
|
+
/**
|
|
12436
|
+
* Registers the behavior with the scene's solver, takes the node's current transform as the unconstrained
|
|
12437
|
+
* value and solves the constraint once.
|
|
12438
|
+
* @param target - Node to constrain
|
|
12439
|
+
*/
|
|
12440
|
+
attach(target: TransformNode): void;
|
|
12441
|
+
/** Unregisters the behavior; the node keeps its last solved transform. */
|
|
12442
|
+
detach(): void;
|
|
12443
|
+
/**
|
|
12444
|
+
* Takes the node's current transform as the unconstrained value the next solve blends from. The solver calls
|
|
12445
|
+
* this after the scene's animations ran; call it yourself after writing a transform by hand.
|
|
12446
|
+
*/
|
|
12447
|
+
captureBase(): void;
|
|
12448
|
+
/**
|
|
12449
|
+
* Writes the unconstrained transform back to the node. The solver calls this before the scene's animations
|
|
12450
|
+
* run, so a node nothing animates keeps its unconstrained value between frames instead of the solved one.
|
|
12451
|
+
*/
|
|
12452
|
+
restoreBase(): void;
|
|
12453
|
+
/**
|
|
12454
|
+
* Nodes whose world transform the solve reads: the targets, the up node and the constrained node's parent.
|
|
12455
|
+
* @returns The nodes, used by the solver to order constraints
|
|
12456
|
+
*/
|
|
12457
|
+
dependencyNodes(): Nullable<Node>[];
|
|
12458
|
+
/**
|
|
12459
|
+
* Solves the constraint from the captured unconstrained transform and writes the node's local transform.
|
|
12460
|
+
* Blends are relative to the value captured by `captureBase`, not to whatever the node holds now.
|
|
12461
|
+
*/
|
|
12462
|
+
evaluate(): void;
|
|
12463
|
+
/**
|
|
12464
|
+
* World matrix of a node relative to the asset root (FBX space).
|
|
12465
|
+
* @param node - node to evaluate
|
|
12466
|
+
* @param out - matrix receiving the result
|
|
12467
|
+
* @returns `out`
|
|
12468
|
+
*/
|
|
12469
|
+
private _fbxWorld;
|
|
12470
|
+
/**
|
|
12471
|
+
* Weighted blend of the targets' world transforms (relative to the root).
|
|
12472
|
+
* @param position - Receives the blended translation
|
|
12473
|
+
* @param rotation - Receives the blended rotation
|
|
12474
|
+
* @param scale - Receives the blended scale
|
|
12475
|
+
* @returns The total target weight, 0 when no target contributes
|
|
12476
|
+
*/
|
|
12477
|
+
private _blendTargets;
|
|
12478
|
+
private _applyWeighted;
|
|
12479
|
+
private _applyRotation;
|
|
12480
|
+
private _writePosition;
|
|
12481
|
+
private _writeScaling;
|
|
12482
|
+
private _solvePosition;
|
|
12483
|
+
private _solveRotation;
|
|
12484
|
+
private _solveScale;
|
|
12485
|
+
private _solveParent;
|
|
12486
|
+
private _solveAim;
|
|
12487
|
+
/**
|
|
12488
|
+
* Builds a rotation matrix whose rows are `first`, `second` made orthogonal to it, and their cross product.
|
|
12489
|
+
* @param first - primary axis
|
|
12490
|
+
* @param second - secondary axis
|
|
12491
|
+
* @param out - matrix receiving the basis
|
|
12492
|
+
* @returns false when the axes are parallel or degenerate (`out` is then unchanged)
|
|
12493
|
+
*/
|
|
12494
|
+
private static _OrthonormalBasisToRef;
|
|
12495
|
+
}
|
|
12496
|
+
|
|
12117
12497
|
}
|
|
12118
12498
|
declare module "babylonjs-loaders/FBX/types/fbxTypes" {
|
|
12119
12499
|
/**
|
|
@@ -12130,6 +12510,11 @@ export interface FBXProperty {
|
|
|
12130
12510
|
type: FBXPropertyType;
|
|
12131
12511
|
/** Parsed property value. */
|
|
12132
12512
|
value: FBXPropertyValue;
|
|
12513
|
+
/**
|
|
12514
|
+
* Exact decimal text of an int64 whose magnitude exceeds 2^53; `value` then holds the rounded double. Object
|
|
12515
|
+
* ids are the only int64 values where the last bits matter, and `resolveConnections` keys them by this text.
|
|
12516
|
+
*/
|
|
12517
|
+
raw?: string;
|
|
12133
12518
|
}
|
|
12134
12519
|
/** A node in the FBX document tree */
|
|
12135
12520
|
export interface FBXNode {
|
|
@@ -12156,11 +12541,22 @@ export function findDocumentNode(doc: FBXDocument, name: string): FBXNode | unde
|
|
|
12156
12541
|
/** Extract a property value by index, with type narrowing */
|
|
12157
12542
|
export function getPropertyValue<T extends FBXPropertyValue>(node: FBXNode, index: number): T | undefined;
|
|
12158
12543
|
/**
|
|
12159
|
-
*
|
|
12544
|
+
* Validates an FBX object ID value: IDs are 64-bit integers, so anything non-numeric, non-finite or fractional is
|
|
12545
|
+
* rejected. IDs beyond 2^53 are carried losslessly through the property's `raw` text by `resolveConnections`.
|
|
12160
12546
|
* @param value - Parsed FBX object ID value
|
|
12161
|
-
* @returns The object ID, or undefined when the value
|
|
12547
|
+
* @returns The object ID, or undefined when the value cannot be an ID
|
|
12162
12548
|
*/
|
|
12163
12549
|
export function getSafeFBXObjectId(value: unknown): number | undefined;
|
|
12550
|
+
/** Typed array payload types produced by the parsers. */
|
|
12551
|
+
export type FBXArrayValue = Float32Array | Float64Array | Int32Array | Uint8Array;
|
|
12552
|
+
/**
|
|
12553
|
+
* Returns the array payload of a node.
|
|
12554
|
+
* 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
|
|
12555
|
+
* scalar properties, and a one-element array degenerates to a single scalar. All of these are coalesced here.
|
|
12556
|
+
* @param node - Node whose properties hold the array
|
|
12557
|
+
* @returns The array, or null when the node has no numeric payload
|
|
12558
|
+
*/
|
|
12559
|
+
export function getNodeArray(node: FBXNode | undefined | null): FBXArrayValue | null;
|
|
12164
12560
|
/** Get the numeric ID from a node (first property is typically the int64 UID) */
|
|
12165
12561
|
export function getNodeId(node: FBXNode): number | undefined;
|
|
12166
12562
|
/**
|
|
@@ -12224,6 +12620,8 @@ export function computeFBXLocalMatrix(components: FBXTransformComponents): Matri
|
|
|
12224
12620
|
|
|
12225
12621
|
}
|
|
12226
12622
|
declare module "babylonjs-loaders/FBX/interpreter/skeleton" {
|
|
12623
|
+
import { FBXNodeTransformData } from "babylonjs-loaders/FBX/interpreter/nodeTransform";
|
|
12624
|
+
import { FBXPropertyTemplate, FBXPropertyTemplateMap } from "babylonjs-loaders/FBX/interpreter/propertyTemplates";
|
|
12227
12625
|
import { FBXNode } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
12228
12626
|
import { FBXObjectMap } from "babylonjs-loaders/FBX/interpreter/connections";
|
|
12229
12627
|
export type FBXClusterMode = "Normalize" | "Additive" | "TotalOne" | "Unknown";
|
|
@@ -12298,25 +12696,9 @@ export interface FBXSkinData {
|
|
|
12298
12696
|
/** Recoverable skinning/bind diagnostics */
|
|
12299
12697
|
diagnostics: FBXSkinDiagnostic[];
|
|
12300
12698
|
}
|
|
12301
|
-
|
|
12302
|
-
* Extract all skin deformers from the FBX scene.
|
|
12303
|
-
* Returns skin data including bone hierarchy and vertex weights.
|
|
12304
|
-
*/
|
|
12305
|
-
export function extractSkins(objectMap: FBXObjectMap): FBXSkinData[];
|
|
12699
|
+
export function extractSkins(objectMap: FBXObjectMap, propertyTemplates?: FBXPropertyTemplateMap): FBXSkinData[];
|
|
12306
12700
|
export function isSkeletonModel(modelNode: FBXNode): boolean;
|
|
12307
|
-
export function extractBoneTransform(modelNode: FBXNode):
|
|
12308
|
-
translation: [number, number, number];
|
|
12309
|
-
rotation: [number, number, number];
|
|
12310
|
-
preRotation: [number, number, number];
|
|
12311
|
-
postRotation: [number, number, number];
|
|
12312
|
-
rotationPivot: [number, number, number];
|
|
12313
|
-
scalingPivot: [number, number, number];
|
|
12314
|
-
rotationOffset: [number, number, number];
|
|
12315
|
-
scalingOffset: [number, number, number];
|
|
12316
|
-
scale: [number, number, number];
|
|
12317
|
-
rotationOrder: number;
|
|
12318
|
-
inheritType: number;
|
|
12319
|
-
};
|
|
12701
|
+
export function extractBoneTransform(modelNode: FBXNode, template?: FBXPropertyTemplate): FBXNodeTransformData;
|
|
12320
12702
|
|
|
12321
12703
|
}
|
|
12322
12704
|
declare module "babylonjs-loaders/FBX/interpreter/sceneDiagnostics" {
|
|
@@ -12382,12 +12764,173 @@ export function resolveNumberProperty(node: FBXNode, template: FBXPropertyTempla
|
|
|
12382
12764
|
export function resolveVector2Property(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string, fallback: [number, number]): [number, number];
|
|
12383
12765
|
export function resolveVector3Property(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string, fallback: [number, number, number]): [number, number, number];
|
|
12384
12766
|
export function resolvePropertyValues(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string): FBXPropertyValue[] | undefined;
|
|
12767
|
+
/** A property from a Properties70 ("P") or Properties60 ("Property") block. */
|
|
12768
|
+
export interface FBXPropertyEntry {
|
|
12769
|
+
name: string;
|
|
12770
|
+
type: string;
|
|
12771
|
+
flags: string;
|
|
12772
|
+
values: FBXPropertyValue[];
|
|
12773
|
+
}
|
|
12774
|
+
/**
|
|
12775
|
+
* Lists the properties declared directly on an object, from both the 7.x and 6.x property blocks.
|
|
12776
|
+
* @param node - Object node
|
|
12777
|
+
* @returns Property entries in declaration order (empty when the node has no property block)
|
|
12778
|
+
*/
|
|
12779
|
+
export function getPropertyEntries(node: FBXNode | undefined): FBXPropertyEntry[];
|
|
12780
|
+
/** Value of a user property: scalars as-is, vectors and colours as number arrays. */
|
|
12781
|
+
export type FBXUserPropertyValue = string | number | boolean | number[];
|
|
12782
|
+
/**
|
|
12783
|
+
* User-defined properties of an object: those flagged "U" (user) in the property flags. Every DCC exports custom
|
|
12784
|
+
* attributes this way (Maya extra attributes, 3ds Max user properties, Blender custom properties).
|
|
12785
|
+
* @param node - Object node
|
|
12786
|
+
* @returns Map of property name to value, or undefined when the object has none
|
|
12787
|
+
*/
|
|
12788
|
+
export function extractUserProperties(node: FBXNode): Record<string, FBXUserPropertyValue> | undefined;
|
|
12789
|
+
export function userPropertyValue(values: FBXPropertyValue[], typeName?: string): FBXUserPropertyValue | undefined;
|
|
12790
|
+
|
|
12791
|
+
}
|
|
12792
|
+
declare module "babylonjs-loaders/FBX/interpreter/nurbs" {
|
|
12793
|
+
/**
|
|
12794
|
+
* NURBS curves and surfaces, and polyline ("Line") geometry.
|
|
12795
|
+
*
|
|
12796
|
+
* The basis evaluation and tessellation follow the FBX SDK conventions as implemented by ufbx: knot spans are
|
|
12797
|
+
* subdivided uniformly, closed and periodic curves wrap their control points, and surfaces are tessellated into
|
|
12798
|
+
* quads (degenerate quads at poles become triangles) with welded positions along the wrapped edges.
|
|
12799
|
+
*/
|
|
12800
|
+
import { FBXNode } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
12801
|
+
import { FBXGeometryData, FBXGeometryDiagnostic } from "babylonjs-loaders/FBX/interpreter/geometry";
|
|
12802
|
+
export type FBXNurbsTopology = "open" | "closed" | "periodic";
|
|
12803
|
+
/** Knot vector and derived data of one parametric direction. */
|
|
12804
|
+
export interface FBXNurbsBasis {
|
|
12805
|
+
order: number;
|
|
12806
|
+
topology: FBXNurbsTopology;
|
|
12807
|
+
knots: Float64Array;
|
|
12808
|
+
/** Parameter range that the curve is defined on */
|
|
12809
|
+
tMin: number;
|
|
12810
|
+
tMax: number;
|
|
12811
|
+
/** Distinct knot values inside [tMin, tMax], i.e. the boundaries of the non-empty spans */
|
|
12812
|
+
spans: Float64Array;
|
|
12813
|
+
/** False when the knot vector is too short or not monotonic */
|
|
12814
|
+
valid: boolean;
|
|
12815
|
+
}
|
|
12816
|
+
/** NURBS curve: homogeneous control points (x, y, z, w) and a basis. */
|
|
12817
|
+
export interface FBXNurbsCurveData {
|
|
12818
|
+
basis: FBXNurbsBasis;
|
|
12819
|
+
/** Control points as x,y,z,w */
|
|
12820
|
+
controlPoints: Float64Array;
|
|
12821
|
+
numControlPoints: number;
|
|
12822
|
+
}
|
|
12823
|
+
/** NURBS surface: control points laid out as `v * numU + u`. */
|
|
12824
|
+
export interface FBXNurbsSurfaceData {
|
|
12825
|
+
basisU: FBXNurbsBasis;
|
|
12826
|
+
basisV: FBXNurbsBasis;
|
|
12827
|
+
numU: number;
|
|
12828
|
+
numV: number;
|
|
12829
|
+
/** Control points as x,y,z,w */
|
|
12830
|
+
controlPoints: Float64Array;
|
|
12831
|
+
flipNormals: boolean;
|
|
12832
|
+
/** Span subdivision stored in the file (Step), 0 when absent */
|
|
12833
|
+
stepU: number;
|
|
12834
|
+
stepV: number;
|
|
12835
|
+
}
|
|
12836
|
+
/** Polyline geometry ready for a lines mesh: one or more open or closed point runs. */
|
|
12837
|
+
export interface FBXCurveGeometryData {
|
|
12838
|
+
id: number;
|
|
12839
|
+
name: string;
|
|
12840
|
+
kind: "line" | "nurbsCurve";
|
|
12841
|
+
/** Each polyline as x,y,z triples; closed runs repeat their first point at the end */
|
|
12842
|
+
polylines: Float64Array[];
|
|
12843
|
+
/** Display colour from the geometry's Color property */
|
|
12844
|
+
color: [number, number, number] | null;
|
|
12845
|
+
diagnostics: FBXGeometryDiagnostic[];
|
|
12846
|
+
}
|
|
12847
|
+
export function createNurbsBasis(order: number, form: string | undefined, knots: Float64Array): FBXNurbsBasis;
|
|
12848
|
+
/**
|
|
12849
|
+
* Evaluates the basis functions (and their derivatives) that are non-zero at `u`.
|
|
12850
|
+
* @returns index of the first influencing control point, or -1 when the basis cannot be evaluated
|
|
12851
|
+
*/
|
|
12852
|
+
export function evaluateNurbsBasis(basis: FBXNurbsBasis, u: number, weights: Float64Array, derivatives: Float64Array | null): number;
|
|
12853
|
+
/** Evaluates a curve point; `out` receives position (0..2) and derivative (3..5). */
|
|
12854
|
+
export function evaluateNurbsCurve(curve: FBXNurbsCurveData, u: number, out: Float64Array, weights: Float64Array, derivs: Float64Array): boolean;
|
|
12855
|
+
/** Evaluates a surface point; `out` receives position (0..2), du (3..5) and dv (6..8). */
|
|
12856
|
+
export function evaluateNurbsSurface(surface: FBXNurbsSurfaceData, u: number, v: number, out: Float64Array, scratch: {
|
|
12857
|
+
wu: Float64Array;
|
|
12858
|
+
wv: Float64Array;
|
|
12859
|
+
du: Float64Array;
|
|
12860
|
+
dv: Float64Array;
|
|
12861
|
+
}): boolean;
|
|
12862
|
+
/**
|
|
12863
|
+
* Tessellates a curve into a polyline with `subdivision` segments per knot span. Closed and periodic curves
|
|
12864
|
+
* end on a copy of their first point.
|
|
12865
|
+
*/
|
|
12866
|
+
export function tessellateNurbsCurve(curve: FBXNurbsCurveData, subdivision?: number): Float64Array | null;
|
|
12867
|
+
/** Span subdivision to use for a surface direction: an explicit override, else the file's Step, else 4. */
|
|
12868
|
+
export function resolveSpanSubdivision(fileStep: number, override: number | undefined): number;
|
|
12869
|
+
/**
|
|
12870
|
+
* Tessellates a surface into triangles. Positions on wrapped (closed/periodic) edges and at poles are welded
|
|
12871
|
+
* exactly like the FBX SDK does, so degenerate quads collapse into triangles.
|
|
12872
|
+
*/
|
|
12873
|
+
export function tessellateNurbsSurface(surface: FBXNurbsSurfaceData, subU: number, subV: number): {
|
|
12874
|
+
positions: Float64Array;
|
|
12875
|
+
indices: Uint32Array;
|
|
12876
|
+
normals: Float64Array;
|
|
12877
|
+
uvs: Float64Array;
|
|
12878
|
+
} | null;
|
|
12879
|
+
/** Reads a NurbsCurve geometry node. */
|
|
12880
|
+
export function extractNurbsCurve(node: FBXNode): FBXNurbsCurveData | null;
|
|
12881
|
+
/** Reads a NurbsSurface geometry node. */
|
|
12882
|
+
export function extractNurbsSurface(node: FBXNode): FBXNurbsSurfaceData | null;
|
|
12883
|
+
/** Tessellates a NurbsSurface geometry node into mesh geometry. */
|
|
12884
|
+
export function nurbsSurfaceToGeometry(node: FBXNode, geometryId: number, subdivisionOverride: number | undefined): FBXGeometryData | null;
|
|
12885
|
+
/** Reads a NurbsCurve geometry node into a tessellated polyline. */
|
|
12886
|
+
export function extractNurbsCurveGeometry(node: FBXNode, geometryId: number, subdivision?: number): FBXCurveGeometryData;
|
|
12887
|
+
/**
|
|
12888
|
+
* Reads a Line geometry node: Points plus PointsIndex where a negative index (~index) ends a segment, as in
|
|
12889
|
+
* polygon vertex indices.
|
|
12890
|
+
*/
|
|
12891
|
+
export function extractLineGeometry(node: FBXNode, geometryId: number): FBXCurveGeometryData;
|
|
12892
|
+
|
|
12893
|
+
}
|
|
12894
|
+
declare module "babylonjs-loaders/FBX/interpreter/nodeTransform" {
|
|
12895
|
+
import { FBXNode } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
12896
|
+
import { FBXPropertyTemplate } from "babylonjs-loaders/FBX/interpreter/propertyTemplates";
|
|
12897
|
+
/** Transform properties resolved from an FBX Model, with template defaults applied. */
|
|
12898
|
+
export interface FBXNodeTransformData {
|
|
12899
|
+
translation: [number, number, number];
|
|
12900
|
+
rotation: [number, number, number];
|
|
12901
|
+
scale: [number, number, number];
|
|
12902
|
+
preRotation: [number, number, number];
|
|
12903
|
+
postRotation: [number, number, number];
|
|
12904
|
+
rotationPivot: [number, number, number];
|
|
12905
|
+
scalingPivot: [number, number, number];
|
|
12906
|
+
rotationOffset: [number, number, number];
|
|
12907
|
+
scalingOffset: [number, number, number];
|
|
12908
|
+
geometricTranslation: [number, number, number];
|
|
12909
|
+
geometricRotation: [number, number, number];
|
|
12910
|
+
geometricScaling: [number, number, number];
|
|
12911
|
+
/** Rotation order: 0=XYZ, 1=XZY, 2=YZX, 3=YXZ, 4=ZXY, 5=ZYX, 6=SphericXYZ */
|
|
12912
|
+
rotationOrder: number;
|
|
12913
|
+
/** FBX transform inheritance mode. 0=RrSs, 1=RSrs, 2=Rrs */
|
|
12914
|
+
inheritType: number;
|
|
12915
|
+
/** Whether the rotation space (rotation order, pre/post rotation) is active for this node */
|
|
12916
|
+
rotationActive: boolean;
|
|
12917
|
+
diagnostics: string[];
|
|
12918
|
+
}
|
|
12919
|
+
/**
|
|
12920
|
+
* Resolves the transform properties of a Model node the way the FBX SDK evaluates them.
|
|
12921
|
+
*
|
|
12922
|
+
* `RotationActive` gates the whole rotation space: when it is false (the FbxNode template default), the SDK
|
|
12923
|
+
* composes `Lcl Rotation` in plain XYZ order and ignores `RotationOrder`, `PreRotation` and `PostRotation`.
|
|
12924
|
+
* `RotationSpaceForLimitOnly` restricts the rotation space to limits, which has the same effect for us.
|
|
12925
|
+
*/
|
|
12926
|
+
export function extractNodeTransform(modelNode: FBXNode, template?: FBXPropertyTemplate): FBXNodeTransformData;
|
|
12385
12927
|
|
|
12386
12928
|
}
|
|
12387
12929
|
declare module "babylonjs-loaders/FBX/interpreter/materials" {
|
|
12388
12930
|
import { FBXNode } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
12389
12931
|
import { FBXObjectMap } from "babylonjs-loaders/FBX/interpreter/connections";
|
|
12390
|
-
import { FBXPropertyTemplateMap } from "babylonjs-loaders/FBX/interpreter/propertyTemplates";
|
|
12932
|
+
import { FBXPropertyTemplate, FBXPropertyTemplateMap, FBXUserPropertyValue } from "babylonjs-loaders/FBX/interpreter/propertyTemplates";
|
|
12933
|
+
import { FBXMaterialModel } from "babylonjs-loaders/FBX/interpreter/materialModel";
|
|
12391
12934
|
/** Parsed material data */
|
|
12392
12935
|
export interface FBXMaterialData {
|
|
12393
12936
|
id: number;
|
|
@@ -12395,6 +12938,10 @@ export interface FBXMaterialData {
|
|
|
12395
12938
|
type: "Lambert" | "Phong";
|
|
12396
12939
|
properties: FBXMaterialProperties;
|
|
12397
12940
|
textures: FBXTextureRef[];
|
|
12941
|
+
/** Unified classic + PBR parameter model resolved from whichever shader flavour the file uses */
|
|
12942
|
+
model: FBXMaterialModel<FBXTextureRef>;
|
|
12943
|
+
/** User-defined properties */
|
|
12944
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
12398
12945
|
}
|
|
12399
12946
|
export interface FBXMaterialProperties {
|
|
12400
12947
|
diffuseColor?: [number, number, number];
|
|
@@ -12430,11 +12977,106 @@ export interface FBXTextureRef {
|
|
|
12430
12977
|
uvSetIndex?: number;
|
|
12431
12978
|
/** Which named UV set this texture uses */
|
|
12432
12979
|
uvSetName?: string;
|
|
12980
|
+
/** WrapModeU: 0 = repeat, 1 = clamp */
|
|
12981
|
+
wrapU?: number;
|
|
12982
|
+
/** WrapModeV: 0 = repeat, 1 = clamp */
|
|
12983
|
+
wrapV?: number;
|
|
12984
|
+
/** Set when the texture came from a LayeredTexture (only the first layer is used) */
|
|
12985
|
+
layeredTextureId?: number;
|
|
12433
12986
|
}
|
|
12434
12987
|
/**
|
|
12435
12988
|
* Extract material data from an FBX Material node.
|
|
12436
12989
|
*/
|
|
12437
12990
|
export function extractMaterial(materialNode: FBXNode, materialId: number, objectMap: FBXObjectMap, templates?: FBXPropertyTemplateMap): FBXMaterialData;
|
|
12991
|
+
export function extractTextureRef(id: number, node: FBXNode, propertyName: string | undefined, objectMap: FBXObjectMap, template?: FBXPropertyTemplate): FBXTextureRef;
|
|
12992
|
+
|
|
12993
|
+
}
|
|
12994
|
+
declare module "babylonjs-loaders/FBX/interpreter/materialModel" {
|
|
12995
|
+
/**
|
|
12996
|
+
* Unified material model.
|
|
12997
|
+
*
|
|
12998
|
+
* FBX materials come in many vendor flavours: the classic FbxSurfaceLambert / FbxSurfacePhong, Autodesk Standard
|
|
12999
|
+
* Surface (OSL), Arnold aiStandardSurface, 3ds Max Physical Material, 3ds Max PBR (metal/rough and spec/gloss),
|
|
13000
|
+
* the 3ds Max glTF material, OpenPBR, and Maya's Stingray PBS ShaderFX graph. Each stores its parameters under
|
|
13001
|
+
* different property names, sometimes behind a shader binding table.
|
|
13002
|
+
*
|
|
13003
|
+
* This module resolves any of them into two parameter sets, mirroring how the FBX SDK / ufbx expose materials:
|
|
13004
|
+
* `fbx` (the classic Lambert/Phong parameters) and `pbr` (a physically based parameter set), plus feature flags.
|
|
13005
|
+
*/
|
|
13006
|
+
import { FBXPropertyValue } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
13007
|
+
export type FBXShaderType = "unknown" | "fbxLambert" | "fbxPhong" | "oslStandardSurface" | "arnoldStandardSurface" | "3dsMaxPhysicalMaterial" | "3dsMaxPbrMetalRough" | "3dsMaxPbrSpecGloss" | "gltfMaterial" | "openPbrMaterial" | "shaderFxGraph";
|
|
13008
|
+
/** One resolved material parameter: a constant value and/or a texture. */
|
|
13009
|
+
export interface FBXMaterialMap<TTexture> {
|
|
13010
|
+
/** Constant value (r,g,b,a for colours, x for scalars) */
|
|
13011
|
+
value?: number[];
|
|
13012
|
+
/** Number of meaningful components in `value` (1 for scalars, 3 or 4 for colours) */
|
|
13013
|
+
valueComponents: number;
|
|
13014
|
+
/** Texture bound to the parameter */
|
|
13015
|
+
texture?: TTexture;
|
|
13016
|
+
/** Whether the texture is enabled (some vendors carry an explicit toggle) */
|
|
13017
|
+
textureEnabled: boolean;
|
|
13018
|
+
}
|
|
13019
|
+
export type FBXFbxMapName = "diffuseFactor" | "diffuseColor" | "specularFactor" | "specularColor" | "specularExponent" | "reflectionFactor" | "reflectionColor" | "transparencyFactor" | "transparencyColor" | "emissionFactor" | "emissionColor" | "ambientFactor" | "ambientColor" | "normalMap" | "bump" | "bumpFactor" | "displacement" | "displacementFactor" | "vectorDisplacement" | "vectorDisplacementFactor";
|
|
13020
|
+
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";
|
|
13021
|
+
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";
|
|
13022
|
+
export interface FBXMaterialModel<TTexture> {
|
|
13023
|
+
shaderType: FBXShaderType;
|
|
13024
|
+
/** Prefix material property names carry for this shader (e.g. "3dsMax|Parameters|") */
|
|
13025
|
+
shaderPropPrefix: string;
|
|
13026
|
+
fbx: Partial<Record<FBXFbxMapName, FBXMaterialMap<TTexture>>>;
|
|
13027
|
+
pbr: Partial<Record<FBXPbrMapName, FBXMaterialMap<TTexture>>>;
|
|
13028
|
+
features: Partial<Record<FBXMaterialFeatureName, {
|
|
13029
|
+
enabled: boolean;
|
|
13030
|
+
explicit: boolean;
|
|
13031
|
+
}>>;
|
|
13032
|
+
}
|
|
13033
|
+
/** Inputs needed to resolve a material, independent of the parse representation. */
|
|
13034
|
+
export interface FBXMaterialSource<TTexture> {
|
|
13035
|
+
/** "lambert", "phong", "unknown", ... as written in the file */
|
|
13036
|
+
shadingModelName: string;
|
|
13037
|
+
/** Property values by full property name (e.g. "DiffuseColor", "Maya|baseColor", "3dsMax|Parameters|roughness") */
|
|
13038
|
+
props: Map<string, {
|
|
13039
|
+
type: string;
|
|
13040
|
+
values: FBXPropertyValue[];
|
|
13041
|
+
}>;
|
|
13042
|
+
/** Textures connected to the material by property name (OP connection property) */
|
|
13043
|
+
texturesByProp: Map<string, TTexture>;
|
|
13044
|
+
/** Connected shader implementation, when any */
|
|
13045
|
+
shader?: {
|
|
13046
|
+
renderApi: string;
|
|
13047
|
+
/** shader semantic name -> material property names */
|
|
13048
|
+
bindings: Map<string, string[]>;
|
|
13049
|
+
};
|
|
13050
|
+
}
|
|
13051
|
+
/** Shader types whose parameters are physically based; the loader emits PBR materials for them by default. */
|
|
13052
|
+
export function isPbrShaderType(type: FBXShaderType): boolean;
|
|
13053
|
+
/** Detects the shader flavour of a material from its shading model name, connected shader and 3ds Max class ids. */
|
|
13054
|
+
export function detectShaderType<T>(source: FBXMaterialSource<T>): {
|
|
13055
|
+
shaderType: FBXShaderType;
|
|
13056
|
+
shaderPropPrefix: string;
|
|
13057
|
+
};
|
|
13058
|
+
/**
|
|
13059
|
+
* Resolves the unified material model from raw material data.
|
|
13060
|
+
*/
|
|
13061
|
+
export function resolveMaterialModel<T>(source: FBXMaterialSource<T>): FBXMaterialModel<T>;
|
|
13062
|
+
/** Colour (first three components) of a map, or undefined. */
|
|
13063
|
+
export function mapColor<T>(map: FBXMaterialMap<T> | undefined): [number, number, number] | undefined;
|
|
13064
|
+
/** Scalar (first component) of a map, or undefined. */
|
|
13065
|
+
export function mapScalar<T>(map: FBXMaterialMap<T> | undefined): number | undefined;
|
|
13066
|
+
|
|
13067
|
+
}
|
|
13068
|
+
declare module "babylonjs-loaders/FBX/interpreter/legacyDocument" {
|
|
13069
|
+
/**
|
|
13070
|
+
* FBX 5.x (and older) documents store everything at the top level: one `Model` node per object with inline
|
|
13071
|
+
* geometry, materials, skin links, lights and cameras, and `Children` lists instead of connections. This module
|
|
13072
|
+
* rewrites such a document into the 6.x layout (`Objects`, `Connections`, `Takes`) so the rest of the importer
|
|
13073
|
+
* can treat both the same way. The rules follow the FBX SDK's legacy reader as implemented by ufbx.
|
|
13074
|
+
*/
|
|
13075
|
+
import { FBXDocument } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
13076
|
+
/** True for pre-6000 files: no `Objects` section but top-level `Model` nodes. */
|
|
13077
|
+
export function isLegacyDocument(doc: FBXDocument): boolean;
|
|
13078
|
+
/** Rewrites a legacy document into the 6.x object/connection layout. */
|
|
13079
|
+
export function upgradeLegacyDocument(doc: FBXDocument): FBXDocument;
|
|
12438
13080
|
|
|
12439
13081
|
}
|
|
12440
13082
|
declare module "babylonjs-loaders/FBX/interpreter/geometry" {
|
|
@@ -12449,7 +13091,7 @@ export interface FBXUVSet {
|
|
|
12449
13091
|
/** Recoverable geometry import issue. */
|
|
12450
13092
|
export interface FBXGeometryDiagnostic {
|
|
12451
13093
|
/** Diagnostic category. */
|
|
12452
|
-
type: "degenerate-polygon" | "triangulation-fallback" | "layer-index-out-of-bounds" | "layer-data-too-short";
|
|
13094
|
+
type: "degenerate-polygon" | "triangulation-fallback" | "layer-index-out-of-bounds" | "layer-data-too-short" | "nurbs-invalid" | "nurbs-trim-ignored" | "nurbs-deformer-ignored";
|
|
12453
13095
|
/** Human-readable diagnostic message. */
|
|
12454
13096
|
message: string;
|
|
12455
13097
|
/** Polygon index associated with the diagnostic, if applicable. */
|
|
@@ -12496,8 +13138,11 @@ export function extractGeometry(geometryNode: FBXNode, nodeId: number): FBXGeome
|
|
|
12496
13138
|
|
|
12497
13139
|
}
|
|
12498
13140
|
declare module "babylonjs-loaders/FBX/interpreter/fbxInterpreter" {
|
|
13141
|
+
import { FBXUserPropertyValue } from "babylonjs-loaders/FBX/interpreter/propertyTemplates";
|
|
12499
13142
|
import { FBXDocument } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
12500
13143
|
import { FBXGeometryData } from "babylonjs-loaders/FBX/interpreter/geometry";
|
|
13144
|
+
import { FBXCurveGeometryData } from "babylonjs-loaders/FBX/interpreter/nurbs";
|
|
13145
|
+
import { FBXConstraintData } from "babylonjs-loaders/FBX/interpreter/constraints";
|
|
12501
13146
|
import { FBXMaterialData } from "babylonjs-loaders/FBX/interpreter/materials";
|
|
12502
13147
|
import { FBXSkinData } from "babylonjs-loaders/FBX/interpreter/skeleton";
|
|
12503
13148
|
import { FBXRigData } from "babylonjs-loaders/FBX/interpreter/rig";
|
|
@@ -12509,8 +13154,10 @@ export interface FBXModelData {
|
|
|
12509
13154
|
id: number;
|
|
12510
13155
|
name: string;
|
|
12511
13156
|
subType: string;
|
|
12512
|
-
/** Geometry attached to this model (
|
|
13157
|
+
/** Geometry attached to this model (meshes and tessellated NURBS surfaces) */
|
|
12513
13158
|
geometry?: FBXGeometryData;
|
|
13159
|
+
/** Curve geometry attached to this model (Line and NurbsCurve) */
|
|
13160
|
+
curve?: FBXCurveGeometryData;
|
|
12514
13161
|
/** Materials assigned to this model */
|
|
12515
13162
|
materials: FBXMaterialData[];
|
|
12516
13163
|
/** Child models */
|
|
@@ -12542,18 +13189,68 @@ export interface FBXModelData {
|
|
|
12542
13189
|
/** Whether backface culling is disabled ("CullingOff") */
|
|
12543
13190
|
cullingOff: boolean;
|
|
12544
13191
|
/** User-defined custom properties from Properties70 */
|
|
12545
|
-
customProperties?: Record<string,
|
|
13192
|
+
customProperties?: Record<string, FBXUserPropertyValue>;
|
|
13193
|
+
/** LOD group settings when this model is a LodGroup; children are the levels in order */
|
|
13194
|
+
lodGroup?: FBXLodGroupData;
|
|
13195
|
+
/** Display layer (CollectionExclusive) the model belongs to */
|
|
13196
|
+
displayLayer?: FBXDisplayLayerData;
|
|
12546
13197
|
/** Recoverable model import diagnostics */
|
|
12547
13198
|
diagnostics: string[];
|
|
12548
13199
|
}
|
|
13200
|
+
/** LOD group settings (NodeAttribute "LodGroup") */
|
|
13201
|
+
export interface FBXLodGroupData {
|
|
13202
|
+
/** Switch distance for level i+1 (level 0 has none). In scene units, or percent of screen when `relative`. */
|
|
13203
|
+
thresholds: number[];
|
|
13204
|
+
/** ThresholdsUsedAsPercentage */
|
|
13205
|
+
relative: boolean;
|
|
13206
|
+
/** DisplayLevels|LevelN: 0 use LOD, 1 show, 2 hide */
|
|
13207
|
+
displayLevels: number[];
|
|
13208
|
+
}
|
|
13209
|
+
/** Display layer (CollectionExclusive "DisplayLayer") */
|
|
13210
|
+
export interface FBXDisplayLayerData {
|
|
13211
|
+
id: number;
|
|
13212
|
+
name: string;
|
|
13213
|
+
show: boolean;
|
|
13214
|
+
freeze: boolean;
|
|
13215
|
+
color: [number, number, number];
|
|
13216
|
+
modelIds: number[];
|
|
13217
|
+
}
|
|
13218
|
+
/** One member of a selection set: a model, optionally with a component selection on its mesh */
|
|
13219
|
+
export interface FBXSelectionNodeData {
|
|
13220
|
+
modelId: number;
|
|
13221
|
+
/** IsTheNodeInSet: the whole node is selected (as opposed to only components) */
|
|
13222
|
+
includeNode: boolean;
|
|
13223
|
+
/** Selected control point indices (VertexIndexArray) */
|
|
13224
|
+
vertices?: number[];
|
|
13225
|
+
/** Selected edge indices (EdgeIndexArray) */
|
|
13226
|
+
edges?: number[];
|
|
13227
|
+
/** Selected polygon indices (PolygonIndexArray) */
|
|
13228
|
+
faces?: number[];
|
|
13229
|
+
}
|
|
13230
|
+
/** Selection set (Collection "SelectionSet") */
|
|
13231
|
+
export interface FBXSelectionSetData {
|
|
13232
|
+
id: number;
|
|
13233
|
+
name: string;
|
|
13234
|
+
members: FBXSelectionNodeData[];
|
|
13235
|
+
}
|
|
12549
13236
|
/** Camera data extracted from FBX */
|
|
12550
13237
|
export interface FBXCameraData {
|
|
12551
13238
|
/** Model ID this camera is attached to */
|
|
12552
13239
|
modelId: number;
|
|
13240
|
+
/** NodeAttribute object ID (animation curves target this) */
|
|
13241
|
+
attributeId: number;
|
|
12553
13242
|
/** Camera name */
|
|
12554
13243
|
name: string;
|
|
12555
|
-
/**
|
|
13244
|
+
/** Vertical field of view in degrees */
|
|
12556
13245
|
fieldOfView: number;
|
|
13246
|
+
/** Horizontal field of view in degrees */
|
|
13247
|
+
fieldOfViewX: number;
|
|
13248
|
+
/** ApertureMode: 0 horizontal and vertical, 1 horizontal, 2 vertical, 3 focal length */
|
|
13249
|
+
apertureMode: number;
|
|
13250
|
+
/** Aperture (film gate after gate fit) size in inches */
|
|
13251
|
+
apertureSizeInch: [number, number];
|
|
13252
|
+
/** Orthographic view size (width, height) in scene units */
|
|
13253
|
+
orthographicSize: [number, number];
|
|
12557
13254
|
/** Near clip plane */
|
|
12558
13255
|
nearPlane: number;
|
|
12559
13256
|
/** Far clip plane */
|
|
@@ -12572,6 +13269,8 @@ export interface FBXCameraData {
|
|
|
12572
13269
|
orthoZoom?: number;
|
|
12573
13270
|
/** Camera roll in degrees when present */
|
|
12574
13271
|
roll?: number;
|
|
13272
|
+
/** User-defined properties on the camera attribute */
|
|
13273
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
12575
13274
|
/** Known unsupported or unrecognized camera properties */
|
|
12576
13275
|
unknownProperties: string[];
|
|
12577
13276
|
/** Recoverable camera import diagnostics */
|
|
@@ -12581,6 +13280,8 @@ export interface FBXCameraData {
|
|
|
12581
13280
|
export interface FBXLightData {
|
|
12582
13281
|
/** Model ID this light is attached to */
|
|
12583
13282
|
modelId: number;
|
|
13283
|
+
/** NodeAttribute object ID (animation curves target this) */
|
|
13284
|
+
attributeId: number;
|
|
12584
13285
|
/** Light name */
|
|
12585
13286
|
name: string;
|
|
12586
13287
|
/** Light type: 0=Point, 1=Directional, 2=Spot */
|
|
@@ -12605,6 +13306,15 @@ export interface FBXLightData {
|
|
|
12605
13306
|
enableFarAttenuation?: boolean;
|
|
12606
13307
|
/** Whether the source light requested shadow casting */
|
|
12607
13308
|
castShadows?: boolean;
|
|
13309
|
+
/** Near/far attenuation ranges in scene units (when enabled) */
|
|
13310
|
+
nearAttenuationStart?: number;
|
|
13311
|
+
nearAttenuationEnd?: number;
|
|
13312
|
+
farAttenuationStart?: number;
|
|
13313
|
+
farAttenuationEnd?: number;
|
|
13314
|
+
/** Area light shape: 0 rectangle, 1 sphere */
|
|
13315
|
+
areaLightShape?: number;
|
|
13316
|
+
/** User-defined properties on the light attribute */
|
|
13317
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
12608
13318
|
/** Known unsupported or unrecognized light properties */
|
|
12609
13319
|
unknownProperties: string[];
|
|
12610
13320
|
/** Recoverable light import diagnostics */
|
|
@@ -12616,6 +13326,8 @@ export interface FBXSceneData {
|
|
|
12616
13326
|
rootModels: FBXModelData[];
|
|
12617
13327
|
/** All geometries in the scene */
|
|
12618
13328
|
geometries: FBXGeometryData[];
|
|
13329
|
+
/** All curve geometries (lines and tessellated NURBS curves) */
|
|
13330
|
+
curves: FBXCurveGeometryData[];
|
|
12619
13331
|
/** All materials in the scene */
|
|
12620
13332
|
materials: FBXMaterialData[];
|
|
12621
13333
|
/** Skin deformers (skeletons + vertex weights) */
|
|
@@ -12632,6 +13344,12 @@ export interface FBXSceneData {
|
|
|
12632
13344
|
lights: FBXLightData[];
|
|
12633
13345
|
/** Scene-level unsupported feature diagnostics */
|
|
12634
13346
|
diagnostics: FBXSceneDiagnostic[];
|
|
13347
|
+
/** Constraints (aim, parent, position, rotation, scale, IK) */
|
|
13348
|
+
constraints: FBXConstraintData[];
|
|
13349
|
+
/** Display layers */
|
|
13350
|
+
displayLayers: FBXDisplayLayerData[];
|
|
13351
|
+
/** Selection sets */
|
|
13352
|
+
selectionSets: FBXSelectionSetData[];
|
|
12635
13353
|
/** Global settings */
|
|
12636
13354
|
upAxis: number;
|
|
12637
13355
|
upAxisSign: number;
|
|
@@ -12640,11 +13358,91 @@ export interface FBXSceneData {
|
|
|
12640
13358
|
coordAxis: number;
|
|
12641
13359
|
coordAxisSign: number;
|
|
12642
13360
|
unitScaleFactor: number;
|
|
13361
|
+
/** Scene frame rate derived from GlobalSettings TimeMode / CustomFrameRate */
|
|
13362
|
+
frameRate: number;
|
|
12643
13363
|
}
|
|
12644
13364
|
/**
|
|
12645
13365
|
* Interpret a parsed FBX document into scene data.
|
|
12646
13366
|
*/
|
|
12647
|
-
|
|
13367
|
+
/** Options controlling how the document is interpreted. */
|
|
13368
|
+
export interface FBXInterpretOptions {
|
|
13369
|
+
/** Segments per knot span when tessellating NURBS surfaces; defaults to the Step stored in the file */
|
|
13370
|
+
nurbsSubdivision?: number;
|
|
13371
|
+
/** Shift every clip so its first key sits at time 0 (default true); false keeps the authored times */
|
|
13372
|
+
rebaseKeyframes?: boolean;
|
|
13373
|
+
}
|
|
13374
|
+
export function interpretFBX(doc: FBXDocument, options?: FBXInterpretOptions): FBXSceneData;
|
|
13375
|
+
|
|
13376
|
+
}
|
|
13377
|
+
declare module "babylonjs-loaders/FBX/interpreter/constraints" {
|
|
13378
|
+
import { FBXObjectMap } from "babylonjs-loaders/FBX/interpreter/connections";
|
|
13379
|
+
export type FBXConstraintType = "aim" | "parent" | "position" | "rotation" | "scale" | "singleChainIK" | "unknown";
|
|
13380
|
+
export type Vec3 = [number, number, number];
|
|
13381
|
+
export type Bool3 = [boolean, boolean, boolean];
|
|
13382
|
+
/** One weighted target of a constraint. */
|
|
13383
|
+
export interface FBXConstraintTarget {
|
|
13384
|
+
/** Model id of the target node */
|
|
13385
|
+
modelId: number;
|
|
13386
|
+
/** Normalized weight (file value / 100, or as-is for IK pole targets) */
|
|
13387
|
+
weight: number;
|
|
13388
|
+
/** Parent constraint translation offset expressed in the target's space */
|
|
13389
|
+
offsetTranslation: Vec3;
|
|
13390
|
+
/** Parent constraint rotation offset in degrees, expressed in the target's space */
|
|
13391
|
+
offsetRotation: Vec3;
|
|
13392
|
+
/** Parent constraint scale offset expressed in the target's space */
|
|
13393
|
+
offsetScale: Vec3;
|
|
13394
|
+
}
|
|
13395
|
+
/** A constraint object of the file, with its targets and parameters resolved. */
|
|
13396
|
+
export interface FBXConstraintData {
|
|
13397
|
+
/** Constraint object id */
|
|
13398
|
+
id: number;
|
|
13399
|
+
/** Constraint name */
|
|
13400
|
+
name: string;
|
|
13401
|
+
/** Resolved constraint kind */
|
|
13402
|
+
type: FBXConstraintType;
|
|
13403
|
+
/** Constraint type name as written in the file (e.g. "Parent-Child") */
|
|
13404
|
+
typeName: string;
|
|
13405
|
+
/** Constrained model */
|
|
13406
|
+
nodeId?: number;
|
|
13407
|
+
/** Weighted targets in file order */
|
|
13408
|
+
targets: FBXConstraintTarget[];
|
|
13409
|
+
/** Global weight (file value / 100) */
|
|
13410
|
+
weight: number;
|
|
13411
|
+
/** False when the constraint is switched off in the file */
|
|
13412
|
+
active: boolean;
|
|
13413
|
+
/** Which translation axes the constraint drives */
|
|
13414
|
+
affectTranslation: Bool3;
|
|
13415
|
+
/** Which rotation axes the constraint drives */
|
|
13416
|
+
affectRotation: Bool3;
|
|
13417
|
+
/** Which scale axes the constraint drives */
|
|
13418
|
+
affectScale: Bool3;
|
|
13419
|
+
/** Translation offset of the constrained node */
|
|
13420
|
+
offsetTranslation: Vec3;
|
|
13421
|
+
/** Rotation offset of the constrained node, in degrees */
|
|
13422
|
+
offsetRotation: Vec3;
|
|
13423
|
+
/** Scale offset of the constrained node */
|
|
13424
|
+
offsetScale: Vec3;
|
|
13425
|
+
/** Aim: local axis that points at the target */
|
|
13426
|
+
aimVector: Vec3;
|
|
13427
|
+
/** Aim: local axis aligned with the up direction */
|
|
13428
|
+
upVector: Vec3;
|
|
13429
|
+
/** Aim: world up direction (world up modes 2 and 3) */
|
|
13430
|
+
worldUpVector: Vec3;
|
|
13431
|
+
/** Aim: 0 scene up, 1 aim up node, 2 align to node, 3 vector, 4 none */
|
|
13432
|
+
worldUpType: number;
|
|
13433
|
+
/** Aim: model id of the world up object (world up modes 1 and 2) */
|
|
13434
|
+
worldUpNodeId?: number;
|
|
13435
|
+
/** Single chain IK: model id of the first joint of the chain */
|
|
13436
|
+
ikFirstJointId?: number;
|
|
13437
|
+
/** Single chain IK: model id of the last joint of the chain */
|
|
13438
|
+
ikEndJointId?: number;
|
|
13439
|
+
/** Single chain IK: model id of the effector */
|
|
13440
|
+
ikEffectorId?: number;
|
|
13441
|
+
/** Single chain IK: pole vector */
|
|
13442
|
+
ikPoleVector: Vec3;
|
|
13443
|
+
}
|
|
13444
|
+
/** Reads every constraint object of the scene. */
|
|
13445
|
+
export function extractConstraints(objectMap: FBXObjectMap): FBXConstraintData[];
|
|
12648
13446
|
|
|
12649
13447
|
}
|
|
12650
13448
|
declare module "babylonjs-loaders/FBX/interpreter/connections" {
|
|
@@ -12669,7 +13467,7 @@ export interface FBXObjectEntry {
|
|
|
12669
13467
|
/** Object node. */
|
|
12670
13468
|
node: FBXNode;
|
|
12671
13469
|
/** Source of the object entry. */
|
|
12672
|
-
source: "Objects" | "legacySyntheticGeometry";
|
|
13470
|
+
source: "Objects" | "legacySyntheticGeometry" | "legacySyntheticAttribute" | "legacySyntheticBlendShape";
|
|
12673
13471
|
/** Legacy string object name, when applicable. */
|
|
12674
13472
|
legacyName?: string;
|
|
12675
13473
|
/** True if the object was synthesized for legacy compatibility. */
|
|
@@ -12792,9 +13590,24 @@ export interface FBXBlendShapeData {
|
|
|
12792
13590
|
export function extractBlendShapes(objectMap: FBXObjectMap): FBXBlendShapeData[];
|
|
12793
13591
|
|
|
12794
13592
|
}
|
|
12795
|
-
declare module "babylonjs-loaders/FBX/interpreter/
|
|
12796
|
-
|
|
13593
|
+
declare module "babylonjs-loaders/FBX/interpreter/animationCurve" {
|
|
13594
|
+
/**
|
|
13595
|
+
* FBX animation curve model and evaluator.
|
|
13596
|
+
*
|
|
13597
|
+
* Keys carry cubic Bezier tangents expressed the way the FBX SDK stores them: a left and right tangent with a time
|
|
13598
|
+
* extent (dx, as a fraction of the segment scaled by the tangent weight) and a value extent (dy). Linear and constant
|
|
13599
|
+
* segments are represented the same way so that a single evaluator handles every case, including the weighted
|
|
13600
|
+
* tangents Maya and MotionBuilder write, TCB keys, and the pre/post extrapolation modes.
|
|
13601
|
+
*/
|
|
13602
|
+
/** FBX time units: 46186158000 ticks per second */
|
|
13603
|
+
export const FBX_TIME_UNIT = 46186158000;
|
|
12797
13604
|
export type FBXInterpolationType = "constant" | "linear" | "cubic";
|
|
13605
|
+
export type FBXExtrapolationMode = "constant" | "repeat" | "mirror" | "slope" | "repeatRelative";
|
|
13606
|
+
export interface FBXExtrapolation {
|
|
13607
|
+
mode: FBXExtrapolationMode;
|
|
13608
|
+
/** Number of repetitions, or -1 for infinite */
|
|
13609
|
+
repeatCount: number;
|
|
13610
|
+
}
|
|
12798
13611
|
/** A single keyframe */
|
|
12799
13612
|
export interface FBXKeyframe {
|
|
12800
13613
|
/** Time in seconds */
|
|
@@ -12805,9 +13618,15 @@ export interface FBXKeyframe {
|
|
|
12805
13618
|
interpolation: FBXInterpolationType;
|
|
12806
13619
|
/** Constant interpolation variant */
|
|
12807
13620
|
constantMode?: "standard" | "next";
|
|
12808
|
-
/**
|
|
13621
|
+
/** Left (incoming) tangent: time extent in seconds and value extent */
|
|
13622
|
+
leftDx: number;
|
|
13623
|
+
leftDy: number;
|
|
13624
|
+
/** Right (outgoing) tangent: time extent in seconds and value extent */
|
|
13625
|
+
rightDx: number;
|
|
13626
|
+
rightDy: number;
|
|
13627
|
+
/** Cubic outgoing slope in value units per second (derived, kept for consumers that export hermite keys) */
|
|
12809
13628
|
rightSlope?: number;
|
|
12810
|
-
/** Cubic incoming slope for the next key, in value units per second */
|
|
13629
|
+
/** Cubic incoming slope for the next key, in value units per second (derived) */
|
|
12811
13630
|
nextLeftSlope?: number;
|
|
12812
13631
|
}
|
|
12813
13632
|
/** An animation curve (one axis of one property) */
|
|
@@ -12818,7 +13637,60 @@ export interface FBXCurveData {
|
|
|
12818
13637
|
keys: FBXKeyframe[];
|
|
12819
13638
|
/** True for baked sample curves that should be connected as linear samples */
|
|
12820
13639
|
isSampled?: boolean;
|
|
13640
|
+
preExtrapolation?: FBXExtrapolation;
|
|
13641
|
+
postExtrapolation?: FBXExtrapolation;
|
|
13642
|
+
}
|
|
13643
|
+
/** Raw key attribute data for one key, after run-length decoding. */
|
|
13644
|
+
export interface FBXKeyAttributes {
|
|
13645
|
+
flags: number;
|
|
13646
|
+
data: [number, number, number, number];
|
|
13647
|
+
}
|
|
13648
|
+
/**
|
|
13649
|
+
* Builds keyframes from parallel time/value arrays and their (run-length encoded) attributes, resolving every
|
|
13650
|
+
* tangent mode the FBX SDK writes: user, broken, auto (with clamp / progressive clamp / time-independent flags and
|
|
13651
|
+
* auto bias), TCB, weighted, linear and constant.
|
|
13652
|
+
*/
|
|
13653
|
+
export function buildKeyframes(times: ArrayLike<number>, values: ArrayLike<number>, attributes: (index: number) => FBXKeyAttributes): FBXKeyframe[];
|
|
13654
|
+
/** Auto tangent as the FBX SDK computes it, including clamping and auto bias. */
|
|
13655
|
+
export function solveAutoTangent(prevTime: number, time: number, nextTime: number, prevValue: number, value: number, nextValue: number, weightLeft: number, weightRight: number, autoBias: number, flags: number): number;
|
|
13656
|
+
/** Builds a keyframe list from explicit per-key slopes (legacy Takes and synthetic curves). */
|
|
13657
|
+
export function keyframesFromSlopes(times: number[], values: number[], interpolation: FBXInterpolationType[], constantNext: boolean[], leftSlope: number[], rightSlope: number[], leftWeight?: number[], rightWeight?: number[]): FBXKeyframe[];
|
|
13658
|
+
/** Reads a `Pre-Extrapolation` / `Post-Extrapolation` block: `Type` is a character code, `Repetition` a count. */
|
|
13659
|
+
export function parseExtrapolation(typeValue: unknown, repetitionValue: unknown): FBXExtrapolation;
|
|
13660
|
+
export function evaluateCurve(curve: FBXCurveData | undefined, time: number, defaultValue: number, noExtrapolation?: boolean): number;
|
|
13661
|
+
export type Vec3 = [number, number, number];
|
|
13662
|
+
export type Quat = [number, number, number, number];
|
|
13663
|
+
/** Euler angles in degrees with an FBX rotation order (0=XYZ ... 5=ZYX; spheric falls back to XYZ) to a quaternion. */
|
|
13664
|
+
export function eulerToQuat(v: Vec3, order: number): Quat;
|
|
13665
|
+
/** Quaternion to Euler angles in degrees for an FBX rotation order (inverse of eulerToQuat). */
|
|
13666
|
+
export function quatToEuler(q: Quat, order: number): Vec3;
|
|
13667
|
+
/** Blend semantics of an animation layer, derived from its BlendMode and accumulation modes. */
|
|
13668
|
+
export interface FBXLayerBlend {
|
|
13669
|
+
/** Layer participates in blending (BlendMode Additive or Override Passthrough) */
|
|
13670
|
+
blended: boolean;
|
|
13671
|
+
/** Layer adds onto the result instead of replacing it (BlendMode Additive) */
|
|
13672
|
+
additive: boolean;
|
|
13673
|
+
/** Rotations compose as quaternions (RotationAccumulationMode ByLayer) */
|
|
13674
|
+
composeRotation: boolean;
|
|
13675
|
+
/** Scales compose multiplicatively (ScaleAccumulationMode Multiply) */
|
|
13676
|
+
composeScale: boolean;
|
|
13677
|
+
/** Layer weight in [0, 1] */
|
|
13678
|
+
weight: number;
|
|
12821
13679
|
}
|
|
13680
|
+
/**
|
|
13681
|
+
* Combines one animation layer's value into the running result, exactly as the FBX SDK evaluator does.
|
|
13682
|
+
* `kind` selects the accumulation rule: "R" rotations (degrees, rotation order given), "S" scales, anything else linear.
|
|
13683
|
+
*/
|
|
13684
|
+
export function combineLayerValue(result: Vec3, value: Vec3, layer: FBXLayerBlend, kind: "T" | "R" | "S" | "other", rotationOrder: number): Vec3;
|
|
13685
|
+
|
|
13686
|
+
}
|
|
13687
|
+
declare module "babylonjs-loaders/FBX/interpreter/animation" {
|
|
13688
|
+
import { FBXDocument } from "babylonjs-loaders/FBX/types/fbxTypes";
|
|
13689
|
+
import { FBXObjectMap } from "babylonjs-loaders/FBX/interpreter/connections";
|
|
13690
|
+
import { FBXCurveData, FBXLayerBlend } from "babylonjs-loaders/FBX/interpreter/animationCurve";
|
|
13691
|
+
export { FBX_TIME_UNIT } from "babylonjs-loaders/FBX/interpreter/animationCurve";
|
|
13692
|
+
export type { FBXCurveData, FBXExtrapolation, FBXExtrapolationMode, FBXInterpolationType, FBXKeyframe, FBXLayerBlend } from "babylonjs-loaders/FBX/interpreter/animationCurve";
|
|
13693
|
+
export { combineLayerValue, evaluateCurve, eulerToQuat, quatToEuler } from "babylonjs-loaders/FBX/interpreter/animationCurve";
|
|
12822
13694
|
/** An animation curve node (T/R/S for one bone) */
|
|
12823
13695
|
export interface FBXCurveNodeData {
|
|
12824
13696
|
/** Property type: "T" (translation), "R" (rotation), "S" (scale) */
|
|
@@ -12827,13 +13699,19 @@ export interface FBXCurveNodeData {
|
|
|
12827
13699
|
targetModelId: number;
|
|
12828
13700
|
/** Curves for each axis */
|
|
12829
13701
|
curves: FBXCurveData[];
|
|
13702
|
+
/** Index of the owning layer within the stack's layer list */
|
|
13703
|
+
layerIndex: number;
|
|
13704
|
+
/** Default channel values (`d|X`, `d|Y`, `d|Z`) used for channels without a curve */
|
|
13705
|
+
defaultValues?: [number, number, number];
|
|
12830
13706
|
}
|
|
12831
|
-
/**
|
|
13707
|
+
/** Non-transform animation curve node (property animation), evaluated by the loader when a Babylon mapping exists. */
|
|
12832
13708
|
export interface FBXUnsupportedCurveNodeData {
|
|
12833
13709
|
/** Raw AnimationCurveNode property type/name */
|
|
12834
13710
|
type: string;
|
|
12835
13711
|
/** CurveNode object ID */
|
|
12836
13712
|
id: number;
|
|
13713
|
+
/** Index of the owning layer within the stack's layer list */
|
|
13714
|
+
layerIndex: number;
|
|
12837
13715
|
/** Target object ID if the curve node is connected to an object/property */
|
|
12838
13716
|
targetId: number | null;
|
|
12839
13717
|
/** OP connection property name on the target, e.g. Visibility */
|
|
@@ -12872,6 +13750,10 @@ export interface FBXAnimationLayerData {
|
|
|
12872
13750
|
normalizedWeight: number;
|
|
12873
13751
|
/** Blend mode: 0=Additive, 1=Override, 2=OverridePassthrough */
|
|
12874
13752
|
blendMode: number;
|
|
13753
|
+
/** Resolved blend semantics used by the evaluator */
|
|
13754
|
+
blend: FBXLayerBlend;
|
|
13755
|
+
/** Animated layer weight (0-100), when the Weight property carries a curve */
|
|
13756
|
+
weightCurve?: FBXCurveData;
|
|
12875
13757
|
/** Curve nodes in this layer */
|
|
12876
13758
|
curveNodes: FBXCurveNodeData[];
|
|
12877
13759
|
/** Unsupported/non-TRS curve nodes preserved for diagnostics */
|
|
@@ -12879,6 +13761,14 @@ export interface FBXAnimationLayerData {
|
|
|
12879
13761
|
/** Recoverable layer diagnostics */
|
|
12880
13762
|
diagnostics: FBXAnimationDiagnostic[];
|
|
12881
13763
|
}
|
|
13764
|
+
/** Options for animation extraction. */
|
|
13765
|
+
export interface FBXAnimationExtractOptions {
|
|
13766
|
+
/**
|
|
13767
|
+
* Shift each clip so its first key sits at time 0 (default true). False keeps the times authored in the file, so
|
|
13768
|
+
* clips of one file stay aligned with each other and with the declared stack range.
|
|
13769
|
+
*/
|
|
13770
|
+
rebaseKeyframes?: boolean;
|
|
13771
|
+
}
|
|
12882
13772
|
/** One animation clip (AnimationStack) */
|
|
12883
13773
|
export interface FBXAnimationStackData {
|
|
12884
13774
|
/** Animation name */
|
|
@@ -12901,13 +13791,7 @@ export interface FBXAnimationStackData {
|
|
|
12901
13791
|
/**
|
|
12902
13792
|
* Extract all animation stacks from the FBX scene.
|
|
12903
13793
|
*/
|
|
12904
|
-
export function extractAnimations(objectMap: FBXObjectMap): FBXAnimationStackData[];
|
|
12905
|
-
/**
|
|
12906
|
-
* Determines whether a key sequence appears to be a uniformly frame-baked sampled curve.
|
|
12907
|
-
* @param keys - Keyframes to inspect
|
|
12908
|
-
* @returns true if the keys look like sampled frame data rather than authored interpolation
|
|
12909
|
-
*/
|
|
12910
|
-
export function isFrameBakedSampledCurve(keys: readonly FBXKeyframe[]): boolean;
|
|
13794
|
+
export function extractAnimations(objectMap: FBXObjectMap, doc?: FBXDocument, options?: FBXAnimationExtractOptions): FBXAnimationStackData[];
|
|
12911
13795
|
/**
|
|
12912
13796
|
* Samples an FBX animation curve at a specific time.
|
|
12913
13797
|
* @param curveData - Curve data to sample
|
|
@@ -12915,6 +13799,54 @@ export function isFrameBakedSampledCurve(keys: readonly FBXKeyframe[]): boolean;
|
|
|
12915
13799
|
* @returns The sampled value, or null when the curve has no keys
|
|
12916
13800
|
*/
|
|
12917
13801
|
export function sampleFBXCurveAtTime(curveData: FBXCurveData | undefined, time: number): number | null;
|
|
13802
|
+
/**
|
|
13803
|
+
* Pre-7000 files store animation in a top-level `Takes` block instead of AnimationStack/Layer/CurveNode objects:
|
|
13804
|
+
*
|
|
13805
|
+
* Takes: { Take: "name" { LocalTime: start, stop
|
|
13806
|
+
* Model: "Model::joint1" { Channel: "Transform" { Channel: "T" { Channel: "X" { Default, KeyVer, KeyCount, Key } } } } } }
|
|
13807
|
+
*
|
|
13808
|
+
* Each take becomes one animation stack with a single layer. Models are matched through the same legacy string ids
|
|
13809
|
+
* that the connection resolver synthesizes for 6.x objects.
|
|
13810
|
+
*/
|
|
13811
|
+
export function extractLegacyTakes(doc: FBXDocument, objectMap: FBXObjectMap, rebaseKeyframes?: boolean): FBXAnimationStackData[];
|
|
13812
|
+
/**
|
|
13813
|
+
* Evaluates one transform channel (T, R or S) of a target at `time`, blending every animation layer of the stack the
|
|
13814
|
+
* way the FBX SDK does: the first layer animating the channel replaces the static value, later layers are combined
|
|
13815
|
+
* according to their blend mode, weight and accumulation modes.
|
|
13816
|
+
* @param curveNodes - Curve nodes targeting this model (any layers, any types)
|
|
13817
|
+
* @param layers - Stack layers, in order
|
|
13818
|
+
* @param type - Channel to evaluate
|
|
13819
|
+
* @param staticValue - Value when nothing animates the channel
|
|
13820
|
+
* @param rotationOrder - Rotation order of the target (for rotation composition)
|
|
13821
|
+
* @param time - Time in seconds
|
|
13822
|
+
*/
|
|
13823
|
+
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];
|
|
13824
|
+
/** Curves of one animated property (or blend shape weight) contributed by one animation layer. */
|
|
13825
|
+
export interface FBXLayeredPropertySource {
|
|
13826
|
+
/** Index of the owning layer within the stack's layer list */
|
|
13827
|
+
layerIndex: number;
|
|
13828
|
+
/** Curves of the property, keyed by channel name (`d|X`, `d|DeformPercent`, ...) */
|
|
13829
|
+
curves: readonly FBXCurveData[];
|
|
13830
|
+
/** Default channel values stored on the curve node */
|
|
13831
|
+
defaultValues?: Record<string, number>;
|
|
13832
|
+
}
|
|
13833
|
+
/**
|
|
13834
|
+
* Evaluates an animated property through the animation layers: the base layer replaces the static value, every
|
|
13835
|
+
* further layer blends onto the running result according to its blend mode and (possibly animated) weight, like
|
|
13836
|
+
* `evaluateLayeredChannel` does for transforms.
|
|
13837
|
+
* @param sources - Per-layer curves of the property
|
|
13838
|
+
* @param layers - Stack layers, in order
|
|
13839
|
+
* @param channels - Channel names to evaluate, in output order
|
|
13840
|
+
* @param staticValue - Value per channel when nothing animates it
|
|
13841
|
+
* @param time - Time in seconds
|
|
13842
|
+
* @returns One value per channel
|
|
13843
|
+
*/
|
|
13844
|
+
export function evaluateLayeredProperty(sources: readonly FBXLayeredPropertySource[], layers: readonly FBXAnimationLayerData[], channels: readonly string[], staticValue: readonly number[], time: number): number[];
|
|
13845
|
+
/**
|
|
13846
|
+
* True when every curve of the given channel is inside a constant (stepped) segment at `time`, so a baked key at
|
|
13847
|
+
* that time should hold its value instead of interpolating towards the next sample.
|
|
13848
|
+
*/
|
|
13849
|
+
export function isChannelSteppedAt(curveNodes: readonly FBXCurveNodeData[], type: "T" | "R" | "S", time: number): boolean;
|
|
12918
13850
|
|
|
12919
13851
|
}
|
|
12920
13852
|
declare module "babylonjs-loaders/BVH/pure" {
|
|
@@ -22283,7 +23215,7 @@ declare namespace BABYLON {
|
|
|
22283
23215
|
|
|
22284
23216
|
|
|
22285
23217
|
export const COMMAND_MAGIC = 1111774037;
|
|
22286
|
-
export const PROTOCOL_VERSION =
|
|
23218
|
+
export const PROTOCOL_VERSION = 5;
|
|
22287
23219
|
export const MISSING_OFFSET = 4294967295;
|
|
22288
23220
|
export enum Command {
|
|
22289
23221
|
Scene = 1,
|
|
@@ -22295,7 +23227,9 @@ declare namespace BABYLON {
|
|
|
22295
23227
|
Mesh = 7,
|
|
22296
23228
|
Instance = 8,
|
|
22297
23229
|
Animation = 9,
|
|
22298
|
-
AnalyticPrimitive = 10
|
|
23230
|
+
AnalyticPrimitive = 10,
|
|
23231
|
+
ThinInstances = 11,
|
|
23232
|
+
MorphTarget = 12
|
|
22299
23233
|
}
|
|
22300
23234
|
export enum AnalyticPrimitiveType {
|
|
22301
23235
|
Cube = 0,
|
|
@@ -22310,19 +23244,33 @@ declare namespace BABYLON {
|
|
|
22310
23244
|
}
|
|
22311
23245
|
export enum AnimationTarget {
|
|
22312
23246
|
Node = 0,
|
|
22313
|
-
Bone = 1
|
|
23247
|
+
Bone = 1,
|
|
23248
|
+
MorphTarget = 2
|
|
22314
23249
|
}
|
|
22315
23250
|
export enum AnimationProperty {
|
|
22316
23251
|
Position = 0,
|
|
22317
23252
|
RotationQuaternion = 1,
|
|
22318
23253
|
Scaling = 2,
|
|
22319
|
-
Matrix = 3
|
|
23254
|
+
Matrix = 3,
|
|
23255
|
+
Influence = 4
|
|
22320
23256
|
}
|
|
22321
23257
|
export enum MaterialFlags {
|
|
22322
23258
|
DoubleSided = 1,
|
|
22323
23259
|
Unlit = 2,
|
|
22324
23260
|
AlphaBlend = 4
|
|
22325
23261
|
}
|
|
23262
|
+
export enum TextureOutputChannel {
|
|
23263
|
+
R = 0,
|
|
23264
|
+
G = 1,
|
|
23265
|
+
B = 2,
|
|
23266
|
+
A = 3,
|
|
23267
|
+
RGB = 4
|
|
23268
|
+
}
|
|
23269
|
+
export enum USDTextureColorSpace {
|
|
23270
|
+
Auto = 0,
|
|
23271
|
+
Raw = 1,
|
|
23272
|
+
SRGB = 2
|
|
23273
|
+
}
|
|
22326
23274
|
export enum MeshFlags {
|
|
22327
23275
|
DoubleSided = 1,
|
|
22328
23276
|
LeftHanded = 2
|
|
@@ -24964,12 +25912,83 @@ declare namespace BABYLON {
|
|
|
24964
25912
|
* Defines options for the FBX loader.
|
|
24965
25913
|
*/
|
|
24966
25914
|
export interface FBXFileLoaderOptions {
|
|
25915
|
+
/**
|
|
25916
|
+
* Bundle of defaults for the options that change what the loaded scene looks like.
|
|
25917
|
+
* - "compatible" (default): the behaviour of the loader as first shipped: StandardMaterial for every material,
|
|
25918
|
+
* one Babylon geometry per model, curve geometry skipped, constraints recorded as metadata only, clips rebased
|
|
25919
|
+
* to start at frame 0, cameras and lights placed in world space.
|
|
25920
|
+
* - "full": everything the loader can do: PBRMaterial for physically based shaders, geometry shared between
|
|
25921
|
+
* instances, curves as lines meshes, constraints solved at runtime, authored clip times, cameras and lights
|
|
25922
|
+
* parented to their nodes so they animate.
|
|
25923
|
+
* An option set explicitly always wins over the preset.
|
|
25924
|
+
*/
|
|
25925
|
+
preset?: "compatible" | "full";
|
|
24967
25926
|
/**
|
|
24968
25927
|
* Source convention for tangent-space normal maps connected through FBX normal-map slots.
|
|
24969
25928
|
* FBX does not standardize this convention, so the loader defaults to the glTF/USD-style Y-up convention.
|
|
24970
25929
|
* Set to "y-down" for assets authored with inverted green/Y normal maps.
|
|
24971
25930
|
*/
|
|
24972
25931
|
normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;
|
|
25932
|
+
/**
|
|
25933
|
+
* Which Babylon material to build.
|
|
25934
|
+
* - "standard" (default, "full" preset: "auto"): always StandardMaterial (PBR parameters are approximated).
|
|
25935
|
+
* - "auto": PBRMaterial for physically based FBX materials (Standard Surface, Arnold, 3ds Max Physical,
|
|
25936
|
+
* 3ds Max PBR, glTF, OpenPBR, Stingray PBS) and StandardMaterial for classic Lambert/Phong materials.
|
|
25937
|
+
* - "pbr": always PBRMaterial (Lambert/Phong parameters are converted).
|
|
25938
|
+
*/
|
|
25939
|
+
materials?: "auto" | "standard" | "pbr";
|
|
25940
|
+
/**
|
|
25941
|
+
* Unit conversion applied at the root of the loaded hierarchy.
|
|
25942
|
+
* - "preserve" (default): keep the file's units (1 Babylon unit = 1 FBX unit).
|
|
25943
|
+
* - "meters": scale so that 1 Babylon unit is 1 meter, using the file's UnitScaleFactor.
|
|
25944
|
+
* - a number: centimeters per Babylon unit (100 = meters, 1 = centimeters, 2.54 = inches).
|
|
25945
|
+
*/
|
|
25946
|
+
unitScale?: "preserve" | "meters" | number;
|
|
25947
|
+
/**
|
|
25948
|
+
* Share vertex data between models that reference the same FBX geometry (default false, "full" preset: true).
|
|
25949
|
+
* Skinned meshes are never shared.
|
|
25950
|
+
*/
|
|
25951
|
+
shareGeometry?: boolean;
|
|
25952
|
+
/**
|
|
25953
|
+
* Called for every recoverable issue found while loading (unsupported features, malformed data that was
|
|
25954
|
+
* skipped, approximations). The same list is stored on the root node's metadata as `fbxDiagnostics`.
|
|
25955
|
+
*/
|
|
25956
|
+
onWarning?: (warning: FBXLoaderWarning) => void;
|
|
25957
|
+
/**
|
|
25958
|
+
* Segments per knot span when tessellating NURBS surfaces. Zero or undefined uses the subdivision stored in
|
|
25959
|
+
* the file (usually 4), capped at 16.
|
|
25960
|
+
*/
|
|
25961
|
+
nurbsSubdivision?: number;
|
|
25962
|
+
/** How curve geometry (Line, NurbsCurve) is imported: skipped (default) or as lines meshes ("full" preset). */
|
|
25963
|
+
curves?: "lines" | "skip";
|
|
25964
|
+
/**
|
|
25965
|
+
* Constraints (aim, parent, position, rotation, scale): "metadata" (default) only records them on the nodes,
|
|
25966
|
+
* "apply" ("full" preset) attaches an `FBXConstraintBehavior` to each constrained node so it is solved before
|
|
25967
|
+
* every render. IK chains are always metadata only.
|
|
25968
|
+
*/
|
|
25969
|
+
constraints?: "apply" | "metadata";
|
|
25970
|
+
/**
|
|
25971
|
+
* Shift every clip so its first keyframe sits at frame 0 (default true). With false ("full" preset) keys keep
|
|
25972
|
+
* the times authored in the file, so clips of one file stay aligned with each other and with their declared
|
|
25973
|
+
* ranges.
|
|
25974
|
+
*/
|
|
25975
|
+
rebaseAnimations?: boolean;
|
|
25976
|
+
/**
|
|
25977
|
+
* Parent cameras and lights to their FBX node so they follow its animation (default false, "full" preset:
|
|
25978
|
+
* true). Otherwise they are created at the node's world position and orientation, unparented.
|
|
25979
|
+
*/
|
|
25980
|
+
attachCamerasAndLights?: boolean;
|
|
25981
|
+
}
|
|
25982
|
+
/** A recoverable issue reported while loading an FBX file. */
|
|
25983
|
+
export interface FBXLoaderWarning {
|
|
25984
|
+
/** Which part of the loader reported the issue */
|
|
25985
|
+
source: "scene" | "model" | "geometry" | "skin" | "rig" | "animation" | "blendShape" | "camera" | "light";
|
|
25986
|
+
/** Human readable description */
|
|
25987
|
+
message: string;
|
|
25988
|
+
/** Name of the affected object, when known */
|
|
25989
|
+
objectName?: string;
|
|
25990
|
+
/** Structured details from the interpreter, when any */
|
|
25991
|
+
details?: unknown;
|
|
24973
25992
|
}
|
|
24974
25993
|
/**
|
|
24975
25994
|
* FBX file loader plugin for Babylon.js.
|
|
@@ -24992,6 +26011,22 @@ declare namespace BABYLON {
|
|
|
24992
26011
|
private readonly _bindRestBones;
|
|
24993
26012
|
private readonly _sourceBonesBySkeleton;
|
|
24994
26013
|
private readonly _scaleCompensationHelpersBySkeleton;
|
|
26014
|
+
/** Frame rate of the file being loaded (GlobalSettings TimeMode); animation is baked at this rate. */
|
|
26015
|
+
private _frameRate;
|
|
26016
|
+
/** Layers of the animation stack currently being converted; used by the transform samplers. */
|
|
26017
|
+
private _activeLayers;
|
|
26018
|
+
/** Parent model per model id, for inherit-mode aware sampling. */
|
|
26019
|
+
private _parentModelById;
|
|
26020
|
+
/** Curve nodes per model id for the stack currently being converted. */
|
|
26021
|
+
private _curveNodesByModelId;
|
|
26022
|
+
/** Helper nodes inserted above models whose InheritType is not RSrs. */
|
|
26023
|
+
private _inheritScaleHelpers;
|
|
26024
|
+
/** First mesh built per (geometry, geometric transform), for geometry sharing between instances. */
|
|
26025
|
+
private _meshByGeometryKey;
|
|
26026
|
+
/** Instance mesh -> source mesh whose geometry it shares. */
|
|
26027
|
+
private _instanceSource;
|
|
26028
|
+
/** Property curve nodes that were mapped onto Babylon animations; their "not evaluated" diagnostics are dropped. */
|
|
26029
|
+
private _evaluatedCurveNodeIds;
|
|
24995
26030
|
/**
|
|
24996
26031
|
* Creates a new FBX loader.
|
|
24997
26032
|
* @param options - Options controlling FBX loading behavior
|
|
@@ -25034,6 +26069,11 @@ declare namespace BABYLON {
|
|
|
25034
26069
|
* @returns A promise containing the loaded asset container
|
|
25035
26070
|
*/
|
|
25036
26071
|
loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<AssetContainer>;
|
|
26072
|
+
/**
|
|
26073
|
+
* Parses and interprets the file. Parsing is synchronous, so no progress events are emitted: the scene loader's
|
|
26074
|
+
* progress callback reports download bytes and must not be fed synthetic counts.
|
|
26075
|
+
*/
|
|
26076
|
+
private _parseAndInterpret;
|
|
25037
26077
|
private _parse;
|
|
25038
26078
|
private _parseFromArrayBuffer;
|
|
25039
26079
|
private _buildScene;
|
|
@@ -25045,6 +26085,15 @@ declare namespace BABYLON {
|
|
|
25045
26085
|
private _linkSkeletonsToTransformNodes;
|
|
25046
26086
|
private static _modelSubtreeMatchesNameFilter;
|
|
25047
26087
|
private static _applyModelMetadata;
|
|
26088
|
+
/**
|
|
26089
|
+
* Wires a LodGroup's children as Babylon LOD levels: the first child holds the highest detail; every further
|
|
26090
|
+
* child replaces it beyond the group's threshold distance (or screen coverage when thresholds are percentages).
|
|
26091
|
+
* Each child's display mode is honoured first: level 1 (show) stays visible outside the LOD chain, level 2
|
|
26092
|
+
* (hide) is disabled, and only level 0 (use LOD) children take part in the distance switching.
|
|
26093
|
+
*/
|
|
26094
|
+
private static _applyLodGroup;
|
|
26095
|
+
/** Builds a lines mesh from Line or tessellated NurbsCurve geometry, applying the model's geometric transform. */
|
|
26096
|
+
private _createLinesMesh;
|
|
25048
26097
|
private _createMesh;
|
|
25049
26098
|
/**
|
|
25050
26099
|
* Apply multi-material to a mesh by creating sub-meshes grouped by material index.
|
|
@@ -25068,6 +26117,11 @@ declare namespace BABYLON {
|
|
|
25068
26117
|
*/
|
|
25069
26118
|
private _buildSkinningData;
|
|
25070
26119
|
private _createMaterial;
|
|
26120
|
+
private _createPbrMaterial;
|
|
26121
|
+
/** Alpha of a classic Lambert/Phong material: Opacity when present, otherwise 1 - TransparentColor * TransparencyFactor. */
|
|
26122
|
+
private static _alphaFromClassicTransparency;
|
|
26123
|
+
private static _applyTextureSettings;
|
|
26124
|
+
private _createStandardMaterial;
|
|
25071
26125
|
private _configureNormalTexture;
|
|
25072
26126
|
private _getNormalMapTangentHandednessScale;
|
|
25073
26127
|
private static _isSupportedMaterialTextureSlot;
|
|
@@ -25091,11 +26145,27 @@ declare namespace BABYLON {
|
|
|
25091
26145
|
private _createCamera;
|
|
25092
26146
|
private _createLight;
|
|
25093
26147
|
private _createSkeleton;
|
|
26148
|
+
private _rigBoneModelIds;
|
|
26149
|
+
private _isRigBone;
|
|
25094
26150
|
private _getSourceBone;
|
|
25095
26151
|
private _getScaleCompensationHelper;
|
|
25096
26152
|
private static _computeFBXAbsoluteMatrices;
|
|
26153
|
+
/**
|
|
26154
|
+
* Effective ("inherit") scale of every bone, following the FBX SDK: the local scale for RSrs bones, and for
|
|
26155
|
+
* RrSs / Rrs bones the local scale multiplied by the scale of the bone's inherit-scale node (the parent for RrSs,
|
|
26156
|
+
* the parent's inherit-scale node for Rrs). Bones are ordered parents first.
|
|
26157
|
+
*/
|
|
26158
|
+
private static _computeBoneInheritScales;
|
|
26159
|
+
private static _getBoneInheritScaleNode;
|
|
26160
|
+
/** Scale a bone inherits into its own scale (RrSs chains), or unit scale. */
|
|
26161
|
+
private static _getBoneInheritedScale;
|
|
25097
26162
|
private static _computeFBXRuntimeLocalMatrix;
|
|
25098
26163
|
private static _applyParentScaleCompensation;
|
|
26164
|
+
/**
|
|
26165
|
+
* Splits a bone's FBX local matrix into a helper (which cancels the parent scale and carries the translation,
|
|
26166
|
+
* so the translation still follows the parent scale as the SDK does) and the bone's own rotation/scale. For RrSs
|
|
26167
|
+
* bones the inherited scale is folded into the bone scale.
|
|
26168
|
+
*/
|
|
25099
26169
|
private static _splitParentScaleCompensatedLocalMatrix;
|
|
25100
26170
|
private static _safeInverseScale;
|
|
25101
26171
|
private static _getInverseScaleVector;
|
|
@@ -25112,13 +26182,8 @@ declare namespace BABYLON {
|
|
|
25112
26182
|
* In row-vector convention: v' = v * M
|
|
25113
26183
|
*/
|
|
25114
26184
|
private static _computeFBXLocalMatrix;
|
|
25115
|
-
|
|
25116
|
-
* Apply the FBX transform chain to a Babylon TransformNode or Mesh.
|
|
25117
|
-
* Decomposes the full local matrix into position/rotation/scale.
|
|
25118
|
-
*/
|
|
25119
|
-
private static _applyFBXTransform;
|
|
26185
|
+
private _applyRestTRS;
|
|
25120
26186
|
private static _computeFBXModelLocalMatrix;
|
|
25121
|
-
private static _getBoneReferenceWorldMatrix;
|
|
25122
26187
|
private static _applyMatrixToTransform;
|
|
25123
26188
|
private _createAnimationGroup;
|
|
25124
26189
|
private _buildInheritedRigBoneAnimations;
|
|
@@ -25128,9 +26193,61 @@ declare namespace BABYLON {
|
|
|
25128
26193
|
* Computes the full FBX transform matrix at each keyframe and decomposes into TRS.
|
|
25129
26194
|
*/
|
|
25130
26195
|
private _buildNodeAnimations;
|
|
26196
|
+
/**
|
|
26197
|
+
* Baked keys are interpolated linearly by Babylon. Between two frames an FBX cubic segment can deviate from that
|
|
26198
|
+
* line, so sample times are refined (midpoints inserted, up to two levels) wherever the interpolated transform
|
|
26199
|
+
* differs noticeably from the curve. Flat and linear segments stay at frame resolution.
|
|
26200
|
+
*/
|
|
26201
|
+
private static _refineSampleTimes;
|
|
26202
|
+
/**
|
|
26203
|
+
* Keys of a scalar property animated by one or more layers: the authored keys when a single layer drives it,
|
|
26204
|
+
* otherwise the frame grid evaluated through the layer stack.
|
|
26205
|
+
* @param sources - Per-layer curves of the property (each with at least one curve)
|
|
26206
|
+
* @param animStack - Stack being converted
|
|
26207
|
+
* @param mapValue - Conversion from the FBX value to the Babylon property value
|
|
26208
|
+
* @returns Animation keys
|
|
26209
|
+
*/
|
|
26210
|
+
private _layeredScalarKeys;
|
|
26211
|
+
/**
|
|
26212
|
+
* Maps an animated FBX property (anything other than node transforms and blend shape weights) onto the Babylon
|
|
26213
|
+
* property that carries it: mesh visibility, camera field of view and clip planes, light intensity, colour and
|
|
26214
|
+
* cone angles, and material colours, alpha, roughness and metalness. `group` holds the curve nodes of every
|
|
26215
|
+
* layer animating that property, in layer order; several layers are evaluated through the layer stack.
|
|
26216
|
+
*/
|
|
26217
|
+
private _buildPropertyAnimations;
|
|
26218
|
+
/** Records constraints on their nodes and, unless disabled, attaches the runtime behavior that solves them. */
|
|
26219
|
+
private _applyConstraints;
|
|
26220
|
+
/** Collects every recoverable issue the interpreter recorded, stores it on the root node and notifies the caller. */
|
|
26221
|
+
private _reportDiagnostics;
|
|
26222
|
+
/** Curve nodes affecting the inherit scale of a model: its own scale curves and those of its inherit-scale chain. */
|
|
26223
|
+
private _collectInheritScaleCurves;
|
|
25131
26224
|
private _isVector3KeysConstant;
|
|
26225
|
+
/** Samples the animated Lcl Translation / Rotation / Scaling of a model, blending all layers of the active stack. */
|
|
26226
|
+
private _sampleModelTRS;
|
|
26227
|
+
/**
|
|
26228
|
+
* Local position/rotation/scale of a model from FBX Lcl values. Without pivots and offsets the components map
|
|
26229
|
+
* directly (rotation = pre * lcl * post⁻¹), which keeps zero and negative scales exact. With pivots the full
|
|
26230
|
+
* matrix is built and decomposed.
|
|
26231
|
+
*/
|
|
26232
|
+
private static _computeLocalTRS;
|
|
26233
|
+
/** Applies inherit-mode adjustments to a local TRS (see _computeInheritAwareLocalMatrix). */
|
|
26234
|
+
private _adjustTRSForInheritMode;
|
|
25132
26235
|
private _sampleModelLocalMatrix;
|
|
25133
26236
|
private _sampleModelScale;
|
|
26237
|
+
/**
|
|
26238
|
+
* Effective scale of a model for inherit-mode math (`inherit_scale` in ufbx terms): its own local scale, multiplied
|
|
26239
|
+
* componentwise by the inherited scale when the model uses RrSs inheritance. `time` samples animation; undefined
|
|
26240
|
+
* uses the rest pose.
|
|
26241
|
+
*/
|
|
26242
|
+
private _getInheritScale;
|
|
26243
|
+
/** RrSs nodes inherit scale from their parent; Rrs nodes skip their immediate parent (chaining through Rrs parents). */
|
|
26244
|
+
private _getInheritScaleNode;
|
|
26245
|
+
/**
|
|
26246
|
+
* Local matrix of a model relative to its Babylon parent frame, accounting for inherit modes. For RSrs (the
|
|
26247
|
+
* default) this is the FBX local matrix. For RrSs / Rrs the node sits under a helper that removes the parent's
|
|
26248
|
+
* scale, so translation is pre-scaled by the parent scale and (for RrSs) scale accumulates componentwise.
|
|
26249
|
+
*/
|
|
26250
|
+
private _computeInheritAwareLocalMatrix;
|
|
25134
26251
|
/**
|
|
25135
26252
|
* Build matrix-baked bone animation from full FBX local transforms.
|
|
25136
26253
|
* The bind matrix carries the skinning offset, so animation curves drive
|
|
@@ -25165,6 +26282,189 @@ declare namespace BABYLON {
|
|
|
25165
26282
|
*/
|
|
25166
26283
|
|
|
25167
26284
|
|
|
26285
|
+
/**
|
|
26286
|
+
* Runtime evaluation of FBX constraints. An `FBXConstraintBehavior` is attached to each constrained node; all
|
|
26287
|
+
* behaviors of a scene register with one `FBXConstraintSolver`, which solves them in dependency order (a constraint
|
|
26288
|
+
* whose target or parent is driven by another constraint is solved after it) and reuses scratch objects, so solving
|
|
26289
|
+
* allocates nothing per frame.
|
|
26290
|
+
*
|
|
26291
|
+
* The solver brackets the scene's animation phase: before animations run it writes each node's unconstrained
|
|
26292
|
+
* transform back, after they ran it captures the result as the new unconstrained transform and solves. A partial
|
|
26293
|
+
* weight therefore always blends from what animation (or nothing) produced this frame, never from the previous
|
|
26294
|
+
* solve's output, so a 50% weight stays a 50% blend instead of converging on the target.
|
|
26295
|
+
*
|
|
26296
|
+
* All maths happen in FBX space, i.e. relative to the loader's root node, so the handedness conversion applied
|
|
26297
|
+
* at the root never enters the solve.
|
|
26298
|
+
*/
|
|
26299
|
+
/** Resolved target of a constraint. */
|
|
26300
|
+
export interface FBXConstraintBehaviorTarget {
|
|
26301
|
+
/** Target node */
|
|
26302
|
+
node: TransformNode;
|
|
26303
|
+
/** Normalized target weight (0..1) */
|
|
26304
|
+
weight: number;
|
|
26305
|
+
/** Offset matrix for parent constraints (in the target's space) */
|
|
26306
|
+
offset: Matrix;
|
|
26307
|
+
}
|
|
26308
|
+
/** Options resolved by the loader when creating the behavior. */
|
|
26309
|
+
export interface FBXConstraintBehaviorOptions {
|
|
26310
|
+
/** Root of the loaded asset; world matrices are made relative to it */
|
|
26311
|
+
root: TransformNode;
|
|
26312
|
+
/** Resolved targets of the constraint, in file order */
|
|
26313
|
+
targets: FBXConstraintBehaviorTarget[];
|
|
26314
|
+
/** World up object of an aim constraint, when it has one */
|
|
26315
|
+
upNode: Nullable<TransformNode>;
|
|
26316
|
+
/** Scene up axis in FBX space */
|
|
26317
|
+
sceneUp: Vector3;
|
|
26318
|
+
}
|
|
26319
|
+
/**
|
|
26320
|
+
* Solves every FBX constraint of a scene once per frame, in dependency order, from the scene's animation phase
|
|
26321
|
+
* observers (`beginFrame` before animations, `solve` after them). Created on demand by the first
|
|
26322
|
+
* `FBXConstraintBehavior` attached in the scene and removed with the last one.
|
|
26323
|
+
*/
|
|
26324
|
+
export class FBXConstraintSolver {
|
|
26325
|
+
private readonly _scene;
|
|
26326
|
+
private readonly _behaviors;
|
|
26327
|
+
private _ordered;
|
|
26328
|
+
private _cyclic;
|
|
26329
|
+
private _dirty;
|
|
26330
|
+
private _beforeAnimations;
|
|
26331
|
+
private _afterAnimations;
|
|
26332
|
+
private constructor();
|
|
26333
|
+
/**
|
|
26334
|
+
* Solver of a scene, if any constraint behavior is attached in it.
|
|
26335
|
+
* @param scene - Scene to look up
|
|
26336
|
+
* @returns The solver, or undefined
|
|
26337
|
+
*/
|
|
26338
|
+
static Get(scene: Scene): FBXConstraintSolver | undefined;
|
|
26339
|
+
/**
|
|
26340
|
+
* Solver of a scene, created when missing.
|
|
26341
|
+
* @param scene - Scene to look up
|
|
26342
|
+
* @returns The solver
|
|
26343
|
+
*/
|
|
26344
|
+
static GetOrCreate(scene: Scene): FBXConstraintSolver;
|
|
26345
|
+
/** Registered behaviors in solve order (a target's constraint before the constraints that read it). */
|
|
26346
|
+
get constraints(): readonly FBXConstraintBehavior[];
|
|
26347
|
+
/**
|
|
26348
|
+
* Behaviors that take part in a dependency cycle (A targets B while B targets A). They are solved after all
|
|
26349
|
+
* acyclic constraints, in registration order, so each sees the other's result from the previous solve.
|
|
26350
|
+
*/
|
|
26351
|
+
get cyclicConstraints(): readonly FBXConstraintBehavior[];
|
|
26352
|
+
/**
|
|
26353
|
+
* Adds a behavior to the solve set.
|
|
26354
|
+
* @param behavior - Behavior to add
|
|
26355
|
+
*/
|
|
26356
|
+
register(behavior: FBXConstraintBehavior): void;
|
|
26357
|
+
/**
|
|
26358
|
+
* Removes a behavior from the solve set; the solver disposes itself with the last one.
|
|
26359
|
+
* @param behavior - Behavior to remove
|
|
26360
|
+
*/
|
|
26361
|
+
unregister(behavior: FBXConstraintBehavior): void;
|
|
26362
|
+
/** Marks the solve order stale, e.g. after re-parenting a constrained node. */
|
|
26363
|
+
invalidateOrder(): void;
|
|
26364
|
+
/**
|
|
26365
|
+
* Start of a frame, before animations run: every constrained node gets its unconstrained transform back, so
|
|
26366
|
+
* that animation either overwrites it or leaves it untouched.
|
|
26367
|
+
*/
|
|
26368
|
+
beginFrame(): void;
|
|
26369
|
+
/**
|
|
26370
|
+
* End of the animation phase: takes every constrained node's current transform as its unconstrained value,
|
|
26371
|
+
* then solves every registered constraint once, in dependency order.
|
|
26372
|
+
*/
|
|
26373
|
+
solve(): void;
|
|
26374
|
+
private _ensureOrder;
|
|
26375
|
+
private static _IsAncestorOrSelf;
|
|
26376
|
+
}
|
|
26377
|
+
/** Babylon behavior evaluating an FBX aim, parent, position, rotation or scale constraint. */
|
|
26378
|
+
export class FBXConstraintBehavior implements Behavior<TransformNode> {
|
|
26379
|
+
/** Constraint data extracted from the file */
|
|
26380
|
+
readonly constraint: FBXConstraintData;
|
|
26381
|
+
private readonly _options;
|
|
26382
|
+
/** Behavior name (`fbxConstraint:` followed by the constraint name) */
|
|
26383
|
+
readonly name: string;
|
|
26384
|
+
/** Node the behavior is attached to */
|
|
26385
|
+
attachedNode: Nullable<TransformNode>;
|
|
26386
|
+
/** Set to false to pause the constraint without detaching it */
|
|
26387
|
+
enabled: boolean;
|
|
26388
|
+
private readonly _offsetTranslation;
|
|
26389
|
+
private readonly _offsetRotation;
|
|
26390
|
+
private readonly _offsetScale;
|
|
26391
|
+
private readonly _localBasisTransposed;
|
|
26392
|
+
/** Unconstrained transform of the current frame (what animation produced), blended towards the constraint's result. */
|
|
26393
|
+
private readonly _base;
|
|
26394
|
+
private _hasBase;
|
|
26395
|
+
/**
|
|
26396
|
+
* Creates the behavior.
|
|
26397
|
+
* @param constraint - Constraint data extracted from the file
|
|
26398
|
+
* @param _options - Resolved targets and scene information
|
|
26399
|
+
*/
|
|
26400
|
+
constructor(
|
|
26401
|
+
/** Constraint data extracted from the file */
|
|
26402
|
+
constraint: FBXConstraintData, _options: FBXConstraintBehaviorOptions);
|
|
26403
|
+
/** Nothing to initialize */
|
|
26404
|
+
init(): void;
|
|
26405
|
+
/**
|
|
26406
|
+
* Registers the behavior with the scene's solver, takes the node's current transform as the unconstrained
|
|
26407
|
+
* value and solves the constraint once.
|
|
26408
|
+
* @param target - Node to constrain
|
|
26409
|
+
*/
|
|
26410
|
+
attach(target: TransformNode): void;
|
|
26411
|
+
/** Unregisters the behavior; the node keeps its last solved transform. */
|
|
26412
|
+
detach(): void;
|
|
26413
|
+
/**
|
|
26414
|
+
* Takes the node's current transform as the unconstrained value the next solve blends from. The solver calls
|
|
26415
|
+
* this after the scene's animations ran; call it yourself after writing a transform by hand.
|
|
26416
|
+
*/
|
|
26417
|
+
captureBase(): void;
|
|
26418
|
+
/**
|
|
26419
|
+
* Writes the unconstrained transform back to the node. The solver calls this before the scene's animations
|
|
26420
|
+
* run, so a node nothing animates keeps its unconstrained value between frames instead of the solved one.
|
|
26421
|
+
*/
|
|
26422
|
+
restoreBase(): void;
|
|
26423
|
+
/**
|
|
26424
|
+
* Nodes whose world transform the solve reads: the targets, the up node and the constrained node's parent.
|
|
26425
|
+
* @returns The nodes, used by the solver to order constraints
|
|
26426
|
+
*/
|
|
26427
|
+
dependencyNodes(): Nullable<Node>[];
|
|
26428
|
+
/**
|
|
26429
|
+
* Solves the constraint from the captured unconstrained transform and writes the node's local transform.
|
|
26430
|
+
* Blends are relative to the value captured by `captureBase`, not to whatever the node holds now.
|
|
26431
|
+
*/
|
|
26432
|
+
evaluate(): void;
|
|
26433
|
+
/**
|
|
26434
|
+
* World matrix of a node relative to the asset root (FBX space).
|
|
26435
|
+
* @param node - node to evaluate
|
|
26436
|
+
* @param out - matrix receiving the result
|
|
26437
|
+
* @returns `out`
|
|
26438
|
+
*/
|
|
26439
|
+
private _fbxWorld;
|
|
26440
|
+
/**
|
|
26441
|
+
* Weighted blend of the targets' world transforms (relative to the root).
|
|
26442
|
+
* @param position - Receives the blended translation
|
|
26443
|
+
* @param rotation - Receives the blended rotation
|
|
26444
|
+
* @param scale - Receives the blended scale
|
|
26445
|
+
* @returns The total target weight, 0 when no target contributes
|
|
26446
|
+
*/
|
|
26447
|
+
private _blendTargets;
|
|
26448
|
+
private _applyWeighted;
|
|
26449
|
+
private _applyRotation;
|
|
26450
|
+
private _writePosition;
|
|
26451
|
+
private _writeScaling;
|
|
26452
|
+
private _solvePosition;
|
|
26453
|
+
private _solveRotation;
|
|
26454
|
+
private _solveScale;
|
|
26455
|
+
private _solveParent;
|
|
26456
|
+
private _solveAim;
|
|
26457
|
+
/**
|
|
26458
|
+
* Builds a rotation matrix whose rows are `first`, `second` made orthogonal to it, and their cross product.
|
|
26459
|
+
* @param first - primary axis
|
|
26460
|
+
* @param second - secondary axis
|
|
26461
|
+
* @param out - matrix receiving the basis
|
|
26462
|
+
* @returns false when the axes are parallel or degenerate (`out` is then unchanged)
|
|
26463
|
+
*/
|
|
26464
|
+
private static _OrthonormalBasisToRef;
|
|
26465
|
+
}
|
|
26466
|
+
|
|
26467
|
+
|
|
25168
26468
|
/**
|
|
25169
26469
|
* Intermediate representation for parsed FBX data.
|
|
25170
26470
|
* Both binary and ASCII parsers produce this same structure.
|
|
@@ -25179,6 +26479,11 @@ declare namespace BABYLON {
|
|
|
25179
26479
|
type: FBXPropertyType;
|
|
25180
26480
|
/** Parsed property value. */
|
|
25181
26481
|
value: FBXPropertyValue;
|
|
26482
|
+
/**
|
|
26483
|
+
* Exact decimal text of an int64 whose magnitude exceeds 2^53; `value` then holds the rounded double. Object
|
|
26484
|
+
* ids are the only int64 values where the last bits matter, and `resolveConnections` keys them by this text.
|
|
26485
|
+
*/
|
|
26486
|
+
raw?: string;
|
|
25182
26487
|
}
|
|
25183
26488
|
/** A node in the FBX document tree */
|
|
25184
26489
|
export interface FBXNode {
|
|
@@ -25205,11 +26510,22 @@ declare namespace BABYLON {
|
|
|
25205
26510
|
/** Extract a property value by index, with type narrowing */
|
|
25206
26511
|
export function getPropertyValue<T extends FBXPropertyValue>(node: FBXNode, index: number): T | undefined;
|
|
25207
26512
|
/**
|
|
25208
|
-
*
|
|
26513
|
+
* Validates an FBX object ID value: IDs are 64-bit integers, so anything non-numeric, non-finite or fractional is
|
|
26514
|
+
* rejected. IDs beyond 2^53 are carried losslessly through the property's `raw` text by `resolveConnections`.
|
|
25209
26515
|
* @param value - Parsed FBX object ID value
|
|
25210
|
-
* @returns The object ID, or undefined when the value
|
|
26516
|
+
* @returns The object ID, or undefined when the value cannot be an ID
|
|
25211
26517
|
*/
|
|
25212
26518
|
export function getSafeFBXObjectId(value: unknown): number | undefined;
|
|
26519
|
+
/** Typed array payload types produced by the parsers. */
|
|
26520
|
+
export type FBXArrayValue = Float32Array | Float64Array | Int32Array | Uint8Array;
|
|
26521
|
+
/**
|
|
26522
|
+
* Returns the array payload of a node.
|
|
26523
|
+
* 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
|
|
26524
|
+
* scalar properties, and a one-element array degenerates to a single scalar. All of these are coalesced here.
|
|
26525
|
+
* @param node - Node whose properties hold the array
|
|
26526
|
+
* @returns The array, or null when the node has no numeric payload
|
|
26527
|
+
*/
|
|
26528
|
+
export function getNodeArray(node: FBXNode | undefined | null): FBXArrayValue | null;
|
|
25213
26529
|
/** Get the numeric ID from a node (first property is typically the int64 UID) */
|
|
25214
26530
|
export function getNodeId(node: FBXNode): number | undefined;
|
|
25215
26531
|
/**
|
|
@@ -25337,25 +26653,9 @@ declare namespace BABYLON {
|
|
|
25337
26653
|
/** Recoverable skinning/bind diagnostics */
|
|
25338
26654
|
diagnostics: FBXSkinDiagnostic[];
|
|
25339
26655
|
}
|
|
25340
|
-
|
|
25341
|
-
* Extract all skin deformers from the FBX scene.
|
|
25342
|
-
* Returns skin data including bone hierarchy and vertex weights.
|
|
25343
|
-
*/
|
|
25344
|
-
export function extractSkins(objectMap: FBXObjectMap): FBXSkinData[];
|
|
26656
|
+
export function extractSkins(objectMap: FBXObjectMap, propertyTemplates?: FBXPropertyTemplateMap): FBXSkinData[];
|
|
25345
26657
|
export function isSkeletonModel(modelNode: FBXNode): boolean;
|
|
25346
|
-
export function extractBoneTransform(modelNode: FBXNode):
|
|
25347
|
-
translation: [number, number, number];
|
|
25348
|
-
rotation: [number, number, number];
|
|
25349
|
-
preRotation: [number, number, number];
|
|
25350
|
-
postRotation: [number, number, number];
|
|
25351
|
-
rotationPivot: [number, number, number];
|
|
25352
|
-
scalingPivot: [number, number, number];
|
|
25353
|
-
rotationOffset: [number, number, number];
|
|
25354
|
-
scalingOffset: [number, number, number];
|
|
25355
|
-
scale: [number, number, number];
|
|
25356
|
-
rotationOrder: number;
|
|
25357
|
-
inheritType: number;
|
|
25358
|
-
};
|
|
26658
|
+
export function extractBoneTransform(modelNode: FBXNode, template?: FBXPropertyTemplate): FBXNodeTransformData;
|
|
25359
26659
|
|
|
25360
26660
|
|
|
25361
26661
|
export type FBXSceneDiagnosticType = "unsupported-constraint" | "unsupported-helper" | "unsupported-deformer" | "unsupported-node-attribute" | "unsupported-pose" | "unsupported-layered-texture" | "connection-graph";
|
|
@@ -25414,6 +26714,160 @@ declare namespace BABYLON {
|
|
|
25414
26714
|
export function resolveVector2Property(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string, fallback: [number, number]): [number, number];
|
|
25415
26715
|
export function resolveVector3Property(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string, fallback: [number, number, number]): [number, number, number];
|
|
25416
26716
|
export function resolvePropertyValues(node: FBXNode, template: FBXPropertyTemplate | undefined, propertyName: string): FBXPropertyValue[] | undefined;
|
|
26717
|
+
/** A property from a Properties70 ("P") or Properties60 ("Property") block. */
|
|
26718
|
+
export interface FBXPropertyEntry {
|
|
26719
|
+
name: string;
|
|
26720
|
+
type: string;
|
|
26721
|
+
flags: string;
|
|
26722
|
+
values: FBXPropertyValue[];
|
|
26723
|
+
}
|
|
26724
|
+
/**
|
|
26725
|
+
* Lists the properties declared directly on an object, from both the 7.x and 6.x property blocks.
|
|
26726
|
+
* @param node - Object node
|
|
26727
|
+
* @returns Property entries in declaration order (empty when the node has no property block)
|
|
26728
|
+
*/
|
|
26729
|
+
export function getPropertyEntries(node: FBXNode | undefined): FBXPropertyEntry[];
|
|
26730
|
+
/** Value of a user property: scalars as-is, vectors and colours as number arrays. */
|
|
26731
|
+
export type FBXUserPropertyValue = string | number | boolean | number[];
|
|
26732
|
+
/**
|
|
26733
|
+
* User-defined properties of an object: those flagged "U" (user) in the property flags. Every DCC exports custom
|
|
26734
|
+
* attributes this way (Maya extra attributes, 3ds Max user properties, Blender custom properties).
|
|
26735
|
+
* @param node - Object node
|
|
26736
|
+
* @returns Map of property name to value, or undefined when the object has none
|
|
26737
|
+
*/
|
|
26738
|
+
export function extractUserProperties(node: FBXNode): Record<string, FBXUserPropertyValue> | undefined;
|
|
26739
|
+
export function userPropertyValue(values: FBXPropertyValue[], typeName?: string): FBXUserPropertyValue | undefined;
|
|
26740
|
+
|
|
26741
|
+
|
|
26742
|
+
/**
|
|
26743
|
+
* NURBS curves and surfaces, and polyline ("Line") geometry.
|
|
26744
|
+
*
|
|
26745
|
+
* The basis evaluation and tessellation follow the FBX SDK conventions as implemented by ufbx: knot spans are
|
|
26746
|
+
* subdivided uniformly, closed and periodic curves wrap their control points, and surfaces are tessellated into
|
|
26747
|
+
* quads (degenerate quads at poles become triangles) with welded positions along the wrapped edges.
|
|
26748
|
+
*/
|
|
26749
|
+
export type FBXNurbsTopology = "open" | "closed" | "periodic";
|
|
26750
|
+
/** Knot vector and derived data of one parametric direction. */
|
|
26751
|
+
export interface FBXNurbsBasis {
|
|
26752
|
+
order: number;
|
|
26753
|
+
topology: FBXNurbsTopology;
|
|
26754
|
+
knots: Float64Array;
|
|
26755
|
+
/** Parameter range that the curve is defined on */
|
|
26756
|
+
tMin: number;
|
|
26757
|
+
tMax: number;
|
|
26758
|
+
/** Distinct knot values inside [tMin, tMax], i.e. the boundaries of the non-empty spans */
|
|
26759
|
+
spans: Float64Array;
|
|
26760
|
+
/** False when the knot vector is too short or not monotonic */
|
|
26761
|
+
valid: boolean;
|
|
26762
|
+
}
|
|
26763
|
+
/** NURBS curve: homogeneous control points (x, y, z, w) and a basis. */
|
|
26764
|
+
export interface FBXNurbsCurveData {
|
|
26765
|
+
basis: FBXNurbsBasis;
|
|
26766
|
+
/** Control points as x,y,z,w */
|
|
26767
|
+
controlPoints: Float64Array;
|
|
26768
|
+
numControlPoints: number;
|
|
26769
|
+
}
|
|
26770
|
+
/** NURBS surface: control points laid out as `v * numU + u`. */
|
|
26771
|
+
export interface FBXNurbsSurfaceData {
|
|
26772
|
+
basisU: FBXNurbsBasis;
|
|
26773
|
+
basisV: FBXNurbsBasis;
|
|
26774
|
+
numU: number;
|
|
26775
|
+
numV: number;
|
|
26776
|
+
/** Control points as x,y,z,w */
|
|
26777
|
+
controlPoints: Float64Array;
|
|
26778
|
+
flipNormals: boolean;
|
|
26779
|
+
/** Span subdivision stored in the file (Step), 0 when absent */
|
|
26780
|
+
stepU: number;
|
|
26781
|
+
stepV: number;
|
|
26782
|
+
}
|
|
26783
|
+
/** Polyline geometry ready for a lines mesh: one or more open or closed point runs. */
|
|
26784
|
+
export interface FBXCurveGeometryData {
|
|
26785
|
+
id: number;
|
|
26786
|
+
name: string;
|
|
26787
|
+
kind: "line" | "nurbsCurve";
|
|
26788
|
+
/** Each polyline as x,y,z triples; closed runs repeat their first point at the end */
|
|
26789
|
+
polylines: Float64Array[];
|
|
26790
|
+
/** Display colour from the geometry's Color property */
|
|
26791
|
+
color: [number, number, number] | null;
|
|
26792
|
+
diagnostics: FBXGeometryDiagnostic[];
|
|
26793
|
+
}
|
|
26794
|
+
export function createNurbsBasis(order: number, form: string | undefined, knots: Float64Array): FBXNurbsBasis;
|
|
26795
|
+
/**
|
|
26796
|
+
* Evaluates the basis functions (and their derivatives) that are non-zero at `u`.
|
|
26797
|
+
* @returns index of the first influencing control point, or -1 when the basis cannot be evaluated
|
|
26798
|
+
*/
|
|
26799
|
+
export function evaluateNurbsBasis(basis: FBXNurbsBasis, u: number, weights: Float64Array, derivatives: Float64Array | null): number;
|
|
26800
|
+
/** Evaluates a curve point; `out` receives position (0..2) and derivative (3..5). */
|
|
26801
|
+
export function evaluateNurbsCurve(curve: FBXNurbsCurveData, u: number, out: Float64Array, weights: Float64Array, derivs: Float64Array): boolean;
|
|
26802
|
+
/** Evaluates a surface point; `out` receives position (0..2), du (3..5) and dv (6..8). */
|
|
26803
|
+
export function evaluateNurbsSurface(surface: FBXNurbsSurfaceData, u: number, v: number, out: Float64Array, scratch: {
|
|
26804
|
+
wu: Float64Array;
|
|
26805
|
+
wv: Float64Array;
|
|
26806
|
+
du: Float64Array;
|
|
26807
|
+
dv: Float64Array;
|
|
26808
|
+
}): boolean;
|
|
26809
|
+
/**
|
|
26810
|
+
* Tessellates a curve into a polyline with `subdivision` segments per knot span. Closed and periodic curves
|
|
26811
|
+
* end on a copy of their first point.
|
|
26812
|
+
*/
|
|
26813
|
+
export function tessellateNurbsCurve(curve: FBXNurbsCurveData, subdivision?: number): Float64Array | null;
|
|
26814
|
+
/** Span subdivision to use for a surface direction: an explicit override, else the file's Step, else 4. */
|
|
26815
|
+
export function resolveSpanSubdivision(fileStep: number, override: number | undefined): number;
|
|
26816
|
+
/**
|
|
26817
|
+
* Tessellates a surface into triangles. Positions on wrapped (closed/periodic) edges and at poles are welded
|
|
26818
|
+
* exactly like the FBX SDK does, so degenerate quads collapse into triangles.
|
|
26819
|
+
*/
|
|
26820
|
+
export function tessellateNurbsSurface(surface: FBXNurbsSurfaceData, subU: number, subV: number): {
|
|
26821
|
+
positions: Float64Array;
|
|
26822
|
+
indices: Uint32Array;
|
|
26823
|
+
normals: Float64Array;
|
|
26824
|
+
uvs: Float64Array;
|
|
26825
|
+
} | null;
|
|
26826
|
+
/** Reads a NurbsCurve geometry node. */
|
|
26827
|
+
export function extractNurbsCurve(node: FBXNode): FBXNurbsCurveData | null;
|
|
26828
|
+
/** Reads a NurbsSurface geometry node. */
|
|
26829
|
+
export function extractNurbsSurface(node: FBXNode): FBXNurbsSurfaceData | null;
|
|
26830
|
+
/** Tessellates a NurbsSurface geometry node into mesh geometry. */
|
|
26831
|
+
export function nurbsSurfaceToGeometry(node: FBXNode, geometryId: number, subdivisionOverride: number | undefined): FBXGeometryData | null;
|
|
26832
|
+
/** Reads a NurbsCurve geometry node into a tessellated polyline. */
|
|
26833
|
+
export function extractNurbsCurveGeometry(node: FBXNode, geometryId: number, subdivision?: number): FBXCurveGeometryData;
|
|
26834
|
+
/**
|
|
26835
|
+
* Reads a Line geometry node: Points plus PointsIndex where a negative index (~index) ends a segment, as in
|
|
26836
|
+
* polygon vertex indices.
|
|
26837
|
+
*/
|
|
26838
|
+
export function extractLineGeometry(node: FBXNode, geometryId: number): FBXCurveGeometryData;
|
|
26839
|
+
|
|
26840
|
+
|
|
26841
|
+
/** Transform properties resolved from an FBX Model, with template defaults applied. */
|
|
26842
|
+
export interface FBXNodeTransformData {
|
|
26843
|
+
translation: [number, number, number];
|
|
26844
|
+
rotation: [number, number, number];
|
|
26845
|
+
scale: [number, number, number];
|
|
26846
|
+
preRotation: [number, number, number];
|
|
26847
|
+
postRotation: [number, number, number];
|
|
26848
|
+
rotationPivot: [number, number, number];
|
|
26849
|
+
scalingPivot: [number, number, number];
|
|
26850
|
+
rotationOffset: [number, number, number];
|
|
26851
|
+
scalingOffset: [number, number, number];
|
|
26852
|
+
geometricTranslation: [number, number, number];
|
|
26853
|
+
geometricRotation: [number, number, number];
|
|
26854
|
+
geometricScaling: [number, number, number];
|
|
26855
|
+
/** Rotation order: 0=XYZ, 1=XZY, 2=YZX, 3=YXZ, 4=ZXY, 5=ZYX, 6=SphericXYZ */
|
|
26856
|
+
rotationOrder: number;
|
|
26857
|
+
/** FBX transform inheritance mode. 0=RrSs, 1=RSrs, 2=Rrs */
|
|
26858
|
+
inheritType: number;
|
|
26859
|
+
/** Whether the rotation space (rotation order, pre/post rotation) is active for this node */
|
|
26860
|
+
rotationActive: boolean;
|
|
26861
|
+
diagnostics: string[];
|
|
26862
|
+
}
|
|
26863
|
+
/**
|
|
26864
|
+
* Resolves the transform properties of a Model node the way the FBX SDK evaluates them.
|
|
26865
|
+
*
|
|
26866
|
+
* `RotationActive` gates the whole rotation space: when it is false (the FbxNode template default), the SDK
|
|
26867
|
+
* composes `Lcl Rotation` in plain XYZ order and ignores `RotationOrder`, `PreRotation` and `PostRotation`.
|
|
26868
|
+
* `RotationSpaceForLimitOnly` restricts the rotation space to limits, which has the same effect for us.
|
|
26869
|
+
*/
|
|
26870
|
+
export function extractNodeTransform(modelNode: FBXNode, template?: FBXPropertyTemplate): FBXNodeTransformData;
|
|
25417
26871
|
|
|
25418
26872
|
|
|
25419
26873
|
/** Parsed material data */
|
|
@@ -25423,6 +26877,10 @@ declare namespace BABYLON {
|
|
|
25423
26877
|
type: "Lambert" | "Phong";
|
|
25424
26878
|
properties: FBXMaterialProperties;
|
|
25425
26879
|
textures: FBXTextureRef[];
|
|
26880
|
+
/** Unified classic + PBR parameter model resolved from whichever shader flavour the file uses */
|
|
26881
|
+
model: FBXMaterialModel<FBXTextureRef>;
|
|
26882
|
+
/** User-defined properties */
|
|
26883
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
25426
26884
|
}
|
|
25427
26885
|
export interface FBXMaterialProperties {
|
|
25428
26886
|
diffuseColor?: [number, number, number];
|
|
@@ -25458,11 +26916,102 @@ declare namespace BABYLON {
|
|
|
25458
26916
|
uvSetIndex?: number;
|
|
25459
26917
|
/** Which named UV set this texture uses */
|
|
25460
26918
|
uvSetName?: string;
|
|
26919
|
+
/** WrapModeU: 0 = repeat, 1 = clamp */
|
|
26920
|
+
wrapU?: number;
|
|
26921
|
+
/** WrapModeV: 0 = repeat, 1 = clamp */
|
|
26922
|
+
wrapV?: number;
|
|
26923
|
+
/** Set when the texture came from a LayeredTexture (only the first layer is used) */
|
|
26924
|
+
layeredTextureId?: number;
|
|
25461
26925
|
}
|
|
25462
26926
|
/**
|
|
25463
26927
|
* Extract material data from an FBX Material node.
|
|
25464
26928
|
*/
|
|
25465
26929
|
export function extractMaterial(materialNode: FBXNode, materialId: number, objectMap: FBXObjectMap, templates?: FBXPropertyTemplateMap): FBXMaterialData;
|
|
26930
|
+
export function extractTextureRef(id: number, node: FBXNode, propertyName: string | undefined, objectMap: FBXObjectMap, template?: FBXPropertyTemplate): FBXTextureRef;
|
|
26931
|
+
|
|
26932
|
+
|
|
26933
|
+
/**
|
|
26934
|
+
* Unified material model.
|
|
26935
|
+
*
|
|
26936
|
+
* FBX materials come in many vendor flavours: the classic FbxSurfaceLambert / FbxSurfacePhong, Autodesk Standard
|
|
26937
|
+
* Surface (OSL), Arnold aiStandardSurface, 3ds Max Physical Material, 3ds Max PBR (metal/rough and spec/gloss),
|
|
26938
|
+
* the 3ds Max glTF material, OpenPBR, and Maya's Stingray PBS ShaderFX graph. Each stores its parameters under
|
|
26939
|
+
* different property names, sometimes behind a shader binding table.
|
|
26940
|
+
*
|
|
26941
|
+
* This module resolves any of them into two parameter sets, mirroring how the FBX SDK / ufbx expose materials:
|
|
26942
|
+
* `fbx` (the classic Lambert/Phong parameters) and `pbr` (a physically based parameter set), plus feature flags.
|
|
26943
|
+
*/
|
|
26944
|
+
export type FBXShaderType = "unknown" | "fbxLambert" | "fbxPhong" | "oslStandardSurface" | "arnoldStandardSurface" | "3dsMaxPhysicalMaterial" | "3dsMaxPbrMetalRough" | "3dsMaxPbrSpecGloss" | "gltfMaterial" | "openPbrMaterial" | "shaderFxGraph";
|
|
26945
|
+
/** One resolved material parameter: a constant value and/or a texture. */
|
|
26946
|
+
export interface FBXMaterialMap<TTexture> {
|
|
26947
|
+
/** Constant value (r,g,b,a for colours, x for scalars) */
|
|
26948
|
+
value?: number[];
|
|
26949
|
+
/** Number of meaningful components in `value` (1 for scalars, 3 or 4 for colours) */
|
|
26950
|
+
valueComponents: number;
|
|
26951
|
+
/** Texture bound to the parameter */
|
|
26952
|
+
texture?: TTexture;
|
|
26953
|
+
/** Whether the texture is enabled (some vendors carry an explicit toggle) */
|
|
26954
|
+
textureEnabled: boolean;
|
|
26955
|
+
}
|
|
26956
|
+
export type FBXFbxMapName = "diffuseFactor" | "diffuseColor" | "specularFactor" | "specularColor" | "specularExponent" | "reflectionFactor" | "reflectionColor" | "transparencyFactor" | "transparencyColor" | "emissionFactor" | "emissionColor" | "ambientFactor" | "ambientColor" | "normalMap" | "bump" | "bumpFactor" | "displacement" | "displacementFactor" | "vectorDisplacement" | "vectorDisplacementFactor";
|
|
26957
|
+
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";
|
|
26958
|
+
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";
|
|
26959
|
+
export interface FBXMaterialModel<TTexture> {
|
|
26960
|
+
shaderType: FBXShaderType;
|
|
26961
|
+
/** Prefix material property names carry for this shader (e.g. "3dsMax|Parameters|") */
|
|
26962
|
+
shaderPropPrefix: string;
|
|
26963
|
+
fbx: Partial<Record<FBXFbxMapName, FBXMaterialMap<TTexture>>>;
|
|
26964
|
+
pbr: Partial<Record<FBXPbrMapName, FBXMaterialMap<TTexture>>>;
|
|
26965
|
+
features: Partial<Record<FBXMaterialFeatureName, {
|
|
26966
|
+
enabled: boolean;
|
|
26967
|
+
explicit: boolean;
|
|
26968
|
+
}>>;
|
|
26969
|
+
}
|
|
26970
|
+
/** Inputs needed to resolve a material, independent of the parse representation. */
|
|
26971
|
+
export interface FBXMaterialSource<TTexture> {
|
|
26972
|
+
/** "lambert", "phong", "unknown", ... as written in the file */
|
|
26973
|
+
shadingModelName: string;
|
|
26974
|
+
/** Property values by full property name (e.g. "DiffuseColor", "Maya|baseColor", "3dsMax|Parameters|roughness") */
|
|
26975
|
+
props: Map<string, {
|
|
26976
|
+
type: string;
|
|
26977
|
+
values: FBXPropertyValue[];
|
|
26978
|
+
}>;
|
|
26979
|
+
/** Textures connected to the material by property name (OP connection property) */
|
|
26980
|
+
texturesByProp: Map<string, TTexture>;
|
|
26981
|
+
/** Connected shader implementation, when any */
|
|
26982
|
+
shader?: {
|
|
26983
|
+
renderApi: string;
|
|
26984
|
+
/** shader semantic name -> material property names */
|
|
26985
|
+
bindings: Map<string, string[]>;
|
|
26986
|
+
};
|
|
26987
|
+
}
|
|
26988
|
+
/** Shader types whose parameters are physically based; the loader emits PBR materials for them by default. */
|
|
26989
|
+
export function isPbrShaderType(type: FBXShaderType): boolean;
|
|
26990
|
+
/** Detects the shader flavour of a material from its shading model name, connected shader and 3ds Max class ids. */
|
|
26991
|
+
export function detectShaderType<T>(source: FBXMaterialSource<T>): {
|
|
26992
|
+
shaderType: FBXShaderType;
|
|
26993
|
+
shaderPropPrefix: string;
|
|
26994
|
+
};
|
|
26995
|
+
/**
|
|
26996
|
+
* Resolves the unified material model from raw material data.
|
|
26997
|
+
*/
|
|
26998
|
+
export function resolveMaterialModel<T>(source: FBXMaterialSource<T>): FBXMaterialModel<T>;
|
|
26999
|
+
/** Colour (first three components) of a map, or undefined. */
|
|
27000
|
+
export function mapColor<T>(map: FBXMaterialMap<T> | undefined): [number, number, number] | undefined;
|
|
27001
|
+
/** Scalar (first component) of a map, or undefined. */
|
|
27002
|
+
export function mapScalar<T>(map: FBXMaterialMap<T> | undefined): number | undefined;
|
|
27003
|
+
|
|
27004
|
+
|
|
27005
|
+
/**
|
|
27006
|
+
* FBX 5.x (and older) documents store everything at the top level: one `Model` node per object with inline
|
|
27007
|
+
* geometry, materials, skin links, lights and cameras, and `Children` lists instead of connections. This module
|
|
27008
|
+
* rewrites such a document into the 6.x layout (`Objects`, `Connections`, `Takes`) so the rest of the importer
|
|
27009
|
+
* can treat both the same way. The rules follow the FBX SDK's legacy reader as implemented by ufbx.
|
|
27010
|
+
*/
|
|
27011
|
+
/** True for pre-6000 files: no `Objects` section but top-level `Model` nodes. */
|
|
27012
|
+
export function isLegacyDocument(doc: FBXDocument): boolean;
|
|
27013
|
+
/** Rewrites a legacy document into the 6.x object/connection layout. */
|
|
27014
|
+
export function upgradeLegacyDocument(doc: FBXDocument): FBXDocument;
|
|
25466
27015
|
|
|
25467
27016
|
|
|
25468
27017
|
/** A named UV set */
|
|
@@ -25475,7 +27024,7 @@ declare namespace BABYLON {
|
|
|
25475
27024
|
/** Recoverable geometry import issue. */
|
|
25476
27025
|
export interface FBXGeometryDiagnostic {
|
|
25477
27026
|
/** Diagnostic category. */
|
|
25478
|
-
type: "degenerate-polygon" | "triangulation-fallback" | "layer-index-out-of-bounds" | "layer-data-too-short";
|
|
27027
|
+
type: "degenerate-polygon" | "triangulation-fallback" | "layer-index-out-of-bounds" | "layer-data-too-short" | "nurbs-invalid" | "nurbs-trim-ignored" | "nurbs-deformer-ignored";
|
|
25479
27028
|
/** Human-readable diagnostic message. */
|
|
25480
27029
|
message: string;
|
|
25481
27030
|
/** Polygon index associated with the diagnostic, if applicable. */
|
|
@@ -25526,8 +27075,10 @@ declare namespace BABYLON {
|
|
|
25526
27075
|
id: number;
|
|
25527
27076
|
name: string;
|
|
25528
27077
|
subType: string;
|
|
25529
|
-
/** Geometry attached to this model (
|
|
27078
|
+
/** Geometry attached to this model (meshes and tessellated NURBS surfaces) */
|
|
25530
27079
|
geometry?: FBXGeometryData;
|
|
27080
|
+
/** Curve geometry attached to this model (Line and NurbsCurve) */
|
|
27081
|
+
curve?: FBXCurveGeometryData;
|
|
25531
27082
|
/** Materials assigned to this model */
|
|
25532
27083
|
materials: FBXMaterialData[];
|
|
25533
27084
|
/** Child models */
|
|
@@ -25559,18 +27110,68 @@ declare namespace BABYLON {
|
|
|
25559
27110
|
/** Whether backface culling is disabled ("CullingOff") */
|
|
25560
27111
|
cullingOff: boolean;
|
|
25561
27112
|
/** User-defined custom properties from Properties70 */
|
|
25562
|
-
customProperties?: Record<string,
|
|
27113
|
+
customProperties?: Record<string, FBXUserPropertyValue>;
|
|
27114
|
+
/** LOD group settings when this model is a LodGroup; children are the levels in order */
|
|
27115
|
+
lodGroup?: FBXLodGroupData;
|
|
27116
|
+
/** Display layer (CollectionExclusive) the model belongs to */
|
|
27117
|
+
displayLayer?: FBXDisplayLayerData;
|
|
25563
27118
|
/** Recoverable model import diagnostics */
|
|
25564
27119
|
diagnostics: string[];
|
|
25565
27120
|
}
|
|
27121
|
+
/** LOD group settings (NodeAttribute "LodGroup") */
|
|
27122
|
+
export interface FBXLodGroupData {
|
|
27123
|
+
/** Switch distance for level i+1 (level 0 has none). In scene units, or percent of screen when `relative`. */
|
|
27124
|
+
thresholds: number[];
|
|
27125
|
+
/** ThresholdsUsedAsPercentage */
|
|
27126
|
+
relative: boolean;
|
|
27127
|
+
/** DisplayLevels|LevelN: 0 use LOD, 1 show, 2 hide */
|
|
27128
|
+
displayLevels: number[];
|
|
27129
|
+
}
|
|
27130
|
+
/** Display layer (CollectionExclusive "DisplayLayer") */
|
|
27131
|
+
export interface FBXDisplayLayerData {
|
|
27132
|
+
id: number;
|
|
27133
|
+
name: string;
|
|
27134
|
+
show: boolean;
|
|
27135
|
+
freeze: boolean;
|
|
27136
|
+
color: [number, number, number];
|
|
27137
|
+
modelIds: number[];
|
|
27138
|
+
}
|
|
27139
|
+
/** One member of a selection set: a model, optionally with a component selection on its mesh */
|
|
27140
|
+
export interface FBXSelectionNodeData {
|
|
27141
|
+
modelId: number;
|
|
27142
|
+
/** IsTheNodeInSet: the whole node is selected (as opposed to only components) */
|
|
27143
|
+
includeNode: boolean;
|
|
27144
|
+
/** Selected control point indices (VertexIndexArray) */
|
|
27145
|
+
vertices?: number[];
|
|
27146
|
+
/** Selected edge indices (EdgeIndexArray) */
|
|
27147
|
+
edges?: number[];
|
|
27148
|
+
/** Selected polygon indices (PolygonIndexArray) */
|
|
27149
|
+
faces?: number[];
|
|
27150
|
+
}
|
|
27151
|
+
/** Selection set (Collection "SelectionSet") */
|
|
27152
|
+
export interface FBXSelectionSetData {
|
|
27153
|
+
id: number;
|
|
27154
|
+
name: string;
|
|
27155
|
+
members: FBXSelectionNodeData[];
|
|
27156
|
+
}
|
|
25566
27157
|
/** Camera data extracted from FBX */
|
|
25567
27158
|
export interface FBXCameraData {
|
|
25568
27159
|
/** Model ID this camera is attached to */
|
|
25569
27160
|
modelId: number;
|
|
27161
|
+
/** NodeAttribute object ID (animation curves target this) */
|
|
27162
|
+
attributeId: number;
|
|
25570
27163
|
/** Camera name */
|
|
25571
27164
|
name: string;
|
|
25572
|
-
/**
|
|
27165
|
+
/** Vertical field of view in degrees */
|
|
25573
27166
|
fieldOfView: number;
|
|
27167
|
+
/** Horizontal field of view in degrees */
|
|
27168
|
+
fieldOfViewX: number;
|
|
27169
|
+
/** ApertureMode: 0 horizontal and vertical, 1 horizontal, 2 vertical, 3 focal length */
|
|
27170
|
+
apertureMode: number;
|
|
27171
|
+
/** Aperture (film gate after gate fit) size in inches */
|
|
27172
|
+
apertureSizeInch: [number, number];
|
|
27173
|
+
/** Orthographic view size (width, height) in scene units */
|
|
27174
|
+
orthographicSize: [number, number];
|
|
25574
27175
|
/** Near clip plane */
|
|
25575
27176
|
nearPlane: number;
|
|
25576
27177
|
/** Far clip plane */
|
|
@@ -25589,6 +27190,8 @@ declare namespace BABYLON {
|
|
|
25589
27190
|
orthoZoom?: number;
|
|
25590
27191
|
/** Camera roll in degrees when present */
|
|
25591
27192
|
roll?: number;
|
|
27193
|
+
/** User-defined properties on the camera attribute */
|
|
27194
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
25592
27195
|
/** Known unsupported or unrecognized camera properties */
|
|
25593
27196
|
unknownProperties: string[];
|
|
25594
27197
|
/** Recoverable camera import diagnostics */
|
|
@@ -25598,6 +27201,8 @@ declare namespace BABYLON {
|
|
|
25598
27201
|
export interface FBXLightData {
|
|
25599
27202
|
/** Model ID this light is attached to */
|
|
25600
27203
|
modelId: number;
|
|
27204
|
+
/** NodeAttribute object ID (animation curves target this) */
|
|
27205
|
+
attributeId: number;
|
|
25601
27206
|
/** Light name */
|
|
25602
27207
|
name: string;
|
|
25603
27208
|
/** Light type: 0=Point, 1=Directional, 2=Spot */
|
|
@@ -25622,6 +27227,15 @@ declare namespace BABYLON {
|
|
|
25622
27227
|
enableFarAttenuation?: boolean;
|
|
25623
27228
|
/** Whether the source light requested shadow casting */
|
|
25624
27229
|
castShadows?: boolean;
|
|
27230
|
+
/** Near/far attenuation ranges in scene units (when enabled) */
|
|
27231
|
+
nearAttenuationStart?: number;
|
|
27232
|
+
nearAttenuationEnd?: number;
|
|
27233
|
+
farAttenuationStart?: number;
|
|
27234
|
+
farAttenuationEnd?: number;
|
|
27235
|
+
/** Area light shape: 0 rectangle, 1 sphere */
|
|
27236
|
+
areaLightShape?: number;
|
|
27237
|
+
/** User-defined properties on the light attribute */
|
|
27238
|
+
userProperties?: Record<string, FBXUserPropertyValue>;
|
|
25625
27239
|
/** Known unsupported or unrecognized light properties */
|
|
25626
27240
|
unknownProperties: string[];
|
|
25627
27241
|
/** Recoverable light import diagnostics */
|
|
@@ -25633,6 +27247,8 @@ declare namespace BABYLON {
|
|
|
25633
27247
|
rootModels: FBXModelData[];
|
|
25634
27248
|
/** All geometries in the scene */
|
|
25635
27249
|
geometries: FBXGeometryData[];
|
|
27250
|
+
/** All curve geometries (lines and tessellated NURBS curves) */
|
|
27251
|
+
curves: FBXCurveGeometryData[];
|
|
25636
27252
|
/** All materials in the scene */
|
|
25637
27253
|
materials: FBXMaterialData[];
|
|
25638
27254
|
/** Skin deformers (skeletons + vertex weights) */
|
|
@@ -25649,6 +27265,12 @@ declare namespace BABYLON {
|
|
|
25649
27265
|
lights: FBXLightData[];
|
|
25650
27266
|
/** Scene-level unsupported feature diagnostics */
|
|
25651
27267
|
diagnostics: FBXSceneDiagnostic[];
|
|
27268
|
+
/** Constraints (aim, parent, position, rotation, scale, IK) */
|
|
27269
|
+
constraints: FBXConstraintData[];
|
|
27270
|
+
/** Display layers */
|
|
27271
|
+
displayLayers: FBXDisplayLayerData[];
|
|
27272
|
+
/** Selection sets */
|
|
27273
|
+
selectionSets: FBXSelectionSetData[];
|
|
25652
27274
|
/** Global settings */
|
|
25653
27275
|
upAxis: number;
|
|
25654
27276
|
upAxisSign: number;
|
|
@@ -25657,11 +27279,89 @@ declare namespace BABYLON {
|
|
|
25657
27279
|
coordAxis: number;
|
|
25658
27280
|
coordAxisSign: number;
|
|
25659
27281
|
unitScaleFactor: number;
|
|
27282
|
+
/** Scene frame rate derived from GlobalSettings TimeMode / CustomFrameRate */
|
|
27283
|
+
frameRate: number;
|
|
25660
27284
|
}
|
|
25661
27285
|
/**
|
|
25662
27286
|
* Interpret a parsed FBX document into scene data.
|
|
25663
27287
|
*/
|
|
25664
|
-
|
|
27288
|
+
/** Options controlling how the document is interpreted. */
|
|
27289
|
+
export interface FBXInterpretOptions {
|
|
27290
|
+
/** Segments per knot span when tessellating NURBS surfaces; defaults to the Step stored in the file */
|
|
27291
|
+
nurbsSubdivision?: number;
|
|
27292
|
+
/** Shift every clip so its first key sits at time 0 (default true); false keeps the authored times */
|
|
27293
|
+
rebaseKeyframes?: boolean;
|
|
27294
|
+
}
|
|
27295
|
+
export function interpretFBX(doc: FBXDocument, options?: FBXInterpretOptions): FBXSceneData;
|
|
27296
|
+
|
|
27297
|
+
|
|
27298
|
+
export type FBXConstraintType = "aim" | "parent" | "position" | "rotation" | "scale" | "singleChainIK" | "unknown";
|
|
27299
|
+
export type Vec3 = [number, number, number];
|
|
27300
|
+
export type Bool3 = [boolean, boolean, boolean];
|
|
27301
|
+
/** One weighted target of a constraint. */
|
|
27302
|
+
export interface FBXConstraintTarget {
|
|
27303
|
+
/** Model id of the target node */
|
|
27304
|
+
modelId: number;
|
|
27305
|
+
/** Normalized weight (file value / 100, or as-is for IK pole targets) */
|
|
27306
|
+
weight: number;
|
|
27307
|
+
/** Parent constraint translation offset expressed in the target's space */
|
|
27308
|
+
offsetTranslation: Vec3;
|
|
27309
|
+
/** Parent constraint rotation offset in degrees, expressed in the target's space */
|
|
27310
|
+
offsetRotation: Vec3;
|
|
27311
|
+
/** Parent constraint scale offset expressed in the target's space */
|
|
27312
|
+
offsetScale: Vec3;
|
|
27313
|
+
}
|
|
27314
|
+
/** A constraint object of the file, with its targets and parameters resolved. */
|
|
27315
|
+
export interface FBXConstraintData {
|
|
27316
|
+
/** Constraint object id */
|
|
27317
|
+
id: number;
|
|
27318
|
+
/** Constraint name */
|
|
27319
|
+
name: string;
|
|
27320
|
+
/** Resolved constraint kind */
|
|
27321
|
+
type: FBXConstraintType;
|
|
27322
|
+
/** Constraint type name as written in the file (e.g. "Parent-Child") */
|
|
27323
|
+
typeName: string;
|
|
27324
|
+
/** Constrained model */
|
|
27325
|
+
nodeId?: number;
|
|
27326
|
+
/** Weighted targets in file order */
|
|
27327
|
+
targets: FBXConstraintTarget[];
|
|
27328
|
+
/** Global weight (file value / 100) */
|
|
27329
|
+
weight: number;
|
|
27330
|
+
/** False when the constraint is switched off in the file */
|
|
27331
|
+
active: boolean;
|
|
27332
|
+
/** Which translation axes the constraint drives */
|
|
27333
|
+
affectTranslation: Bool3;
|
|
27334
|
+
/** Which rotation axes the constraint drives */
|
|
27335
|
+
affectRotation: Bool3;
|
|
27336
|
+
/** Which scale axes the constraint drives */
|
|
27337
|
+
affectScale: Bool3;
|
|
27338
|
+
/** Translation offset of the constrained node */
|
|
27339
|
+
offsetTranslation: Vec3;
|
|
27340
|
+
/** Rotation offset of the constrained node, in degrees */
|
|
27341
|
+
offsetRotation: Vec3;
|
|
27342
|
+
/** Scale offset of the constrained node */
|
|
27343
|
+
offsetScale: Vec3;
|
|
27344
|
+
/** Aim: local axis that points at the target */
|
|
27345
|
+
aimVector: Vec3;
|
|
27346
|
+
/** Aim: local axis aligned with the up direction */
|
|
27347
|
+
upVector: Vec3;
|
|
27348
|
+
/** Aim: world up direction (world up modes 2 and 3) */
|
|
27349
|
+
worldUpVector: Vec3;
|
|
27350
|
+
/** Aim: 0 scene up, 1 aim up node, 2 align to node, 3 vector, 4 none */
|
|
27351
|
+
worldUpType: number;
|
|
27352
|
+
/** Aim: model id of the world up object (world up modes 1 and 2) */
|
|
27353
|
+
worldUpNodeId?: number;
|
|
27354
|
+
/** Single chain IK: model id of the first joint of the chain */
|
|
27355
|
+
ikFirstJointId?: number;
|
|
27356
|
+
/** Single chain IK: model id of the last joint of the chain */
|
|
27357
|
+
ikEndJointId?: number;
|
|
27358
|
+
/** Single chain IK: model id of the effector */
|
|
27359
|
+
ikEffectorId?: number;
|
|
27360
|
+
/** Single chain IK: pole vector */
|
|
27361
|
+
ikPoleVector: Vec3;
|
|
27362
|
+
}
|
|
27363
|
+
/** Reads every constraint object of the scene. */
|
|
27364
|
+
export function extractConstraints(objectMap: FBXObjectMap): FBXConstraintData[];
|
|
25665
27365
|
|
|
25666
27366
|
|
|
25667
27367
|
/** Connection type: OO = object-to-object, OP = object-to-property */
|
|
@@ -25684,7 +27384,7 @@ declare namespace BABYLON {
|
|
|
25684
27384
|
/** Object node. */
|
|
25685
27385
|
node: FBXNode;
|
|
25686
27386
|
/** Source of the object entry. */
|
|
25687
|
-
source: "Objects" | "legacySyntheticGeometry";
|
|
27387
|
+
source: "Objects" | "legacySyntheticGeometry" | "legacySyntheticAttribute" | "legacySyntheticBlendShape";
|
|
25688
27388
|
/** Legacy string object name, when applicable. */
|
|
25689
27389
|
legacyName?: string;
|
|
25690
27390
|
/** True if the object was synthesized for legacy compatibility. */
|
|
@@ -25805,7 +27505,23 @@ declare namespace BABYLON {
|
|
|
25805
27505
|
export function extractBlendShapes(objectMap: FBXObjectMap): FBXBlendShapeData[];
|
|
25806
27506
|
|
|
25807
27507
|
|
|
27508
|
+
/**
|
|
27509
|
+
* FBX animation curve model and evaluator.
|
|
27510
|
+
*
|
|
27511
|
+
* Keys carry cubic Bezier tangents expressed the way the FBX SDK stores them: a left and right tangent with a time
|
|
27512
|
+
* extent (dx, as a fraction of the segment scaled by the tangent weight) and a value extent (dy). Linear and constant
|
|
27513
|
+
* segments are represented the same way so that a single evaluator handles every case, including the weighted
|
|
27514
|
+
* tangents Maya and MotionBuilder write, TCB keys, and the pre/post extrapolation modes.
|
|
27515
|
+
*/
|
|
27516
|
+
/** FBX time units: 46186158000 ticks per second */
|
|
27517
|
+
export const FBX_TIME_UNIT = 46186158000;
|
|
25808
27518
|
export type FBXInterpolationType = "constant" | "linear" | "cubic";
|
|
27519
|
+
export type FBXExtrapolationMode = "constant" | "repeat" | "mirror" | "slope" | "repeatRelative";
|
|
27520
|
+
export interface FBXExtrapolation {
|
|
27521
|
+
mode: FBXExtrapolationMode;
|
|
27522
|
+
/** Number of repetitions, or -1 for infinite */
|
|
27523
|
+
repeatCount: number;
|
|
27524
|
+
}
|
|
25809
27525
|
/** A single keyframe */
|
|
25810
27526
|
export interface FBXKeyframe {
|
|
25811
27527
|
/** Time in seconds */
|
|
@@ -25816,9 +27532,15 @@ declare namespace BABYLON {
|
|
|
25816
27532
|
interpolation: FBXInterpolationType;
|
|
25817
27533
|
/** Constant interpolation variant */
|
|
25818
27534
|
constantMode?: "standard" | "next";
|
|
25819
|
-
/**
|
|
27535
|
+
/** Left (incoming) tangent: time extent in seconds and value extent */
|
|
27536
|
+
leftDx: number;
|
|
27537
|
+
leftDy: number;
|
|
27538
|
+
/** Right (outgoing) tangent: time extent in seconds and value extent */
|
|
27539
|
+
rightDx: number;
|
|
27540
|
+
rightDy: number;
|
|
27541
|
+
/** Cubic outgoing slope in value units per second (derived, kept for consumers that export hermite keys) */
|
|
25820
27542
|
rightSlope?: number;
|
|
25821
|
-
/** Cubic incoming slope for the next key, in value units per second */
|
|
27543
|
+
/** Cubic incoming slope for the next key, in value units per second (derived) */
|
|
25822
27544
|
nextLeftSlope?: number;
|
|
25823
27545
|
}
|
|
25824
27546
|
/** An animation curve (one axis of one property) */
|
|
@@ -25829,7 +27551,53 @@ declare namespace BABYLON {
|
|
|
25829
27551
|
keys: FBXKeyframe[];
|
|
25830
27552
|
/** True for baked sample curves that should be connected as linear samples */
|
|
25831
27553
|
isSampled?: boolean;
|
|
27554
|
+
preExtrapolation?: FBXExtrapolation;
|
|
27555
|
+
postExtrapolation?: FBXExtrapolation;
|
|
27556
|
+
}
|
|
27557
|
+
/** Raw key attribute data for one key, after run-length decoding. */
|
|
27558
|
+
export interface FBXKeyAttributes {
|
|
27559
|
+
flags: number;
|
|
27560
|
+
data: [number, number, number, number];
|
|
27561
|
+
}
|
|
27562
|
+
/**
|
|
27563
|
+
* Builds keyframes from parallel time/value arrays and their (run-length encoded) attributes, resolving every
|
|
27564
|
+
* tangent mode the FBX SDK writes: user, broken, auto (with clamp / progressive clamp / time-independent flags and
|
|
27565
|
+
* auto bias), TCB, weighted, linear and constant.
|
|
27566
|
+
*/
|
|
27567
|
+
export function buildKeyframes(times: ArrayLike<number>, values: ArrayLike<number>, attributes: (index: number) => FBXKeyAttributes): FBXKeyframe[];
|
|
27568
|
+
/** Auto tangent as the FBX SDK computes it, including clamping and auto bias. */
|
|
27569
|
+
export function solveAutoTangent(prevTime: number, time: number, nextTime: number, prevValue: number, value: number, nextValue: number, weightLeft: number, weightRight: number, autoBias: number, flags: number): number;
|
|
27570
|
+
/** Builds a keyframe list from explicit per-key slopes (legacy Takes and synthetic curves). */
|
|
27571
|
+
export function keyframesFromSlopes(times: number[], values: number[], interpolation: FBXInterpolationType[], constantNext: boolean[], leftSlope: number[], rightSlope: number[], leftWeight?: number[], rightWeight?: number[]): FBXKeyframe[];
|
|
27572
|
+
/** Reads a `Pre-Extrapolation` / `Post-Extrapolation` block: `Type` is a character code, `Repetition` a count. */
|
|
27573
|
+
export function parseExtrapolation(typeValue: unknown, repetitionValue: unknown): FBXExtrapolation;
|
|
27574
|
+
export function evaluateCurve(curve: FBXCurveData | undefined, time: number, defaultValue: number, noExtrapolation?: boolean): number;
|
|
27575
|
+
export type Vec3 = [number, number, number];
|
|
27576
|
+
export type Quat = [number, number, number, number];
|
|
27577
|
+
/** Euler angles in degrees with an FBX rotation order (0=XYZ ... 5=ZYX; spheric falls back to XYZ) to a quaternion. */
|
|
27578
|
+
export function eulerToQuat(v: Vec3, order: number): Quat;
|
|
27579
|
+
/** Quaternion to Euler angles in degrees for an FBX rotation order (inverse of eulerToQuat). */
|
|
27580
|
+
export function quatToEuler(q: Quat, order: number): Vec3;
|
|
27581
|
+
/** Blend semantics of an animation layer, derived from its BlendMode and accumulation modes. */
|
|
27582
|
+
export interface FBXLayerBlend {
|
|
27583
|
+
/** Layer participates in blending (BlendMode Additive or Override Passthrough) */
|
|
27584
|
+
blended: boolean;
|
|
27585
|
+
/** Layer adds onto the result instead of replacing it (BlendMode Additive) */
|
|
27586
|
+
additive: boolean;
|
|
27587
|
+
/** Rotations compose as quaternions (RotationAccumulationMode ByLayer) */
|
|
27588
|
+
composeRotation: boolean;
|
|
27589
|
+
/** Scales compose multiplicatively (ScaleAccumulationMode Multiply) */
|
|
27590
|
+
composeScale: boolean;
|
|
27591
|
+
/** Layer weight in [0, 1] */
|
|
27592
|
+
weight: number;
|
|
25832
27593
|
}
|
|
27594
|
+
/**
|
|
27595
|
+
* Combines one animation layer's value into the running result, exactly as the FBX SDK evaluator does.
|
|
27596
|
+
* `kind` selects the accumulation rule: "R" rotations (degrees, rotation order given), "S" scales, anything else linear.
|
|
27597
|
+
*/
|
|
27598
|
+
export function combineLayerValue(result: Vec3, value: Vec3, layer: FBXLayerBlend, kind: "T" | "R" | "S" | "other", rotationOrder: number): Vec3;
|
|
27599
|
+
|
|
27600
|
+
|
|
25833
27601
|
/** An animation curve node (T/R/S for one bone) */
|
|
25834
27602
|
export interface FBXCurveNodeData {
|
|
25835
27603
|
/** Property type: "T" (translation), "R" (rotation), "S" (scale) */
|
|
@@ -25838,13 +27606,19 @@ declare namespace BABYLON {
|
|
|
25838
27606
|
targetModelId: number;
|
|
25839
27607
|
/** Curves for each axis */
|
|
25840
27608
|
curves: FBXCurveData[];
|
|
27609
|
+
/** Index of the owning layer within the stack's layer list */
|
|
27610
|
+
layerIndex: number;
|
|
27611
|
+
/** Default channel values (`d|X`, `d|Y`, `d|Z`) used for channels without a curve */
|
|
27612
|
+
defaultValues?: [number, number, number];
|
|
25841
27613
|
}
|
|
25842
|
-
/**
|
|
27614
|
+
/** Non-transform animation curve node (property animation), evaluated by the loader when a Babylon mapping exists. */
|
|
25843
27615
|
export interface FBXUnsupportedCurveNodeData {
|
|
25844
27616
|
/** Raw AnimationCurveNode property type/name */
|
|
25845
27617
|
type: string;
|
|
25846
27618
|
/** CurveNode object ID */
|
|
25847
27619
|
id: number;
|
|
27620
|
+
/** Index of the owning layer within the stack's layer list */
|
|
27621
|
+
layerIndex: number;
|
|
25848
27622
|
/** Target object ID if the curve node is connected to an object/property */
|
|
25849
27623
|
targetId: number | null;
|
|
25850
27624
|
/** OP connection property name on the target, e.g. Visibility */
|
|
@@ -25883,6 +27657,10 @@ declare namespace BABYLON {
|
|
|
25883
27657
|
normalizedWeight: number;
|
|
25884
27658
|
/** Blend mode: 0=Additive, 1=Override, 2=OverridePassthrough */
|
|
25885
27659
|
blendMode: number;
|
|
27660
|
+
/** Resolved blend semantics used by the evaluator */
|
|
27661
|
+
blend: FBXLayerBlend;
|
|
27662
|
+
/** Animated layer weight (0-100), when the Weight property carries a curve */
|
|
27663
|
+
weightCurve?: FBXCurveData;
|
|
25886
27664
|
/** Curve nodes in this layer */
|
|
25887
27665
|
curveNodes: FBXCurveNodeData[];
|
|
25888
27666
|
/** Unsupported/non-TRS curve nodes preserved for diagnostics */
|
|
@@ -25890,6 +27668,14 @@ declare namespace BABYLON {
|
|
|
25890
27668
|
/** Recoverable layer diagnostics */
|
|
25891
27669
|
diagnostics: FBXAnimationDiagnostic[];
|
|
25892
27670
|
}
|
|
27671
|
+
/** Options for animation extraction. */
|
|
27672
|
+
export interface FBXAnimationExtractOptions {
|
|
27673
|
+
/**
|
|
27674
|
+
* Shift each clip so its first key sits at time 0 (default true). False keeps the times authored in the file, so
|
|
27675
|
+
* clips of one file stay aligned with each other and with the declared stack range.
|
|
27676
|
+
*/
|
|
27677
|
+
rebaseKeyframes?: boolean;
|
|
27678
|
+
}
|
|
25893
27679
|
/** One animation clip (AnimationStack) */
|
|
25894
27680
|
export interface FBXAnimationStackData {
|
|
25895
27681
|
/** Animation name */
|
|
@@ -25912,13 +27698,7 @@ declare namespace BABYLON {
|
|
|
25912
27698
|
/**
|
|
25913
27699
|
* Extract all animation stacks from the FBX scene.
|
|
25914
27700
|
*/
|
|
25915
|
-
export function extractAnimations(objectMap: FBXObjectMap): FBXAnimationStackData[];
|
|
25916
|
-
/**
|
|
25917
|
-
* Determines whether a key sequence appears to be a uniformly frame-baked sampled curve.
|
|
25918
|
-
* @param keys - Keyframes to inspect
|
|
25919
|
-
* @returns true if the keys look like sampled frame data rather than authored interpolation
|
|
25920
|
-
*/
|
|
25921
|
-
export function isFrameBakedSampledCurve(keys: readonly FBXKeyframe[]): boolean;
|
|
27701
|
+
export function extractAnimations(objectMap: FBXObjectMap, doc?: FBXDocument, options?: FBXAnimationExtractOptions): FBXAnimationStackData[];
|
|
25922
27702
|
/**
|
|
25923
27703
|
* Samples an FBX animation curve at a specific time.
|
|
25924
27704
|
* @param curveData - Curve data to sample
|
|
@@ -25926,6 +27706,54 @@ declare namespace BABYLON {
|
|
|
25926
27706
|
* @returns The sampled value, or null when the curve has no keys
|
|
25927
27707
|
*/
|
|
25928
27708
|
export function sampleFBXCurveAtTime(curveData: FBXCurveData | undefined, time: number): number | null;
|
|
27709
|
+
/**
|
|
27710
|
+
* Pre-7000 files store animation in a top-level `Takes` block instead of AnimationStack/Layer/CurveNode objects:
|
|
27711
|
+
*
|
|
27712
|
+
* Takes: { Take: "name" { LocalTime: start, stop
|
|
27713
|
+
* Model: "Model::joint1" { Channel: "Transform" { Channel: "T" { Channel: "X" { Default, KeyVer, KeyCount, Key } } } } } }
|
|
27714
|
+
*
|
|
27715
|
+
* Each take becomes one animation stack with a single layer. Models are matched through the same legacy string ids
|
|
27716
|
+
* that the connection resolver synthesizes for 6.x objects.
|
|
27717
|
+
*/
|
|
27718
|
+
export function extractLegacyTakes(doc: FBXDocument, objectMap: FBXObjectMap, rebaseKeyframes?: boolean): FBXAnimationStackData[];
|
|
27719
|
+
/**
|
|
27720
|
+
* Evaluates one transform channel (T, R or S) of a target at `time`, blending every animation layer of the stack the
|
|
27721
|
+
* way the FBX SDK does: the first layer animating the channel replaces the static value, later layers are combined
|
|
27722
|
+
* according to their blend mode, weight and accumulation modes.
|
|
27723
|
+
* @param curveNodes - Curve nodes targeting this model (any layers, any types)
|
|
27724
|
+
* @param layers - Stack layers, in order
|
|
27725
|
+
* @param type - Channel to evaluate
|
|
27726
|
+
* @param staticValue - Value when nothing animates the channel
|
|
27727
|
+
* @param rotationOrder - Rotation order of the target (for rotation composition)
|
|
27728
|
+
* @param time - Time in seconds
|
|
27729
|
+
*/
|
|
27730
|
+
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];
|
|
27731
|
+
/** Curves of one animated property (or blend shape weight) contributed by one animation layer. */
|
|
27732
|
+
export interface FBXLayeredPropertySource {
|
|
27733
|
+
/** Index of the owning layer within the stack's layer list */
|
|
27734
|
+
layerIndex: number;
|
|
27735
|
+
/** Curves of the property, keyed by channel name (`d|X`, `d|DeformPercent`, ...) */
|
|
27736
|
+
curves: readonly FBXCurveData[];
|
|
27737
|
+
/** Default channel values stored on the curve node */
|
|
27738
|
+
defaultValues?: Record<string, number>;
|
|
27739
|
+
}
|
|
27740
|
+
/**
|
|
27741
|
+
* Evaluates an animated property through the animation layers: the base layer replaces the static value, every
|
|
27742
|
+
* further layer blends onto the running result according to its blend mode and (possibly animated) weight, like
|
|
27743
|
+
* `evaluateLayeredChannel` does for transforms.
|
|
27744
|
+
* @param sources - Per-layer curves of the property
|
|
27745
|
+
* @param layers - Stack layers, in order
|
|
27746
|
+
* @param channels - Channel names to evaluate, in output order
|
|
27747
|
+
* @param staticValue - Value per channel when nothing animates it
|
|
27748
|
+
* @param time - Time in seconds
|
|
27749
|
+
* @returns One value per channel
|
|
27750
|
+
*/
|
|
27751
|
+
export function evaluateLayeredProperty(sources: readonly FBXLayeredPropertySource[], layers: readonly FBXAnimationLayerData[], channels: readonly string[], staticValue: readonly number[], time: number): number[];
|
|
27752
|
+
/**
|
|
27753
|
+
* True when every curve of the given channel is inside a constant (stepped) segment at `time`, so a baked key at
|
|
27754
|
+
* that time should hold its value instead of interpolating towards the next sample.
|
|
27755
|
+
*/
|
|
27756
|
+
export function isChannelSteppedAt(curveNodes: readonly FBXCurveNodeData[], type: "T" | "R" | "S", time: number): boolean;
|
|
25929
27757
|
|
|
25930
27758
|
|
|
25931
27759
|
/** Pure barrel — re-exports only side-effect-free modules */
|