diff --git a/types/three/index.d.ts b/types/three/index.d.ts index b8c5b5669f..17156bed94 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -25,5 +25,7 @@ export * from "./three-trackballcontrols"; export * from "./three-transformcontrols"; export * from "./three-vrcontrols"; export * from "./three-vreffect"; +export * from "./three-objloader"; +export * from "./three-mtlloader"; -export as namespace THREE; \ No newline at end of file +export as namespace THREE; diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 5679c4e8c7..ea0e6f917c 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -1355,7 +1355,7 @@ export class Geometry extends EventDispatcher { */ computeBoundingSphere(): void; - merge(geometry: Geometry, matrix: Matrix, materialIndexOffset?: number): void; + merge(geometry: Geometry, matrix?: Matrix, materialIndexOffset?: number): void; mergeMesh(mesh: Mesh): void; @@ -1605,6 +1605,18 @@ export class Object3D extends EventDispatcher { */ userData: any; + /** + * Calls before rendering object + */ + onBeforeRender: (renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.Geometry | THREE.BufferGeometry, + material: THREE.Material, group: THREE.Group) => any; + + /** + * Calls after rendering object + */ + onAfterRender: (renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.Geometry | THREE.BufferGeometry, + material: THREE.Material, group: THREE.Group) => any; + /** * */ @@ -1706,7 +1718,7 @@ export class Object3D extends EventDispatcher { /** * Adds object as child of this object. */ - add(object: Object3D): void; + add(...object: Object3D[]): void; /** * Removes object as child of this object. @@ -2796,9 +2808,12 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial { export class MultiMaterial extends Material { constructor(materials?: Material[]); + isMultiMaterial: true; + materials: Material[]; toJSON(meta: any): any; + } /** diff --git a/types/three/three-examples.d.ts b/types/three/three-examples.d.ts index d416757b00..67efcc566a 100644 --- a/types/three/three-examples.d.ts +++ b/types/three/three-examples.d.ts @@ -3,7 +3,6 @@ import {EventDispatcher, Shader} from "./three-core"; export var AWDLoader: any; -export var OBJLoader: any; export var OBJLoader2: any; export var STLLoader: any; export var FlyControls: any; diff --git a/types/three/three-mtlloader.d.ts b/types/three/three-mtlloader.d.ts new file mode 100644 index 0000000000..5113d67df2 --- /dev/null +++ b/types/three/three-mtlloader.d.ts @@ -0,0 +1,52 @@ + +import {Material} from "./three-core"; +import {LoadingManager} from "./three-core"; +import {EventDispatcher} from "./three-core"; +import {BufferGeometry} from "./three-core"; +import {Texture} from "./three-core"; + +export class MTLLoader extends EventDispatcher { + + constructor(manager?: LoadingManager); + manager: LoadingManager; + materialOptions: {}; + materials: Material[]; + path: string; + texturePath: string; + crossOrigin: boolean; + + load(url: string, onLoad: (materialCreator: MaterialCreator) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; + parse(text: string) : MaterialCreator; + setPath(path: string) : void; + setTexturePath(path: string) : void; + setBaseUrl(path: string) : void; + setCrossOrigin(value: boolean) : void; + setMaterialOptions(value: any) : void; +} + +export class MaterialCreator { + + constructor(baseUrl?: string, options?: any); + + baseUrl : string; + options : any; + materialsInfo : any; + materials : any; + materialsArray : Material[]; + nameLookup : any; + side : number; + wrap : number; + + setCrossOrigin( value: boolean ) : void; + setManager( value: any ) : void; + setMaterials( materialsInfo: any ) : void; + convert( materialsInfo: any ) : any; + preload() : void; + getIndex( materialName: string ) : Material; + getAsArray() : Material[]; + create( materialName: string ) : Material; + createMaterial_( materialName: string ) : Material; + getTextureParams( value: string, matParams: any ) : any; + loadTexture(url: string, mapping: any, onLoad: (bufferGeometry: BufferGeometry) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): Texture; + +} diff --git a/types/three/three-objloader.d.ts b/types/three/three-objloader.d.ts new file mode 100644 index 0000000000..25a3adf93f --- /dev/null +++ b/types/three/three-objloader.d.ts @@ -0,0 +1,21 @@ + +import {Material} from "./three-core"; +import {LoadingManager} from "./three-core"; +import {Group} from "./three-core"; +import {MaterialCreator} from "./three-mtlloader"; + +export class OBJLoader { + + constructor(manager?: LoadingManager); + manager: LoadingManager; + regexp: any; + materials: Material[]; + path: string; + + load(url: string, onLoad: (group: Group) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; + parse(data: string) : Group; + setPath(value: string) : void; + setMaterials(materials: MaterialCreator) : void; + _createParserState() : any; + +}