Browse Source

Introduced new typings for jsm modules.

Asutekku 6 years ago
parent
commit
b46d235d50

+ 7 - 0
examples/jsm/exporters/ColladaExporter.d.ts

@@ -0,0 +1,7 @@
+import {Object3D} from '../../../src/Three';
+
+export class ColladaExporter {
+	constructor();
+
+	parse(object: Object3D, onDone: (res: any) => void, options: object): null;
+}

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

@@ -1,7 +1,7 @@
-import { Object3D } from '../../../src/Three';
+import {Object3D} from '../../../src/Three';
 
 export class GLTFExporter {
-  constructor();
+	constructor();
 
-  parse(input: Object3D, onCompleted: (gltf: object) => void, options: object): null;
+	parse(input: Object3D, onCompleted: (gltf: object) => void, options: object): null;
 }

+ 7 - 0
examples/jsm/exporters/MMDExporter.d.ts

@@ -0,0 +1,7 @@
+import {Object3D} from "../../..";
+
+export class MMDExporter {
+	constructor();
+
+	parseVpd(skin: Object3D, outputShiftJis: boolean, useOriginalBones: boolean): [] | Uint8Array
+}

+ 7 - 0
examples/jsm/exporters/OBJExporter.d.ts

@@ -0,0 +1,7 @@
+import {Object3D} from '../../../src/Three';
+
+export class OBJExporter {
+	constructor();
+
+	parse(object: Object3D): string;
+}

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

@@ -0,0 +1,7 @@
+import {Object3D} from "../../..";
+
+export class PLYExporter {
+	constructor();
+
+	parse(object: Object3D, onDone: (res: any) => void, options: object): null;
+}

+ 7 - 0
examples/jsm/exporters/STLExporter.d.ts

@@ -0,0 +1,7 @@
+import {Object3D} from "../../..";
+
+export class STLExporter {
+	constructor();
+
+	parse(scene: Object3D, options: {});
+}

+ 7 - 0
examples/jsm/exporters/TypedGeometryExporter.d.ts

@@ -0,0 +1,7 @@
+import {Object3D} from "../../..";
+
+export class TypedGeometryExporterD {
+	constructor();
+
+	parse(scene: Object3D, options: {}): DataView | string;
+}

+ 1 - 6
examples/jsm/pmrem/PMREMCubeUVPacker.d.ts

@@ -1,9 +1,4 @@
-import {
-  CubeTexture,
-  Renderer,
-  ShaderMaterial,
-  WebGLRenderTarget
-} from '../../../src/Three';
+import {CubeTexture, Renderer, WebGLRenderTarget} from '../../../src/Three';
 
 export class PMREMCubeUVPacker {
   CubeUVRenderTarget:WebGLRenderTarget;

+ 5 - 0
examples/jsm/utils/MathUtils.d.ts

@@ -0,0 +1,5 @@
+import {Quaternion} from "../../..";
+
+export namespace MathUtils {
+	export function setQuaternionFromProperEuler(q: Quaternion, a: number, b: number, c: number, order: string): void ;
+}

+ 40 - 32
examples/jsm/utils/MathUtils.js

@@ -7,61 +7,69 @@
 
 var MathUtils = {
 
-    setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
 
-        // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
+	/**
+	 * @param {Quaternion} q
+	 * @param {number} a
+	 * @param {number} b
+	 * @param {number} c
+	 * @param {string} order
+	 */
+	setQuaternionFromProperEuler: function (q, a, b, c, order) {
 
-        // rotations are applied to the axes in the order specified by 'order'
-        // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
-        // angles are in radians
+		// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
 
-        var cos = Math.cos;
-        var sin = Math.sin;
+		// rotations are applied to the axes in the order specified by 'order'
+		// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
+		// angles are in radians
 
-        var c2 = cos( b / 2 );
-        var s2 = sin( b / 2 );
+		var cos = Math.cos;
+		var sin = Math.sin;
 
-        var c13 = cos( ( a + c ) / 2 );
-        var s13 = sin( ( a + c ) / 2 );
+		var c2 = cos(b / 2);
+		var s2 = sin(b / 2);
 
-        var c1_3 = cos( ( a - c ) / 2 );
-        var s1_3 = sin( ( a - c ) / 2 );
+		var c13 = cos((a + c) / 2);
+		var s13 = sin((a + c) / 2);
 
-        var c3_1 = cos( ( c - a ) / 2 );
-        var s3_1 = sin( ( c - a ) / 2 );
+		var c1_3 = cos((a - c) / 2);
+		var s1_3 = sin((a - c) / 2);
 
-        if ( order === 'XYX' ) {
+		var c3_1 = cos((c - a) / 2);
+		var s3_1 = sin((c - a) / 2);
 
-            q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
+		if (order === 'XYX') {
 
-        } else if ( order === 'YZY' ) {
+			q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);
 
-            q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
+		} else if (order === 'YZY') {
 
-        } else if ( order === 'ZXZ' ) {
+			q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);
 
-            q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
+		} else if (order === 'ZXZ') {
 
-        } else if ( order === 'XZX' ) {
+			q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);
 
-            q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
+		} else if (order === 'XZX') {
 
-        } else if ( order === 'YXY' ) {
+			q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);
 
-            q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
+		} else if (order === 'YXY') {
 
-        } else if ( order === 'ZYZ' ) {
+			q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);
 
-            q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
+		} else if (order === 'ZYZ') {
 
-        } else {
+			q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);
 
-            console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
+		} else {
 
-        }
+			console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.');
 
-    }
+		}
+
+	}
 
 };
 
-export { MathUtils };
+export {MathUtils};

+ 8 - 0
examples/jsm/utils/ShadowMapViewer.d.ts

@@ -0,0 +1,8 @@
+import {Light} from "../../..";
+
+export class ShadowMapViewer {
+	constructor(light: Light)
+}
+
+
+

+ 32 - 0
examples/jsm/utils/SkeletonUtils.d.ts

@@ -0,0 +1,32 @@
+import {AnimationClip, Bone, Matrix4, Object3D, Skeleton, SkeletonHelper} from "../../..";
+
+export class SkeletonUtils {
+	retarget(target: Object3D | Skeleton,
+					 source: Object3D | Skeleton,
+					 options: {})
+
+	retargetClip(target: Skeleton | Object3D,
+							 source: Skeleton | Object3D,
+							 clip: AnimationClip,
+							 options: {}): AnimationClip;
+
+	getHelperFromSkeleton(skeleton: Skeleton): SkeletonHelper;
+
+	getSkeletonOffsets(target: Object3D | Skeleton,
+										 source: Object3D | Skeleton,
+										 options: {}): Matrix4[];
+
+	renameBones(skeleton: Skeleton, names: {}): any;
+
+	getBones(skeleton: Skeleton | Bone[]): Bone[];
+
+	getBoneByName(name: string, skeleton: Skeleton): Bone;
+
+	getNearestBone(bone: Bone, names: {}): Bone;
+
+	findBoneTrackData(name: string, tracks: any[]): {};
+
+	getEqualsBonesNames(skeleton: Skeleton, targetSkeleton: Skeleton);
+
+	clone(source: Skeleton): Skeleton;
+}

+ 58 - 0
examples/jsm/utils/TypedArrayUtils.d.ts

@@ -0,0 +1,58 @@
+export namespace TypedArrayUtils {
+	export function quicksortIP(arr: any[], eleSize: number, orderElement: number): any[];
+
+
+	export class Kdtree {
+		self: this;
+		root: Node;
+		private maxDepth: number;
+
+		constructor(points: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | Uint8ClampedArray, metric: (a: any, b: any) => number, eleSize: number);
+
+		getPointSet(points: any, pos: number);
+
+		buildTree(): Node;
+
+		getMaxDepth(): number;
+
+		nearest(point: [], maxNodes: number, maxDistance: number): any[];
+
+	}
+
+	export namespace Kdtree {
+		export class Node {
+			obj: any;
+			left: Node | null;
+			right: Node | null;
+			parent: Node;
+			depth: number;
+			pos: any;
+
+			constructor(obj: any, depth: number, parent: Node, pos: any)
+		}
+
+
+		export class BinaryHeap {
+			content: any[];
+			scoreFunction: () => any;
+
+			constructor(scoreFunction?: () => any);
+		}
+
+		export namespace BinaryHeap {
+			export function push(element: any): void;
+
+			export function pop(): any;
+
+			export function peek(): any;
+
+			export function remove(node: any): any;
+
+			export function size(): number;
+
+			export function bubbleUp(n: number): void;
+
+			export function sinkDown(n: number): void;
+		}
+	}
+}

+ 3 - 0
examples/jsm/utils/UVsDebug.d.ts

@@ -0,0 +1,3 @@
+import {Geometry} from "../../..";
+
+export function UVsDebug(geometry: Geometry, size: number): HTMLCanvasElement;