@babylonjs/loaders 9.25.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/FBX/fbxConstraintBehavior.d.ts +188 -0
- package/FBX/fbxConstraintBehavior.js +532 -0
- package/FBX/fbxConstraintBehavior.js.map +1 -0
- package/FBX/fbxFileLoader.pure.d.ts +175 -6
- package/FBX/fbxFileLoader.pure.js +1521 -286
- package/FBX/fbxFileLoader.pure.js.map +1 -1
- package/FBX/index.d.ts +4 -1
- package/FBX/index.js +1 -0
- package/FBX/index.js.map +1 -1
- package/FBX/interpreter/animation.d.ts +73 -33
- package/FBX/interpreter/animation.js +620 -223
- package/FBX/interpreter/animation.js.map +1 -1
- package/FBX/interpreter/animationCurve.d.ts +91 -0
- package/FBX/interpreter/animationCurve.js +623 -0
- package/FBX/interpreter/animationCurve.js.map +1 -0
- package/FBX/interpreter/blendShapes.js +9 -18
- package/FBX/interpreter/blendShapes.js.map +1 -1
- package/FBX/interpreter/connections.d.ts +1 -1
- package/FBX/interpreter/connections.js +173 -34
- package/FBX/interpreter/connections.js.map +1 -1
- package/FBX/interpreter/constraints.d.ts +68 -0
- package/FBX/interpreter/constraints.js +143 -0
- package/FBX/interpreter/constraints.js.map +1 -0
- package/FBX/interpreter/fbxInterpreter.d.ts +89 -4
- package/FBX/interpreter/fbxInterpreter.js +474 -122
- package/FBX/interpreter/fbxInterpreter.js.map +1 -1
- package/FBX/interpreter/geometry.d.ts +1 -1
- package/FBX/interpreter/geometry.js +150 -92
- package/FBX/interpreter/geometry.js.map +1 -1
- package/FBX/interpreter/legacyDocument.d.ts +11 -0
- package/FBX/interpreter/legacyDocument.js +425 -0
- package/FBX/interpreter/legacyDocument.js.map +1 -0
- package/FBX/interpreter/materialModel.d.ts +71 -0
- package/FBX/interpreter/materialModel.js +622 -0
- package/FBX/interpreter/materialModel.js.map +1 -0
- package/FBX/interpreter/materials.d.ts +13 -1
- package/FBX/interpreter/materials.js +88 -5
- package/FBX/interpreter/materials.js.map +1 -1
- package/FBX/interpreter/nodeTransform.d.ts +32 -0
- package/FBX/interpreter/nodeTransform.js +54 -0
- package/FBX/interpreter/nodeTransform.js.map +1 -0
- package/FBX/interpreter/nurbs.d.ts +99 -0
- package/FBX/interpreter/nurbs.js +627 -0
- package/FBX/interpreter/nurbs.js.map +1 -0
- package/FBX/interpreter/propertyTemplates.d.ts +23 -0
- package/FBX/interpreter/propertyTemplates.js +109 -2
- package/FBX/interpreter/propertyTemplates.js.map +1 -1
- package/FBX/interpreter/rig.js +16 -0
- package/FBX/interpreter/rig.js.map +1 -1
- package/FBX/interpreter/sceneDiagnostics.js +28 -3
- package/FBX/interpreter/sceneDiagnostics.js.map +1 -1
- package/FBX/interpreter/skeleton.d.ts +4 -18
- package/FBX/interpreter/skeleton.js +16 -94
- package/FBX/interpreter/skeleton.js.map +1 -1
- package/FBX/parsers/fbxAsciiParser.js +119 -9
- package/FBX/parsers/fbxAsciiParser.js.map +1 -1
- package/FBX/parsers/fbxBinaryParser.js +74 -22
- package/FBX/parsers/fbxBinaryParser.js.map +1 -1
- package/FBX/pure.d.ts +1 -0
- package/FBX/pure.js +1 -0
- package/FBX/pure.js.map +1 -1
- package/FBX/types/fbxTypes.d.ts +18 -2
- package/FBX/types/fbxTypes.js +40 -12
- package/FBX/types/fbxTypes.js.map +1 -1
- package/SPLAT/gaussianSplattingStream.d.ts +31 -0
- package/SPLAT/gaussianSplattingStream.js +49 -0
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/USD/index.d.ts +2 -0
- package/USD/index.js +4 -0
- package/USD/index.js.map +1 -0
- package/USD/pure.d.ts +3 -0
- package/USD/pure.js +5 -0
- package/USD/pure.js.map +1 -0
- package/USD/usdCommandProtocol.d.ts +83 -0
- package/USD/usdCommandProtocol.js +173 -0
- package/USD/usdCommandProtocol.js.map +1 -0
- package/USD/usdFileLoader.d.ts +6 -0
- package/USD/usdFileLoader.js +9 -0
- package/USD/usdFileLoader.js.map +1 -0
- package/USD/usdFileLoader.metadata.d.ts +20 -0
- package/USD/usdFileLoader.metadata.js +18 -0
- package/USD/usdFileLoader.metadata.js.map +1 -0
- package/USD/usdFileLoader.pure.d.ts +102 -0
- package/USD/usdFileLoader.pure.js +341 -0
- package/USD/usdFileLoader.pure.js.map +1 -0
- package/USD/usdFileLoader.types.d.ts +11 -0
- package/USD/usdFileLoader.types.js +2 -0
- package/USD/usdFileLoader.types.js.map +1 -0
- package/USD/usdLoadingOptions.d.ts +123 -0
- package/USD/usdLoadingOptions.js +3 -0
- package/USD/usdLoadingOptions.js.map +1 -0
- package/USD/usdSceneMaterializer.d.ts +9 -0
- package/USD/usdSceneMaterializer.js +982 -0
- package/USD/usdSceneMaterializer.js.map +1 -0
- package/USD/usdWorkerMessages.d.ts +57 -0
- package/USD/usdWorkerMessages.js +3 -0
- package/USD/usdWorkerMessages.js.map +1 -0
- package/dynamic.js +10 -0
- package/dynamic.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +4 -3
- package/pure.d.ts +1 -0
- package/pure.js +1 -0
- package/pure.js.map +1 -1
|
@@ -9,12 +9,83 @@ export type FBXNormalMapCoordinateSystem = "y-up" | "y-down";
|
|
|
9
9
|
* Defines options for the FBX loader.
|
|
10
10
|
*/
|
|
11
11
|
export interface FBXFileLoaderOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Bundle of defaults for the options that change what the loaded scene looks like.
|
|
14
|
+
* - "compatible" (default): the behaviour of the loader as first shipped: StandardMaterial for every material,
|
|
15
|
+
* one Babylon geometry per model, curve geometry skipped, constraints recorded as metadata only, clips rebased
|
|
16
|
+
* to start at frame 0, cameras and lights placed in world space.
|
|
17
|
+
* - "full": everything the loader can do: PBRMaterial for physically based shaders, geometry shared between
|
|
18
|
+
* instances, curves as lines meshes, constraints solved at runtime, authored clip times, cameras and lights
|
|
19
|
+
* parented to their nodes so they animate.
|
|
20
|
+
* An option set explicitly always wins over the preset.
|
|
21
|
+
*/
|
|
22
|
+
preset?: "compatible" | "full";
|
|
12
23
|
/**
|
|
13
24
|
* Source convention for tangent-space normal maps connected through FBX normal-map slots.
|
|
14
25
|
* FBX does not standardize this convention, so the loader defaults to the glTF/USD-style Y-up convention.
|
|
15
26
|
* Set to "y-down" for assets authored with inverted green/Y normal maps.
|
|
16
27
|
*/
|
|
17
28
|
normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;
|
|
29
|
+
/**
|
|
30
|
+
* Which Babylon material to build.
|
|
31
|
+
* - "standard" (default, "full" preset: "auto"): always StandardMaterial (PBR parameters are approximated).
|
|
32
|
+
* - "auto": PBRMaterial for physically based FBX materials (Standard Surface, Arnold, 3ds Max Physical,
|
|
33
|
+
* 3ds Max PBR, glTF, OpenPBR, Stingray PBS) and StandardMaterial for classic Lambert/Phong materials.
|
|
34
|
+
* - "pbr": always PBRMaterial (Lambert/Phong parameters are converted).
|
|
35
|
+
*/
|
|
36
|
+
materials?: "auto" | "standard" | "pbr";
|
|
37
|
+
/**
|
|
38
|
+
* Unit conversion applied at the root of the loaded hierarchy.
|
|
39
|
+
* - "preserve" (default): keep the file's units (1 Babylon unit = 1 FBX unit).
|
|
40
|
+
* - "meters": scale so that 1 Babylon unit is 1 meter, using the file's UnitScaleFactor.
|
|
41
|
+
* - a number: centimeters per Babylon unit (100 = meters, 1 = centimeters, 2.54 = inches).
|
|
42
|
+
*/
|
|
43
|
+
unitScale?: "preserve" | "meters" | number;
|
|
44
|
+
/**
|
|
45
|
+
* Share vertex data between models that reference the same FBX geometry (default false, "full" preset: true).
|
|
46
|
+
* Skinned meshes are never shared.
|
|
47
|
+
*/
|
|
48
|
+
shareGeometry?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Called for every recoverable issue found while loading (unsupported features, malformed data that was
|
|
51
|
+
* skipped, approximations). The same list is stored on the root node's metadata as `fbxDiagnostics`.
|
|
52
|
+
*/
|
|
53
|
+
onWarning?: (warning: FBXLoaderWarning) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Segments per knot span when tessellating NURBS surfaces. Zero or undefined uses the subdivision stored in
|
|
56
|
+
* the file (usually 4), capped at 16.
|
|
57
|
+
*/
|
|
58
|
+
nurbsSubdivision?: number;
|
|
59
|
+
/** How curve geometry (Line, NurbsCurve) is imported: skipped (default) or as lines meshes ("full" preset). */
|
|
60
|
+
curves?: "lines" | "skip";
|
|
61
|
+
/**
|
|
62
|
+
* Constraints (aim, parent, position, rotation, scale): "metadata" (default) only records them on the nodes,
|
|
63
|
+
* "apply" ("full" preset) attaches an `FBXConstraintBehavior` to each constrained node so it is solved before
|
|
64
|
+
* every render. IK chains are always metadata only.
|
|
65
|
+
*/
|
|
66
|
+
constraints?: "apply" | "metadata";
|
|
67
|
+
/**
|
|
68
|
+
* Shift every clip so its first keyframe sits at frame 0 (default true). With false ("full" preset) keys keep
|
|
69
|
+
* the times authored in the file, so clips of one file stay aligned with each other and with their declared
|
|
70
|
+
* ranges.
|
|
71
|
+
*/
|
|
72
|
+
rebaseAnimations?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Parent cameras and lights to their FBX node so they follow its animation (default false, "full" preset:
|
|
75
|
+
* true). Otherwise they are created at the node's world position and orientation, unparented.
|
|
76
|
+
*/
|
|
77
|
+
attachCamerasAndLights?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** A recoverable issue reported while loading an FBX file. */
|
|
80
|
+
export interface FBXLoaderWarning {
|
|
81
|
+
/** Which part of the loader reported the issue */
|
|
82
|
+
source: "scene" | "model" | "geometry" | "skin" | "rig" | "animation" | "blendShape" | "camera" | "light";
|
|
83
|
+
/** Human readable description */
|
|
84
|
+
message: string;
|
|
85
|
+
/** Name of the affected object, when known */
|
|
86
|
+
objectName?: string;
|
|
87
|
+
/** Structured details from the interpreter, when any */
|
|
88
|
+
details?: unknown;
|
|
18
89
|
}
|
|
19
90
|
/**
|
|
20
91
|
* FBX file loader plugin for Babylon.js.
|
|
@@ -37,6 +108,22 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
37
108
|
private readonly _bindRestBones;
|
|
38
109
|
private readonly _sourceBonesBySkeleton;
|
|
39
110
|
private readonly _scaleCompensationHelpersBySkeleton;
|
|
111
|
+
/** Frame rate of the file being loaded (GlobalSettings TimeMode); animation is baked at this rate. */
|
|
112
|
+
private _frameRate;
|
|
113
|
+
/** Layers of the animation stack currently being converted; used by the transform samplers. */
|
|
114
|
+
private _activeLayers;
|
|
115
|
+
/** Parent model per model id, for inherit-mode aware sampling. */
|
|
116
|
+
private _parentModelById;
|
|
117
|
+
/** Curve nodes per model id for the stack currently being converted. */
|
|
118
|
+
private _curveNodesByModelId;
|
|
119
|
+
/** Helper nodes inserted above models whose InheritType is not RSrs. */
|
|
120
|
+
private _inheritScaleHelpers;
|
|
121
|
+
/** First mesh built per (geometry, geometric transform), for geometry sharing between instances. */
|
|
122
|
+
private _meshByGeometryKey;
|
|
123
|
+
/** Instance mesh -> source mesh whose geometry it shares. */
|
|
124
|
+
private _instanceSource;
|
|
125
|
+
/** Property curve nodes that were mapped onto Babylon animations; their "not evaluated" diagnostics are dropped. */
|
|
126
|
+
private _evaluatedCurveNodeIds;
|
|
40
127
|
/**
|
|
41
128
|
* Creates a new FBX loader.
|
|
42
129
|
* @param options - Options controlling FBX loading behavior
|
|
@@ -79,6 +166,11 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
79
166
|
* @returns A promise containing the loaded asset container
|
|
80
167
|
*/
|
|
81
168
|
loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<AssetContainer>;
|
|
169
|
+
/**
|
|
170
|
+
* Parses and interprets the file. Parsing is synchronous, so no progress events are emitted: the scene loader's
|
|
171
|
+
* progress callback reports download bytes and must not be fed synthetic counts.
|
|
172
|
+
*/
|
|
173
|
+
private _parseAndInterpret;
|
|
82
174
|
private _parse;
|
|
83
175
|
private _parseFromArrayBuffer;
|
|
84
176
|
private _buildScene;
|
|
@@ -90,6 +182,15 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
90
182
|
private _linkSkeletonsToTransformNodes;
|
|
91
183
|
private static _modelSubtreeMatchesNameFilter;
|
|
92
184
|
private static _applyModelMetadata;
|
|
185
|
+
/**
|
|
186
|
+
* Wires a LodGroup's children as Babylon LOD levels: the first child holds the highest detail; every further
|
|
187
|
+
* child replaces it beyond the group's threshold distance (or screen coverage when thresholds are percentages).
|
|
188
|
+
* Each child's display mode is honoured first: level 1 (show) stays visible outside the LOD chain, level 2
|
|
189
|
+
* (hide) is disabled, and only level 0 (use LOD) children take part in the distance switching.
|
|
190
|
+
*/
|
|
191
|
+
private static _applyLodGroup;
|
|
192
|
+
/** Builds a lines mesh from Line or tessellated NurbsCurve geometry, applying the model's geometric transform. */
|
|
193
|
+
private _createLinesMesh;
|
|
93
194
|
private _createMesh;
|
|
94
195
|
/**
|
|
95
196
|
* Apply multi-material to a mesh by creating sub-meshes grouped by material index.
|
|
@@ -113,6 +214,11 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
113
214
|
*/
|
|
114
215
|
private _buildSkinningData;
|
|
115
216
|
private _createMaterial;
|
|
217
|
+
private _createPbrMaterial;
|
|
218
|
+
/** Alpha of a classic Lambert/Phong material: Opacity when present, otherwise 1 - TransparentColor * TransparencyFactor. */
|
|
219
|
+
private static _alphaFromClassicTransparency;
|
|
220
|
+
private static _applyTextureSettings;
|
|
221
|
+
private _createStandardMaterial;
|
|
116
222
|
private _configureNormalTexture;
|
|
117
223
|
private _getNormalMapTangentHandednessScale;
|
|
118
224
|
private static _isSupportedMaterialTextureSlot;
|
|
@@ -136,11 +242,27 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
136
242
|
private _createCamera;
|
|
137
243
|
private _createLight;
|
|
138
244
|
private _createSkeleton;
|
|
245
|
+
private _rigBoneModelIds;
|
|
246
|
+
private _isRigBone;
|
|
139
247
|
private _getSourceBone;
|
|
140
248
|
private _getScaleCompensationHelper;
|
|
141
249
|
private static _computeFBXAbsoluteMatrices;
|
|
250
|
+
/**
|
|
251
|
+
* Effective ("inherit") scale of every bone, following the FBX SDK: the local scale for RSrs bones, and for
|
|
252
|
+
* RrSs / Rrs bones the local scale multiplied by the scale of the bone's inherit-scale node (the parent for RrSs,
|
|
253
|
+
* the parent's inherit-scale node for Rrs). Bones are ordered parents first.
|
|
254
|
+
*/
|
|
255
|
+
private static _computeBoneInheritScales;
|
|
256
|
+
private static _getBoneInheritScaleNode;
|
|
257
|
+
/** Scale a bone inherits into its own scale (RrSs chains), or unit scale. */
|
|
258
|
+
private static _getBoneInheritedScale;
|
|
142
259
|
private static _computeFBXRuntimeLocalMatrix;
|
|
143
260
|
private static _applyParentScaleCompensation;
|
|
261
|
+
/**
|
|
262
|
+
* Splits a bone's FBX local matrix into a helper (which cancels the parent scale and carries the translation,
|
|
263
|
+
* so the translation still follows the parent scale as the SDK does) and the bone's own rotation/scale. For RrSs
|
|
264
|
+
* bones the inherited scale is folded into the bone scale.
|
|
265
|
+
*/
|
|
144
266
|
private static _splitParentScaleCompensatedLocalMatrix;
|
|
145
267
|
private static _safeInverseScale;
|
|
146
268
|
private static _getInverseScaleVector;
|
|
@@ -157,13 +279,8 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
157
279
|
* In row-vector convention: v' = v * M
|
|
158
280
|
*/
|
|
159
281
|
private static _computeFBXLocalMatrix;
|
|
160
|
-
|
|
161
|
-
* Apply the FBX transform chain to a Babylon TransformNode or Mesh.
|
|
162
|
-
* Decomposes the full local matrix into position/rotation/scale.
|
|
163
|
-
*/
|
|
164
|
-
private static _applyFBXTransform;
|
|
282
|
+
private _applyRestTRS;
|
|
165
283
|
private static _computeFBXModelLocalMatrix;
|
|
166
|
-
private static _getBoneReferenceWorldMatrix;
|
|
167
284
|
private static _applyMatrixToTransform;
|
|
168
285
|
private _createAnimationGroup;
|
|
169
286
|
private _buildInheritedRigBoneAnimations;
|
|
@@ -173,9 +290,61 @@ export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoa
|
|
|
173
290
|
* Computes the full FBX transform matrix at each keyframe and decomposes into TRS.
|
|
174
291
|
*/
|
|
175
292
|
private _buildNodeAnimations;
|
|
293
|
+
/**
|
|
294
|
+
* Baked keys are interpolated linearly by Babylon. Between two frames an FBX cubic segment can deviate from that
|
|
295
|
+
* line, so sample times are refined (midpoints inserted, up to two levels) wherever the interpolated transform
|
|
296
|
+
* differs noticeably from the curve. Flat and linear segments stay at frame resolution.
|
|
297
|
+
*/
|
|
298
|
+
private static _refineSampleTimes;
|
|
299
|
+
/**
|
|
300
|
+
* Keys of a scalar property animated by one or more layers: the authored keys when a single layer drives it,
|
|
301
|
+
* otherwise the frame grid evaluated through the layer stack.
|
|
302
|
+
* @param sources - Per-layer curves of the property (each with at least one curve)
|
|
303
|
+
* @param animStack - Stack being converted
|
|
304
|
+
* @param mapValue - Conversion from the FBX value to the Babylon property value
|
|
305
|
+
* @returns Animation keys
|
|
306
|
+
*/
|
|
307
|
+
private _layeredScalarKeys;
|
|
308
|
+
/**
|
|
309
|
+
* Maps an animated FBX property (anything other than node transforms and blend shape weights) onto the Babylon
|
|
310
|
+
* property that carries it: mesh visibility, camera field of view and clip planes, light intensity, colour and
|
|
311
|
+
* cone angles, and material colours, alpha, roughness and metalness. `group` holds the curve nodes of every
|
|
312
|
+
* layer animating that property, in layer order; several layers are evaluated through the layer stack.
|
|
313
|
+
*/
|
|
314
|
+
private _buildPropertyAnimations;
|
|
315
|
+
/** Records constraints on their nodes and, unless disabled, attaches the runtime behavior that solves them. */
|
|
316
|
+
private _applyConstraints;
|
|
317
|
+
/** Collects every recoverable issue the interpreter recorded, stores it on the root node and notifies the caller. */
|
|
318
|
+
private _reportDiagnostics;
|
|
319
|
+
/** Curve nodes affecting the inherit scale of a model: its own scale curves and those of its inherit-scale chain. */
|
|
320
|
+
private _collectInheritScaleCurves;
|
|
176
321
|
private _isVector3KeysConstant;
|
|
322
|
+
/** Samples the animated Lcl Translation / Rotation / Scaling of a model, blending all layers of the active stack. */
|
|
323
|
+
private _sampleModelTRS;
|
|
324
|
+
/**
|
|
325
|
+
* Local position/rotation/scale of a model from FBX Lcl values. Without pivots and offsets the components map
|
|
326
|
+
* directly (rotation = pre * lcl * post⁻¹), which keeps zero and negative scales exact. With pivots the full
|
|
327
|
+
* matrix is built and decomposed.
|
|
328
|
+
*/
|
|
329
|
+
private static _computeLocalTRS;
|
|
330
|
+
/** Applies inherit-mode adjustments to a local TRS (see _computeInheritAwareLocalMatrix). */
|
|
331
|
+
private _adjustTRSForInheritMode;
|
|
177
332
|
private _sampleModelLocalMatrix;
|
|
178
333
|
private _sampleModelScale;
|
|
334
|
+
/**
|
|
335
|
+
* Effective scale of a model for inherit-mode math (`inherit_scale` in ufbx terms): its own local scale, multiplied
|
|
336
|
+
* componentwise by the inherited scale when the model uses RrSs inheritance. `time` samples animation; undefined
|
|
337
|
+
* uses the rest pose.
|
|
338
|
+
*/
|
|
339
|
+
private _getInheritScale;
|
|
340
|
+
/** RrSs nodes inherit scale from their parent; Rrs nodes skip their immediate parent (chaining through Rrs parents). */
|
|
341
|
+
private _getInheritScaleNode;
|
|
342
|
+
/**
|
|
343
|
+
* Local matrix of a model relative to its Babylon parent frame, accounting for inherit modes. For RSrs (the
|
|
344
|
+
* default) this is the FBX local matrix. For RrSs / Rrs the node sits under a helper that removes the parent's
|
|
345
|
+
* scale, so translation is pre-scaled by the parent scale and (for RrSs) scale accumulates componentwise.
|
|
346
|
+
*/
|
|
347
|
+
private _computeInheritAwareLocalMatrix;
|
|
179
348
|
/**
|
|
180
349
|
* Build matrix-baked bone animation from full FBX local transforms.
|
|
181
350
|
* The bind matrix carries the skinning offset, so animation curves drive
|