24 lines
580 B
TypeScript
24 lines
580 B
TypeScript
import { Object3D } from 'three';
|
|
|
|
export class GLTF {
|
|
static async export<BoolValue = true>(
|
|
input: Object3D,
|
|
binary: BoolValue,
|
|
): Promise<ArrayBuffer>;
|
|
static async export<BoolValue = false>(
|
|
input: Object3D,
|
|
binary: BoolValue,
|
|
): Promise<{ [x: string]: any }>;
|
|
static async export<BoolValue extends boolean>(
|
|
input: Object3D,
|
|
binary?: BoolValue,
|
|
) {
|
|
return import('three/examples/jsm/exporters/GLTFExporter.js').then(
|
|
({ GLTFExporter }) =>
|
|
new GLTFExporter().parseAsync(input, {
|
|
binary,
|
|
}),
|
|
);
|
|
}
|
|
}
|