threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
122 lines • 4.08 kB
TypeScript
import { GLTFExporter, GLTFExporterPlugin } from 'three/examples/jsm/exporters/GLTFExporter.js';
import { IExportWriter } 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;
_basePath?: string;
[key: string]: any;
}
/**
* GLTFExporter2 is an improved version of the three.js GLTFExporter with support for:
* - glb encryption
* - embedding image previews
* - saving external image references in extras
* - saving viewer config (scene settings)
* - various optimizations and bug fixes
*/
export declare class GLTFExporter2 extends GLTFExporter implements IExportWriter {
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: ((writer: GLTFWriter2) => GLTFExporterPlugin)[];
setup(viewer: ThreeViewer, extraExtensions?: ((writer: GLTFWriter2) => GLTFExporterPlugin)[]): this;
gltfViewerWriter(viewer: ThreeViewer): (writer: GLTFWriter2) => GLTFExporterPlugin;
}
declare module 'three' {
interface AnimationClip {
/**
* Whether to export this animation in glTF format.
* @default true
*/
__gltfExport?: boolean;
userData: {
clipActions?: Record<string, any[]>;
[key: string]: any;
};
}
}
//# sourceMappingURL=../../src/assetmanager/export/GLTFExporter2.d.ts.map