threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
100 lines • 3.43 kB
TypeScript
import { GLTFExporter, GLTFExporterPlugin } from 'three/examples/jsm/exporters/GLTFExporter.js';
import { IExportParser } from '../IExporter';
import { GLTFWriter2 } from './GLTFWriter2';
import { AnimationClip, Object3D } from 'three';
import { ThreeViewer } from '../../viewer';
export interface GLTFExporter2Options {
/**
* embed images in glb even when remote url is available
* @default false
*/
embedUrlImages?: boolean;
/**
* Embed previews of images in glb
* @default false
*/
embedUrlImagePreviews?: boolean;
/**
* export viewer config (scene settings)
*/
viewerConfig?: boolean;
/**
* Extension to export to, default for object/scene = glb
*/
exportExt?: string;
preserveUUIDs?: boolean;
/**
* see GLTFDracoExporter and {@link GLTFMaterialExtrasExtension}
*/
externalImagesInExtras?: boolean;
/**
* see GLTFViewerExport->processViewer
* @default false
*/
encodeUint16Rgbe?: boolean;
/**
* Number of spaces to use when exporting to json
* @default 2
*/
jsonSpaces?: number;
/**
* Encrypt the exported file in a GLB container using {@link encryptKey}
* @default false.
* Works only for glb export.
*/
encrypt?: boolean;
/**
* Encryption key, if not provided, will be prompted
* @default undefined.
* Works only for glb export.
*/
encryptKey?: string | Uint8Array;
/**
* Export position, rotation and scale instead of matrix per node.
* Default is false
*/
trs?: boolean;
/**
* Export only visible objects.
* Default is false.
*/
onlyVisible?: boolean;
/**
* Export just the attributes within the drawRange, if defined, instead of exporting the whole array.
* Default is true.
*/
truncateDrawRange?: boolean;
/**
* Restricts the image maximum size (both width and height) to the given value. This option works only if embedImages is true.
* Default is Infinity.
*/
maxTextureSize?: number;
/**
* List of animations to be included in the export.
*/
animations?: AnimationClip[];
/**
* Generate indices for non-index geometry and export with them.
* Default is false.
*/
forceIndices?: boolean;
/**
* Export custom glTF extensions defined on an object's userData.gltfExtensions property.
* Default is true.
*/
includeCustomExtensions?: boolean;
[key: string]: any;
}
export declare class GLTFExporter2 extends GLTFExporter implements IExportParser {
constructor();
register(callback: (writer: GLTFWriter2) => GLTFExporterPlugin): this;
processors: ((obj: ArrayBuffer | any | Blob, options: GLTFExporter2Options) => Promise<ArrayBuffer | any | Blob>)[];
parseAsync(obj: ArrayBuffer | any, options: GLTFExporter2Options): Promise<Blob>;
parse(input: Object3D | Object3D[], onDone: (gltf: ArrayBuffer | {
[key: string]: any;
}) => void, onError: (error: ErrorEvent) => void, options?: GLTFExporter2Options): void;
static ExportExtensions: ((parser: GLTFWriter2) => GLTFExporterPlugin)[];
setup(viewer: ThreeViewer, extraExtensions?: ((parser: GLTFWriter2) => GLTFExporterPlugin)[]): this;
gltfViewerWriter(viewer: ThreeViewer): (parser: GLTFWriter2) => GLTFExporterPlugin;
}
//# sourceMappingURL=GLTFExporter2.d.ts.map