-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.ts
28 lines (24 loc) · 960 Bytes
/
loader.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { parseFileExtension } from '../upload';
import { CustomLoader } from './CustomLoader';
import { OBJLoader } from './OBJLoader';
import { FBXLoader } from './FBXLoader';
import { GLTFLoader } from './GLTFLoader';
import { PLYLoader } from './PLYLoader';
import { STLLoader } from './STLLoader';
import { Rhino3DMLoader } from './3DMLoader';
const EXTENSIONS_TO_LOADER = new Map();
EXTENSIONS_TO_LOADER.set( "obj", OBJLoader );
EXTENSIONS_TO_LOADER.set( "fbx", FBXLoader );
EXTENSIONS_TO_LOADER.set( "gltf", GLTFLoader );
EXTENSIONS_TO_LOADER.set( "glb", GLTFLoader );
EXTENSIONS_TO_LOADER.set( "ply", PLYLoader );
EXTENSIONS_TO_LOADER.set( "stl", STLLoader );
EXTENSIONS_TO_LOADER.set( "3dm", Rhino3DMLoader );
function getAssociatedLoader( filename: string ): CustomLoader {
const extension = parseFileExtension( filename );
const loader = EXTENSIONS_TO_LOADER.get( extension );
return new loader();
}
export {
getAssociatedLoader
}