Parcourir la source

TS: Improve exporter files.

Mugen87 il y a 6 ans
Parent
commit
05d59b4a81

+ 14 - 3
examples/jsm/exporters/ColladaExporter.d.ts

@@ -1,7 +1,18 @@
 import { Object3D } from '../../../src/Three';
 
-export class ColladaExporter {
-	constructor();
+export interface ColladaExporterOptions {
+  author?: string;
+  textureDirectory?: string;
+  version?: string;
+}
 
-	parse(object: Object3D, onDone: (res: any) => void, options: object): null;
+export interface ColladaExporterResult {
+  data: string;
+  textures: object[];
+}
+
+export class ColladaExporter {
+  constructor();
+  
+  parse(object: Object3D, onDone: (res: ColladaExporterResult) => void, options: ColladaExporterOptions): ColladaExporterResult | null;
 }

+ 18 - 3
examples/jsm/exporters/GLTFExporter.d.ts

@@ -1,7 +1,22 @@
-import { Object3D } from '../../../src/Three';
+import {
+  Object3D,
+  AnimationClip
+} from '../../../src/Three';
+
+export interface GLTFExporterOptions {
+  binary?: boolean;
+  trs?: boolean;
+  onlyVisible?: boolean;
+  truncateDrawRange?: boolean;
+  embedImages?: boolean;
+  animations?: AnimationClip[];
+  forceIndices?: boolean;
+  forcePowerOfTwoTextures?: boolean;
+  includeCustomExtensions?: boolean;
+}
 
 export class GLTFExporter {
-	constructor();
+  constructor();
 
-	parse(input: Object3D, onCompleted: (gltf: object) => void, options: object): null;
+  parse(input: Object3D, onCompleted: (gltf: object) => void, options: GLTFExporterOptions): void;
 }

+ 7 - 2
examples/jsm/exporters/PLYExporter.d.ts

@@ -1,7 +1,12 @@
 import { Object3D } from '../../../src/Three';
 
+export interface PLYExporterOptions {
+  binary?: boolean;
+  excludeAttributes?: string[];
+}
+
 export class PLYExporter {
-	constructor();
+  constructor();
 
-	parse(object: Object3D, onDone: (res: any) => void, options: object): null;
+  parse(object: Object3D, onDone: (res: string) => void, options: PLYExporterOptions): string | null;
 }

+ 6 - 2
examples/jsm/exporters/STLExporter.d.ts

@@ -1,7 +1,11 @@
 import { Object3D } from '../../../src/Three';
 
+export interface STLExporterOptions {
+  binary?: boolean;
+}
+
 export class STLExporter {
-	constructor();
+  constructor();
 
-	parse(scene: Object3D, options: {});
+  parse(scene: Object3D, options?: STLExporterOptions): string;
 }