Line data Source code
1 : /**
2 : * Load3D constants that don't require THREE.js
3 : * This file can be imported without pulling in the entire THREE.js bundle
4 : */
5 :
6 2356 : export const SUPPORTED_MESH_EXTENSIONS = new Set([
7 : '.gltf',
8 : '.glb',
9 : '.obj',
10 : '.fbx',
11 : '.stl'
12 : ])
13 :
14 2356 : export const SUPPORTED_EXTENSIONS = new Set([
15 : ...SUPPORTED_MESH_EXTENSIONS,
16 : '.spz',
17 : '.splat',
18 : '.ply',
19 : '.ksplat'
20 : ])
21 :
22 2356 : export const SUPPORTED_EXTENSIONS_ACCEPT = [...SUPPORTED_EXTENSIONS].join(',')
23 :
24 2356 : export const SUPPORTED_HDRI_EXTENSIONS = new Set(['.hdr', '.exr'])
25 :
26 2356 : export const SUPPORTED_HDRI_EXTENSIONS_ACCEPT = [
27 : ...SUPPORTED_HDRI_EXTENSIONS
28 : ].join(',')
29 :
30 2356 : export const LOAD3D_NONE_MODEL = 'none'
31 :
32 2356 : export const DIRECT_EXPORT_FORMATS = new Set(['ply', 'spz', 'splat', 'ksplat'])
33 :
34 : interface ExportFormatOption {
35 : label: string
36 : value: string
37 : }
38 :
39 2356 : const CONVERTIBLE_EXPORT_FORMAT_OPTIONS: ExportFormatOption[] = [
40 : { label: 'GLB', value: 'glb' },
41 : { label: 'OBJ', value: 'obj' },
42 : { label: 'STL', value: 'stl' },
43 : { label: 'FBX', value: 'fbx' }
44 : ]
45 :
46 4 : export function getExportFormatOptions(
47 : sourceFormat: string | null | undefined
48 : ): ExportFormatOption[] {
49 4 : const format = sourceFormat?.toLowerCase()
50 4 : if (format && DIRECT_EXPORT_FORMATS.has(format)) {
51 0 : return [{ label: format.toUpperCase(), value: format }]
52 : }
53 4 : return CONVERTIBLE_EXPORT_FORMAT_OPTIONS
54 : }
|