@babylonjs/loaders 9.11.0 → 9.12.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/fbxFileLoader.d.ts +194 -0
- package/FBX/fbxFileLoader.js +2440 -0
- package/FBX/fbxFileLoader.js.map +1 -0
- package/FBX/fbxFileLoader.metadata.d.ts +11 -0
- package/FBX/fbxFileLoader.metadata.js +11 -0
- package/FBX/fbxFileLoader.metadata.js.map +1 -0
- package/FBX/index.d.ts +3 -0
- package/FBX/index.js +3 -0
- package/FBX/index.js.map +1 -0
- package/FBX/interpreter/animation.d.ts +122 -0
- package/FBX/interpreter/animation.js +648 -0
- package/FBX/interpreter/animation.js.map +1 -0
- package/FBX/interpreter/blendShapes.d.ts +44 -0
- package/FBX/interpreter/blendShapes.js +192 -0
- package/FBX/interpreter/blendShapes.js.map +1 -0
- package/FBX/interpreter/connections.d.ts +95 -0
- package/FBX/interpreter/connections.js +233 -0
- package/FBX/interpreter/connections.js.map +1 -0
- package/FBX/interpreter/fbxInterpreter.d.ts +149 -0
- package/FBX/interpreter/fbxInterpreter.js +496 -0
- package/FBX/interpreter/fbxInterpreter.js.map +1 -0
- package/FBX/interpreter/geometry.d.ts +55 -0
- package/FBX/interpreter/geometry.js +573 -0
- package/FBX/interpreter/geometry.js.map +1 -0
- package/FBX/interpreter/materials.d.ts +50 -0
- package/FBX/interpreter/materials.js +144 -0
- package/FBX/interpreter/materials.js.map +1 -0
- package/FBX/interpreter/propertyTemplates.d.ts +22 -0
- package/FBX/interpreter/propertyTemplates.js +125 -0
- package/FBX/interpreter/propertyTemplates.js.map +1 -0
- package/FBX/interpreter/rig.d.ts +20 -0
- package/FBX/interpreter/rig.js +259 -0
- package/FBX/interpreter/rig.js.map +1 -0
- package/FBX/interpreter/sceneDiagnostics.d.ts +14 -0
- package/FBX/interpreter/sceneDiagnostics.js +55 -0
- package/FBX/interpreter/sceneDiagnostics.js.map +1 -0
- package/FBX/interpreter/skeleton.d.ts +93 -0
- package/FBX/interpreter/skeleton.js +515 -0
- package/FBX/interpreter/skeleton.js.map +1 -0
- package/FBX/interpreter/transform.d.ts +21 -0
- package/FBX/interpreter/transform.js +92 -0
- package/FBX/interpreter/transform.js.map +1 -0
- package/FBX/parsers/fbxAsciiParser.d.ts +5 -0
- package/FBX/parsers/fbxAsciiParser.js +330 -0
- package/FBX/parsers/fbxAsciiParser.js.map +1 -0
- package/FBX/parsers/fbxBinaryParser.d.ts +6 -0
- package/FBX/parsers/fbxBinaryParser.js +255 -0
- package/FBX/parsers/fbxBinaryParser.js.map +1 -0
- package/FBX/parsers/zlibInflate.d.ts +7 -0
- package/FBX/parsers/zlibInflate.js +350 -0
- package/FBX/parsers/zlibInflate.js.map +1 -0
- package/FBX/types/fbxTypes.d.ts +54 -0
- package/FBX/types/fbxTypes.js +66 -0
- package/FBX/types/fbxTypes.js.map +1 -0
- package/SPLAT/gaussianSplattingStream.d.ts +341 -0
- package/SPLAT/gaussianSplattingStream.js +976 -0
- package/SPLAT/gaussianSplattingStream.js.map +1 -0
- package/SPLAT/gaussianSplattingWorkBuffer.d.ts +51 -0
- package/SPLAT/gaussianSplattingWorkBuffer.js +159 -0
- package/SPLAT/gaussianSplattingWorkBuffer.js.map +1 -0
- package/SPLAT/gaussianSplattingWorkBufferShaders.d.ts +25 -0
- package/SPLAT/gaussianSplattingWorkBufferShaders.js +255 -0
- package/SPLAT/gaussianSplattingWorkBufferShaders.js.map +1 -0
- package/SPLAT/index.d.ts +1 -0
- package/SPLAT/index.js +1 -0
- package/SPLAT/index.js.map +1 -1
- package/SPLAT/sog.js +18 -16
- package/SPLAT/sog.js.map +1 -1
- package/SPLAT/splatFileLoader.d.ts +8 -0
- package/SPLAT/splatFileLoader.js +49 -0
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/dynamic.js +9 -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 +3 -3
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { type ISceneLoaderPluginAsync, type ISceneLoaderPluginFactory, type ISceneLoaderAsyncResult, type ISceneLoaderProgressEvent, type SceneLoaderPluginOptions } from "@babylonjs/core/Loading/sceneLoader.js";
|
|
2
|
+
import { type Scene } from "@babylonjs/core/scene.js";
|
|
3
|
+
import { AssetContainer } from "@babylonjs/core/assetContainer.js";
|
|
4
|
+
import { FBXFileLoaderMetadata } from "./fbxFileLoader.metadata.js";
|
|
5
|
+
/**
|
|
6
|
+
* Source convention for tangent-space normal maps loaded from FBX normal-map slots.
|
|
7
|
+
*/
|
|
8
|
+
export type FBXNormalMapCoordinateSystem = "y-up" | "y-down";
|
|
9
|
+
/**
|
|
10
|
+
* Defines options for the FBX loader.
|
|
11
|
+
*/
|
|
12
|
+
export interface FBXFileLoaderOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Source convention for tangent-space normal maps connected through FBX normal-map slots.
|
|
15
|
+
* FBX does not standardize this convention, so the loader defaults to the glTF/USD-style Y-up convention.
|
|
16
|
+
* Set to "y-down" for assets authored with inverted green/Y normal maps.
|
|
17
|
+
*/
|
|
18
|
+
normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;
|
|
19
|
+
}
|
|
20
|
+
declare module "@babylonjs/core/Loading/sceneLoader.js" {
|
|
21
|
+
interface SceneLoaderPluginOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Defines options for the FBX loader.
|
|
24
|
+
*/
|
|
25
|
+
[FBXFileLoaderMetadata.name]: FBXFileLoaderOptions;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* FBX file loader plugin for Babylon.js.
|
|
30
|
+
* Pure TypeScript implementation — no Autodesk FBX SDK dependency.
|
|
31
|
+
*/
|
|
32
|
+
export declare class FBXFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
|
|
33
|
+
/**
|
|
34
|
+
* Defines the name of the plugin.
|
|
35
|
+
*/
|
|
36
|
+
readonly name: "fbx";
|
|
37
|
+
/**
|
|
38
|
+
* Defines the extension the plugin is able to load.
|
|
39
|
+
*/
|
|
40
|
+
readonly extensions: {
|
|
41
|
+
readonly ".fbx": {
|
|
42
|
+
readonly isBinary: true;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
private readonly _options;
|
|
46
|
+
private readonly _bindRestBones;
|
|
47
|
+
private readonly _sourceBonesBySkeleton;
|
|
48
|
+
private readonly _scaleCompensationHelpersBySkeleton;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new FBX loader.
|
|
51
|
+
* @param options - Options controlling FBX loading behavior
|
|
52
|
+
*/
|
|
53
|
+
constructor(options?: FBXFileLoaderOptions);
|
|
54
|
+
/**
|
|
55
|
+
* Creates an FBX loader plugin instance with options from SceneLoader.
|
|
56
|
+
* @param options - Scene loader plugin options
|
|
57
|
+
* @returns The configured FBX loader
|
|
58
|
+
*/
|
|
59
|
+
createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync;
|
|
60
|
+
/**
|
|
61
|
+
* Imports meshes from an FBX file and adds them to the scene.
|
|
62
|
+
* @param meshesNames - A string or array of mesh names to import, or null/undefined to import all meshes
|
|
63
|
+
* @param scene - The scene to add imported meshes to
|
|
64
|
+
* @param data - The FBX data to load
|
|
65
|
+
* @param rootUrl - Root URL used to resolve external resources
|
|
66
|
+
* @param _onProgress - Callback called while the file is loading
|
|
67
|
+
* @param _fileName - Name of the file being loaded
|
|
68
|
+
* @returns A promise containing the loaded meshes, particle systems, skeletons, animation groups, transform nodes, geometries, and lights
|
|
69
|
+
*/
|
|
70
|
+
importMeshAsync(meshesNames: string | readonly string[] | null | undefined, scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<ISceneLoaderAsyncResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Loads all FBX content into the scene.
|
|
73
|
+
* @param scene - The scene to load the FBX content into
|
|
74
|
+
* @param data - The FBX data to load
|
|
75
|
+
* @param rootUrl - Root URL used to resolve external resources
|
|
76
|
+
* @param _onProgress - Callback called while the file is loading
|
|
77
|
+
* @param _fileName - Name of the file being loaded
|
|
78
|
+
* @returns A promise that resolves when loading is complete
|
|
79
|
+
*/
|
|
80
|
+
loadAsync(scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Loads all FBX content into an asset container.
|
|
83
|
+
* @param scene - The scene used to create the asset container
|
|
84
|
+
* @param data - The FBX data to load
|
|
85
|
+
* @param rootUrl - Root URL used to resolve external resources
|
|
86
|
+
* @param _onProgress - Callback called while the file is loading
|
|
87
|
+
* @param _fileName - Name of the file being loaded
|
|
88
|
+
* @returns A promise containing the loaded asset container
|
|
89
|
+
*/
|
|
90
|
+
loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, _onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<AssetContainer>;
|
|
91
|
+
private _parse;
|
|
92
|
+
private _parseFromArrayBuffer;
|
|
93
|
+
private _buildScene;
|
|
94
|
+
private _addMaterialToContainer;
|
|
95
|
+
private _addTextureToContainer;
|
|
96
|
+
private _setAssetContainer;
|
|
97
|
+
private static _computeFBXAxisConversionMatrix;
|
|
98
|
+
private _buildModel;
|
|
99
|
+
private static _modelSubtreeMatchesNameFilter;
|
|
100
|
+
private static _applyModelMetadata;
|
|
101
|
+
private _createMesh;
|
|
102
|
+
/**
|
|
103
|
+
* Apply multi-material to a mesh by creating sub-meshes grouped by material index.
|
|
104
|
+
* Reorders the index buffer so that triangles sharing the same material are contiguous.
|
|
105
|
+
*/
|
|
106
|
+
private _applyMultiMaterial;
|
|
107
|
+
private static _collectCullingConflictMaterialIds;
|
|
108
|
+
private static _getModelMaterial;
|
|
109
|
+
private _applyMaterialUVSetCoordinates;
|
|
110
|
+
private _applyStandardMaterialUVSetCoordinates;
|
|
111
|
+
/**
|
|
112
|
+
* Babylon multiplies vertex colors by material diffuse color. Use per-mesh
|
|
113
|
+
* material clones so vertex-colored geometry can render unmodulated without
|
|
114
|
+
* changing shared materials used by non-vertex-colored meshes.
|
|
115
|
+
*/
|
|
116
|
+
private _useUnmodulatedVertexColorMaterials;
|
|
117
|
+
/**
|
|
118
|
+
* Build per-polygon-vertex bone indices and weights from the control-point-based skin data.
|
|
119
|
+
* The geometry expands control points to per-polygon-vertex, so we need to look up
|
|
120
|
+
* each polygon-vertex's control point index.
|
|
121
|
+
*/
|
|
122
|
+
private _buildSkinningData;
|
|
123
|
+
private _createMaterial;
|
|
124
|
+
private _configureNormalTexture;
|
|
125
|
+
private _getNormalMapTangentHandednessScale;
|
|
126
|
+
private static _isSupportedMaterialTextureSlot;
|
|
127
|
+
private static _isNormalMapTextureSlot;
|
|
128
|
+
private static _createTexture;
|
|
129
|
+
private static _createExternalTexture;
|
|
130
|
+
private static _buildTextureFallbackUrls;
|
|
131
|
+
private static _getTextureCreationOptions;
|
|
132
|
+
private static _getExternalTextureUrls;
|
|
133
|
+
private static _getTextureSourceName;
|
|
134
|
+
private static _getTextureSourceNameFromPath;
|
|
135
|
+
private static _isSafeRelativeTexturePath;
|
|
136
|
+
private static _getForcedExtension;
|
|
137
|
+
private static _getMimeType;
|
|
138
|
+
/**
|
|
139
|
+
* Apply blend shape (morph target) deformers to meshes.
|
|
140
|
+
* FBX Shape vertices are stored as absolute positions for sparse control points.
|
|
141
|
+
* We compute deltas relative to the base mesh positions.
|
|
142
|
+
*/
|
|
143
|
+
private _applyBlendShapes;
|
|
144
|
+
private _createCamera;
|
|
145
|
+
private _createLight;
|
|
146
|
+
private _createSkeleton;
|
|
147
|
+
private _getSourceBone;
|
|
148
|
+
private _getScaleCompensationHelper;
|
|
149
|
+
private static _computeFBXAbsoluteMatrices;
|
|
150
|
+
private static _computeFBXRuntimeLocalMatrix;
|
|
151
|
+
private static _applyParentScaleCompensation;
|
|
152
|
+
private static _splitParentScaleCompensatedLocalMatrix;
|
|
153
|
+
private static _safeInverseScale;
|
|
154
|
+
private static _getInverseScaleVector;
|
|
155
|
+
private static _shouldUseBindMatricesAsRest;
|
|
156
|
+
private static _getMaxScaleRatio;
|
|
157
|
+
private static _getScaleRatio;
|
|
158
|
+
private static _computeFBXGeometricMatrix;
|
|
159
|
+
private static _computeFBXGeometricDeltaMatrix;
|
|
160
|
+
private static _computeFBXGeometricNormalMatrix;
|
|
161
|
+
/**
|
|
162
|
+
* Compute the full FBX local transform matrix:
|
|
163
|
+
* M = T * Roff * Rp * Rpre * R * Rpost^-1 * Rp^-1 * Soff * Sp * S * Sp^-1
|
|
164
|
+
*
|
|
165
|
+
* In row-vector convention: v' = v * M
|
|
166
|
+
*/
|
|
167
|
+
private static _computeFBXLocalMatrix;
|
|
168
|
+
/**
|
|
169
|
+
* Apply the FBX transform chain to a Babylon TransformNode or Mesh.
|
|
170
|
+
* Decomposes the full local matrix into position/rotation/scale.
|
|
171
|
+
*/
|
|
172
|
+
private static _applyFBXTransform;
|
|
173
|
+
private static _computeFBXModelLocalMatrix;
|
|
174
|
+
private static _getBoneReferenceWorldMatrix;
|
|
175
|
+
private static _applyMatrixToTransform;
|
|
176
|
+
private _createAnimationGroup;
|
|
177
|
+
private _buildInheritedRigBoneAnimations;
|
|
178
|
+
private static _pushMatrixKeys;
|
|
179
|
+
/**
|
|
180
|
+
* Build animations for a non-bone node, correctly handling pivots.
|
|
181
|
+
* Computes the full FBX transform matrix at each keyframe and decomposes into TRS.
|
|
182
|
+
*/
|
|
183
|
+
private _buildNodeAnimations;
|
|
184
|
+
private _isVector3KeysConstant;
|
|
185
|
+
private _sampleModelLocalMatrix;
|
|
186
|
+
private _sampleModelScale;
|
|
187
|
+
/**
|
|
188
|
+
* Build matrix-baked bone animation from full FBX local transforms.
|
|
189
|
+
* The bind matrix carries the skinning offset, so animation curves drive
|
|
190
|
+
* the same FBX local transform chain as the source skeleton.
|
|
191
|
+
*/
|
|
192
|
+
private _buildBoneAnimations;
|
|
193
|
+
private _buildNameFilter;
|
|
194
|
+
}
|