UNPKG

@babylonjs/loaders

Version:

For usage documentation please visit https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes/.

57 lines 2.53 kB
/* eslint-disable @typescript-eslint/naming-convention */ import { RegisterSceneLoaderPlugin } from "@babylonjs/core/Loading/sceneLoader.js"; import { BVHFileLoaderMetadata } from "./BVH/bvhFileLoader.metadata.js"; import { GLTFFileLoaderMetadata } from "./glTF/glTFFileLoader.metadata.js"; import { OBJFileLoaderMetadata } from "./OBJ/objFileLoader.metadata.js"; import { SPLATFileLoaderMetadata } from "./SPLAT/splatFileLoader.metadata.js"; import { STLFileLoaderMetadata } from "./STL/stlFileLoader.metadata.js"; import { registerBuiltInGLTFExtensions } from "./glTF/2.0/Extensions/dynamic.js"; /** * Registers the async plugin factories for all built-in loaders. * Loaders will be dynamically imported on demand, only when a SceneLoader load operation needs each respective loader. */ export function registerBuiltInLoaders() { // Register the BVH loader. RegisterSceneLoaderPlugin({ ...BVHFileLoaderMetadata, createPlugin: async (options) => { const { BVHFileLoader } = await import("./BVH/bvhFileLoader.js"); return new BVHFileLoader(options[BVHFileLoaderMetadata.name]); }, }); // Register the glTF loader (2.0) specifically/only. RegisterSceneLoaderPlugin({ ...GLTFFileLoaderMetadata, createPlugin: async (options) => { const { GLTFFileLoader } = await import("./glTF/2.0/glTFLoader.js"); return new GLTFFileLoader(options[GLTFFileLoaderMetadata.name]); }, }); // Register the built-in glTF (2.0) extensions. registerBuiltInGLTFExtensions(); // Register the OBJ loader. RegisterSceneLoaderPlugin({ ...OBJFileLoaderMetadata, createPlugin: async (options) => { const { OBJFileLoader } = await import("./OBJ/objFileLoader.js"); return new OBJFileLoader(options[OBJFileLoaderMetadata.name]); }, }); // Register the SPLAT loader. RegisterSceneLoaderPlugin({ ...SPLATFileLoaderMetadata, createPlugin: async (options) => { const { SPLATFileLoader } = await import("./SPLAT/splatFileLoader.js"); return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]); }, }); // Register the STL loader. RegisterSceneLoaderPlugin({ ...STLFileLoaderMetadata, createPlugin: async () => { const { STLFileLoader } = await import("./STL/stlFileLoader.js"); return new STLFileLoader(); }, }); } //# sourceMappingURL=dynamic.js.map