add three-octree.d.ts and three-ctmloader.d.ts

This commit is contained in:
Chunlei Hou
2017-02-07 22:13:43 +08:00
parent 4033dffa4d
commit b9e1f8fedb
5 changed files with 101 additions and 3 deletions

8
three/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for three.js 0.83
// Project: http://mrdoob.github.com/three.js/
// Definitions by: Kon <http://phyzkit.net/>, Satoru Kimura <https://github.com/gyohk>, Florent Poujol <https://github.com/florentpoujol>, SereznoKot <https://github.com/SereznoKot>
// Definitions by: Kon <http://phyzkit.net/>, Satoru Kimura <https://github.com/gyohk>, Florent Poujol <https://github.com/florentpoujol>, SereznoKot <https://github.com/SereznoKot>, HouChunlei <https://github.com/omni360>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="detector.d.ts" />
@@ -20,6 +20,8 @@
/// <reference path="three-transformcontrols.d.ts" />
/// <reference path="three-vrcontrols.d.ts" />
/// <reference path="three-vreffect.d.ts" />
/// <reference path="three-ctmloader.d.ts" />
/// <reference path="three-octree.d.ts" />
declare namespace THREE {
export const REVISION: string;
@@ -1996,7 +1998,7 @@ declare namespace THREE {
mimeType: MimeType;
path: string;
responseType: string;
withCredentials: string
withCredentials: string
load(url: string, onLoad?: (responseText: string) => void, onProgress?: (request: ProgressEvent) => void, onError?:(event: ErrorEvent) => void): any;
setMimeType(mimeType: MimeType): FileLoader;
@@ -3589,7 +3591,7 @@ declare namespace THREE {
radius: number;
phi: number;
theta: number;
set(radius: number, phi: number, theta: number): Spherical;
clone(): this;
copy(other: this): this;

View File

@@ -0,0 +1,7 @@
/// <reference types="three" />
let _ctmloader = new THREE.CTMLoader();
_ctmloader.load('https://github.com/mrdoob/three.js/blob/master/examples/models/ctm/ben.ctm', (geo: any) => {
console.log(geo.position);
});

View File

@@ -0,0 +1,11 @@
///<reference types="three"/>
let _octree = new THREE.Octree({
underferred: false,
depthMax: Infinity,
objectsThreshold: 8,
overlapPct: 0.15,
});
console.log(_octree.getDepthEnd());

36
three/three-ctmloader.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
// Type definitions for three.js (CTMLoader.js)
// Project: https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/ctm/CTMLoader.js
// Definitions by: Hou Chunlei <https://github.com/omni360>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="three" />
declare namespace THREE {
export class CTMLoader extends THREE.Loader {
constructor();
/**
* load multiple CTM parts defined in JSON.
* @param url(required)
* @param callback(required)
* @param parameters
*/
loadParts(url: string, callback: () => any, parameters?: any): any;
/**
* Load CTMLoader compressed models
* @param url(required)
* @param callback(required)
* @param parameters
*/
load(url: string, callback: () => any, parameters?: any): any;
/**
* create buffergeometry by ctm file.
* @param file(required)
* @param callback(required)
*/
createModel(file: string, callback: () => any): any;
}
}

42
three/three-octree.d.ts vendored Normal file
View File

@@ -0,0 +1,42 @@
// Type definitions for three.js (Octree.js)
// Project: https://github.com/mrdoob/three.js/blob/master/examples/js/Octree.js
// Definitions by: Hou Chunlei <https://github.com/omni360>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="three" />
declare namespace THREE {
export class Octree {
constructor(parameters?: any);
update(): void;
add(object: any, options?: any): any;
addDeferred(object: any, options?: any): any;
addObjectData(object: any, part: any): any;
remove(object: any): any;
extend(octree: Octree): any;
rebuild(): any;
updateObject(object: any): any;
search(position: THREE.Vector3, radius: number, organizeByObject: boolean, direction: THREE.Vector3): any;
setRoot(root: any): any;
getDepthEnd(): number;
getNodeCountEnd(): number;
getObjectCountEnd(): number;
toConsole(): any;
}
}