From 5c555a33ffed9d48b02c5d9561a2ccda68faaa3e Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 30 Jul 2023 14:06:48 -0400 Subject: [PATCH 1/4] Loader updates --- .../three/examples/jsm/loaders/3DMLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/3MFLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/AMFLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/BVHLoader.d.ts | 9 +--- .../jsm/loaders/BasisTextureLoader.d.ts | 9 +--- .../examples/jsm/loaders/ColladaLoader.d.ts | 9 +--- .../examples/jsm/loaders/DRACOLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/FBXLoader.d.ts | 9 +--- .../examples/jsm/loaders/FontLoader.d.ts | 9 +--- .../examples/jsm/loaders/GCodeLoader.d.ts | 9 +--- .../examples/jsm/loaders/GLTFLoader.d.ts | 10 +---- .../jsm/loaders/HDRCubeTextureLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/IFCLoader.d.ts | 10 +---- .../three/examples/jsm/loaders/KMZLoader.d.ts | 9 +--- .../examples/jsm/loaders/LDrawLoader.d.ts | 9 +--- .../examples/jsm/loaders/LUT3dlLoader.d.ts | 9 +--- .../examples/jsm/loaders/LUTCubeLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/LWOLoader.d.ts | 9 +--- .../examples/jsm/loaders/LottieLoader.d.ts | 10 +---- .../three/examples/jsm/loaders/MD2Loader.d.ts | 9 +--- .../three/examples/jsm/loaders/MDDLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/MMDLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/MTLLoader.d.ts | 10 +---- .../examples/jsm/loaders/NRRDLoader.d.ts | 8 +--- .../three/examples/jsm/loaders/OBJLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/PCDLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/PDBLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/PLYLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/STLLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/SVGLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/TDSLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/TGALoader.d.ts | 7 --- .../three/examples/jsm/loaders/TTFLoader.d.ts | 9 +--- .../examples/jsm/loaders/TiltLoader.d.ts | 9 +--- .../examples/jsm/loaders/USDZLoader.d.ts | 10 +---- .../three/examples/jsm/loaders/VOXLoader.d.ts | 9 +--- .../examples/jsm/loaders/VRMLLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/VTKLoader.d.ts | 9 +--- .../three/examples/jsm/loaders/XYZLoader.d.ts | 9 +--- .../jsm/nodes/loaders/NodeLoader.d.ts | 10 +---- types/three/src/loaders/AnimationLoader.d.ts | 13 ++---- types/three/src/loaders/AudioLoader.d.ts | 11 +---- .../src/loaders/BufferGeometryLoader.d.ts | 14 +----- .../src/loaders/CompressedTextureLoader.d.ts | 11 +---- .../three/src/loaders/CubeTextureLoader.d.ts | 11 +---- .../three/src/loaders/DataTextureLoader.d.ts | 9 ++-- types/three/src/loaders/FileLoader.d.ts | 9 +--- .../three/src/loaders/ImageBitmapLoader.d.ts | 10 +---- types/three/src/loaders/ImageLoader.d.ts | 11 +---- types/three/src/loaders/Loader.d.ts | 14 +++--- types/three/src/loaders/MaterialLoader.d.ts | 11 +---- types/three/src/loaders/ObjectLoader.d.ts | 44 +++++++------------ types/three/src/loaders/TextureLoader.d.ts | 11 +---- 53 files changed, 80 insertions(+), 462 deletions(-) diff --git a/types/three/examples/jsm/loaders/3DMLoader.d.ts b/types/three/examples/jsm/loaders/3DMLoader.d.ts index cebbd2a42..13eac0e92 100644 --- a/types/three/examples/jsm/loaders/3DMLoader.d.ts +++ b/types/three/examples/jsm/loaders/3DMLoader.d.ts @@ -1,15 +1,8 @@ import { Loader, LoadingManager, Object3D } from '../../../src/Three.js'; -export class Rhino3dmLoader extends Loader { +export class Rhino3dmLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (object: Object3D) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBufferLike, onLoad: (object: Object3D) => void, onError?: (event: ErrorEvent) => void): void; setLibraryPath(path: string): Rhino3dmLoader; setWorkerLimit(workerLimit: number): Rhino3dmLoader; diff --git a/types/three/examples/jsm/loaders/3MFLoader.d.ts b/types/three/examples/jsm/loaders/3MFLoader.d.ts index ef25efee2..6cf8fd623 100644 --- a/types/three/examples/jsm/loaders/3MFLoader.d.ts +++ b/types/three/examples/jsm/loaders/3MFLoader.d.ts @@ -1,16 +1,9 @@ import { Loader, LoadingManager, Group } from '../../../src/Three.js'; -export class ThreeMFLoader extends Loader { +export class ThreeMFLoader extends Loader { constructor(manager?: LoadingManager); availableExtensions: object[]; - load( - url: string, - onLoad: (object: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): Group; addExtension(extension: object): void; } diff --git a/types/three/examples/jsm/loaders/AMFLoader.d.ts b/types/three/examples/jsm/loaders/AMFLoader.d.ts index 9a632166f..b2b6e4bb0 100644 --- a/types/three/examples/jsm/loaders/AMFLoader.d.ts +++ b/types/three/examples/jsm/loaders/AMFLoader.d.ts @@ -1,14 +1,7 @@ import { Loader, LoadingManager, Group } from '../../../src/Three.js'; -export class AMFLoader extends Loader { +export class AMFLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (object: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): Group; } diff --git a/types/three/examples/jsm/loaders/BVHLoader.d.ts b/types/three/examples/jsm/loaders/BVHLoader.d.ts index 92f77ca45..9247a802f 100644 --- a/types/three/examples/jsm/loaders/BVHLoader.d.ts +++ b/types/three/examples/jsm/loaders/BVHLoader.d.ts @@ -5,17 +5,10 @@ export interface BVH { skeleton: Skeleton; } -export class BVHLoader extends Loader { +export class BVHLoader extends Loader { constructor(manager?: LoadingManager); animateBonePositions: boolean; animateBoneRotations: boolean; - load( - url: string, - onLoad: (bvh: BVH) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(text: string): BVH; } diff --git a/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts b/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts index 13921fa74..8ec17c7a2 100644 --- a/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts +++ b/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts @@ -1,6 +1,6 @@ import { CompressedTexture, Loader, LoadingManager, WebGLRenderer } from '../../../src/Three.js'; -export class BasisTextureLoader extends Loader { +export class BasisTextureLoader extends Loader { constructor(manager?: LoadingManager); transcoderBinary: ArrayBuffer | null; transcoderPath: string; @@ -19,13 +19,6 @@ export class BasisTextureLoader extends Loader { workerSourceURL: string; detectSupport(renderer: WebGLRenderer): this; - load( - url: string, - onLoad: (texture: CompressedTexture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; setTranscoderPath(path: string): this; setWorkerLimit(workerLimit: number): this; dispose(): void; diff --git a/types/three/examples/jsm/loaders/ColladaLoader.d.ts b/types/three/examples/jsm/loaders/ColladaLoader.d.ts index 0debbc804..1ad69c638 100644 --- a/types/three/examples/jsm/loaders/ColladaLoader.d.ts +++ b/types/three/examples/jsm/loaders/ColladaLoader.d.ts @@ -6,15 +6,8 @@ export interface Collada { scene: Scene; } -export class ColladaLoader extends Loader { +export class ColladaLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (collada: Collada) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(text: string, path: string): Collada; } diff --git a/types/three/examples/jsm/loaders/DRACOLoader.d.ts b/types/three/examples/jsm/loaders/DRACOLoader.d.ts index c75572f42..88fe78f52 100644 --- a/types/three/examples/jsm/loaders/DRACOLoader.d.ts +++ b/types/three/examples/jsm/loaders/DRACOLoader.d.ts @@ -1,15 +1,8 @@ import { Loader, LoadingManager, BufferGeometry } from '../../../src/Three.js'; -export class DRACOLoader extends Loader { +export class DRACOLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (geometry: BufferGeometry) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; setDecoderPath(path: string): DRACOLoader; setDecoderConfig(config: object): DRACOLoader; setWorkerLimit(workerLimit: number): DRACOLoader; diff --git a/types/three/examples/jsm/loaders/FBXLoader.d.ts b/types/three/examples/jsm/loaders/FBXLoader.d.ts index cda4d30f4..47c4db364 100644 --- a/types/three/examples/jsm/loaders/FBXLoader.d.ts +++ b/types/three/examples/jsm/loaders/FBXLoader.d.ts @@ -1,14 +1,7 @@ import { Group, Loader, LoadingManager } from '../../../src/Three.js'; -export class FBXLoader extends Loader { +export class FBXLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (object: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(FBXBuffer: ArrayBuffer | string, path: string): Group; } diff --git a/types/three/examples/jsm/loaders/FontLoader.d.ts b/types/three/examples/jsm/loaders/FontLoader.d.ts index 6b04d2cd6..d44309bd3 100644 --- a/types/three/examples/jsm/loaders/FontLoader.d.ts +++ b/types/three/examples/jsm/loaders/FontLoader.d.ts @@ -1,15 +1,8 @@ import { Shape, Loader, LoadingManager } from '../../../src/Three.js'; -export class FontLoader extends Loader { +export class FontLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad?: (responseFont: Font) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(json: any): Font; } diff --git a/types/three/examples/jsm/loaders/GCodeLoader.d.ts b/types/three/examples/jsm/loaders/GCodeLoader.d.ts index 7ac8f7206..0b0388c08 100644 --- a/types/three/examples/jsm/loaders/GCodeLoader.d.ts +++ b/types/three/examples/jsm/loaders/GCodeLoader.d.ts @@ -1,15 +1,8 @@ import { Group, Loader, LoadingManager } from '../../../src/Three.js'; -export class GCodeLoader extends Loader { +export class GCodeLoader extends Loader { constructor(manager?: LoadingManager); splitLayer: boolean; - load( - url: string, - onLoad: (object: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: string): Group; } diff --git a/types/three/examples/jsm/loaders/GLTFLoader.d.ts b/types/three/examples/jsm/loaders/GLTFLoader.d.ts index 5f1592a45..21b112551 100644 --- a/types/three/examples/jsm/loaders/GLTFLoader.d.ts +++ b/types/three/examples/jsm/loaders/GLTFLoader.d.ts @@ -39,18 +39,10 @@ export interface GLTF { userData: any; } -export class GLTFLoader extends Loader { +export class GLTFLoader extends Loader { constructor(manager?: LoadingManager); dracoLoader: DRACOLoader | null; - load( - url: string, - onLoad: (gltf: GLTF) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; - setDRACOLoader(dracoLoader: DRACOLoader): GLTFLoader; register(callback: (parser: GLTFParser) => GLTFLoaderPlugin): GLTFLoader; diff --git a/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts b/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts index f8ce9b862..fe605eb44 100644 --- a/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +++ b/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts @@ -2,17 +2,10 @@ import { CubeTexture, Loader, LoadingManager, TextureDataType } from '../../../s import { RGBELoader } from './RGBELoader.js'; -export class HDRCubeTextureLoader extends Loader { +export class HDRCubeTextureLoader extends Loader { constructor(manager?: LoadingManager); hdrLoader: RGBELoader; type: TextureDataType; - load( - urls: string[], - onLoad: (texture: CubeTexture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): CubeTexture; - loadAsync(urls: string[], onProgress?: (event: ProgressEvent) => void): Promise; setDataType(type: TextureDataType): this; } diff --git a/types/three/examples/jsm/loaders/IFCLoader.d.ts b/types/three/examples/jsm/loaders/IFCLoader.d.ts index 7d278d23b..b2893ab62 100644 --- a/types/three/examples/jsm/loaders/IFCLoader.d.ts +++ b/types/three/examples/jsm/loaders/IFCLoader.d.ts @@ -9,19 +9,11 @@ import { BufferAttribute, } from '../../../src/Three.js'; -declare class IFCLoader extends Loader { +declare class IFCLoader extends Loader { ifcManager: IFCManager; constructor(manager?: LoadingManager); - load( - url: any, - onLoad: (ifc: IFCModel) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; - parse(buffer: ArrayBuffer): Promise; } diff --git a/types/three/examples/jsm/loaders/KMZLoader.d.ts b/types/three/examples/jsm/loaders/KMZLoader.d.ts index 230cd3611..be87bbba8 100644 --- a/types/three/examples/jsm/loaders/KMZLoader.d.ts +++ b/types/three/examples/jsm/loaders/KMZLoader.d.ts @@ -2,15 +2,8 @@ import { Loader, LoadingManager } from '../../../src/Three.js'; import { Collada } from './ColladaLoader.js'; -export class KMZLoader extends Loader { +export class KMZLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (kmz: Collada) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): Collada; } diff --git a/types/three/examples/jsm/loaders/LDrawLoader.d.ts b/types/three/examples/jsm/loaders/LDrawLoader.d.ts index 2b371426f..178f08c5c 100644 --- a/types/three/examples/jsm/loaders/LDrawLoader.d.ts +++ b/types/three/examples/jsm/loaders/LDrawLoader.d.ts @@ -1,6 +1,6 @@ import { Loader, LoadingManager, Group, Material } from '../../../src/Three.js'; -export class LDrawLoader extends Loader { +export class LDrawLoader extends Loader { materials: Material[]; materialsLibrary: Record; fileMap: Record; @@ -8,13 +8,6 @@ export class LDrawLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (data: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; preloadMaterials(url: string): Promise; setFileMap(fileMap: Record): void; setMaterials(materials: Material[]): void; diff --git a/types/three/examples/jsm/loaders/LUT3dlLoader.d.ts b/types/three/examples/jsm/loaders/LUT3dlLoader.d.ts index d2d0dde60..31c8e3769 100644 --- a/types/three/examples/jsm/loaders/LUT3dlLoader.d.ts +++ b/types/three/examples/jsm/loaders/LUT3dlLoader.d.ts @@ -6,15 +6,8 @@ export interface LUT3dlResult { texture3D: Data3DTexture; } -export class LUT3dlLoader extends Loader { +export class LUT3dlLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (result: LUT3dlResult) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: Error) => void, - ): any; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: string): LUT3dlResult; } diff --git a/types/three/examples/jsm/loaders/LUTCubeLoader.d.ts b/types/three/examples/jsm/loaders/LUTCubeLoader.d.ts index 0a72f0e36..0888be932 100644 --- a/types/three/examples/jsm/loaders/LUTCubeLoader.d.ts +++ b/types/three/examples/jsm/loaders/LUTCubeLoader.d.ts @@ -9,15 +9,8 @@ export interface LUTCubeResult { texture3D: Data3DTexture; } -export class LUTCubeLoader extends Loader { +export class LUTCubeLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (result: LUTCubeResult) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: Error) => void, - ): any; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: string): LUTCubeResult; } diff --git a/types/three/examples/jsm/loaders/LWOLoader.d.ts b/types/three/examples/jsm/loaders/LWOLoader.d.ts index 4ae796892..2898488cb 100644 --- a/types/three/examples/jsm/loaders/LWOLoader.d.ts +++ b/types/three/examples/jsm/loaders/LWOLoader.d.ts @@ -12,15 +12,8 @@ export interface LWOLoaderParameters { resourcePath?: string; } -export class LWOLoader extends Loader { +export class LWOLoader extends Loader { constructor(manager?: LoadingManager, parameters?: LWOLoaderParameters); - load( - url: string, - onLoad: (lwo: LWO) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer, path: string, modelName: string): LWO; } diff --git a/types/three/examples/jsm/loaders/LottieLoader.d.ts b/types/three/examples/jsm/loaders/LottieLoader.d.ts index 34017a598..9f5b96dbb 100644 --- a/types/three/examples/jsm/loaders/LottieLoader.d.ts +++ b/types/three/examples/jsm/loaders/LottieLoader.d.ts @@ -1,15 +1,7 @@ import { CanvasTexture, Loader, LoadingManager } from '../../../src/Three.js'; -export class LottieLoader extends Loader { +export class LottieLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (texture: CanvasTexture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; - setQuality(value: number): void; } diff --git a/types/three/examples/jsm/loaders/MD2Loader.d.ts b/types/three/examples/jsm/loaders/MD2Loader.d.ts index c6d559f1f..72077fc86 100644 --- a/types/three/examples/jsm/loaders/MD2Loader.d.ts +++ b/types/three/examples/jsm/loaders/MD2Loader.d.ts @@ -1,14 +1,7 @@ import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js'; -export class MD2Loader extends Loader { +export class MD2Loader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (geometry: BufferGeometry) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): BufferGeometry; } diff --git a/types/three/examples/jsm/loaders/MDDLoader.d.ts b/types/three/examples/jsm/loaders/MDDLoader.d.ts index 06759a4ce..086d6c089 100644 --- a/types/three/examples/jsm/loaders/MDDLoader.d.ts +++ b/types/three/examples/jsm/loaders/MDDLoader.d.ts @@ -5,15 +5,8 @@ export interface MDD { clip: AnimationClip; } -export class MDDLoader extends Loader { +export class MDDLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (result: MDD) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): MDD; } diff --git a/types/three/examples/jsm/loaders/MMDLoader.d.ts b/types/three/examples/jsm/loaders/MMDLoader.d.ts index 09baaa17e..b57ac069a 100644 --- a/types/three/examples/jsm/loaders/MMDLoader.d.ts +++ b/types/three/examples/jsm/loaders/MMDLoader.d.ts @@ -5,7 +5,7 @@ export interface MMDLoaderAnimationObject { mesh: SkinnedMesh; } -export class MMDLoader extends Loader { +export class MMDLoader extends Loader { constructor(manager?: LoadingManager); animationBuilder: object; animationPath: string; @@ -13,13 +13,6 @@ export class MMDLoader extends Loader { meshBuilder: object; parser: object | null; - load( - url: string, - onLoad: (mesh: SkinnedMesh) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; loadAnimation( url: string, object: SkinnedMesh | Camera, diff --git a/types/three/examples/jsm/loaders/MTLLoader.d.ts b/types/three/examples/jsm/loaders/MTLLoader.d.ts index ad091c927..3b3c14a68 100644 --- a/types/three/examples/jsm/loaders/MTLLoader.d.ts +++ b/types/three/examples/jsm/loaders/MTLLoader.d.ts @@ -39,20 +39,12 @@ export interface MaterialCreatorOptions { invertTrProperty?: boolean | undefined; } -export class MTLLoader extends Loader { +export class MTLLoader extends Loader { constructor(manager?: LoadingManager); materialOptions: MaterialCreatorOptions; - load( - url: string, - onLoad: (materialCreator: MTLLoader.MaterialCreator) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; parse(text: string, path: string): MTLLoader.MaterialCreator; setMaterialOptions(value: MaterialCreatorOptions): void; - - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } export interface MaterialInfo { diff --git a/types/three/examples/jsm/loaders/NRRDLoader.d.ts b/types/three/examples/jsm/loaders/NRRDLoader.d.ts index 58f7a6552..c2923235c 100644 --- a/types/three/examples/jsm/loaders/NRRDLoader.d.ts +++ b/types/three/examples/jsm/loaders/NRRDLoader.d.ts @@ -2,19 +2,13 @@ import { Loader, LoadingManager } from '../../../src/Three.js'; import { Volume } from '../misc/Volume.js'; -export class NRRDLoader extends Loader { +export class NRRDLoader extends Loader { constructor(manager?: LoadingManager); manager: LoadingManager; path: string; fieldFunctions: object; - load( - url: string, - onLoad: (group: Volume) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; parse(data: string): Volume; parseChars(array: number[], start?: number, end?: number): string; setPath(value: string): this; diff --git a/types/three/examples/jsm/loaders/OBJLoader.d.ts b/types/three/examples/jsm/loaders/OBJLoader.d.ts index d7a789249..017220795 100644 --- a/types/three/examples/jsm/loaders/OBJLoader.d.ts +++ b/types/three/examples/jsm/loaders/OBJLoader.d.ts @@ -1,17 +1,10 @@ import { Loader, LoadingManager, Group } from '../../../src/Three.js'; import { MTLLoader } from './MTLLoader.js'; -export class OBJLoader extends Loader { +export class OBJLoader extends Loader { constructor(manager?: LoadingManager); materials: MTLLoader.MaterialCreator; - load( - url: string, - onLoad: (group: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: string): Group; setMaterials(materials: MTLLoader.MaterialCreator): this; } diff --git a/types/three/examples/jsm/loaders/PCDLoader.d.ts b/types/three/examples/jsm/loaders/PCDLoader.d.ts index 904907de3..4974cd935 100644 --- a/types/three/examples/jsm/loaders/PCDLoader.d.ts +++ b/types/three/examples/jsm/loaders/PCDLoader.d.ts @@ -1,15 +1,8 @@ import { Points, Loader, LoadingManager } from '../../../src/Three.js'; -export class PCDLoader extends Loader { +export class PCDLoader extends Loader { constructor(manager?: LoadingManager); littleEndian: boolean; - load( - url: string, - onLoad: (points: Points) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer | string): Points; } diff --git a/types/three/examples/jsm/loaders/PDBLoader.d.ts b/types/three/examples/jsm/loaders/PDBLoader.d.ts index b33cd8a99..8751eaac8 100644 --- a/types/three/examples/jsm/loaders/PDBLoader.d.ts +++ b/types/three/examples/jsm/loaders/PDBLoader.d.ts @@ -8,15 +8,8 @@ export interface PDB { }; } -export class PDBLoader extends Loader { +export class PDBLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (pdb: PDB) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(text: string): PDB; } diff --git a/types/three/examples/jsm/loaders/PLYLoader.d.ts b/types/three/examples/jsm/loaders/PLYLoader.d.ts index 5cdd1a26f..37e02cd47 100644 --- a/types/three/examples/jsm/loaders/PLYLoader.d.ts +++ b/types/three/examples/jsm/loaders/PLYLoader.d.ts @@ -1,17 +1,10 @@ import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js'; -export class PLYLoader extends Loader { +export class PLYLoader extends Loader { constructor(manager?: LoadingManager); propertyNameMapping: object; customPropertyMapping: Record; - load( - url: string, - onLoad: (geometry: BufferGeometry) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; setPropertyNameMapping(mapping: object): void; setCustomPropertyNameMapping(mapping: Record): void; parse(data: ArrayBuffer | string): BufferGeometry; diff --git a/types/three/examples/jsm/loaders/STLLoader.d.ts b/types/three/examples/jsm/loaders/STLLoader.d.ts index 691ef8c4f..6cbe99825 100644 --- a/types/three/examples/jsm/loaders/STLLoader.d.ts +++ b/types/three/examples/jsm/loaders/STLLoader.d.ts @@ -1,14 +1,7 @@ import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js'; -export class STLLoader extends Loader { +export class STLLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (geometry: BufferGeometry) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer | string): BufferGeometry; } diff --git a/types/three/examples/jsm/loaders/SVGLoader.d.ts b/types/three/examples/jsm/loaders/SVGLoader.d.ts index cc266e7f1..ccc8ea586 100644 --- a/types/three/examples/jsm/loaders/SVGLoader.d.ts +++ b/types/three/examples/jsm/loaders/SVGLoader.d.ts @@ -21,19 +21,12 @@ export interface StrokeStyle { strokeMiterLimit: number; } -export class SVGLoader extends Loader { +export class SVGLoader extends Loader { constructor(manager?: LoadingManager); defaultDPI: number; defaultUnit: string; - load( - url: string, - onLoad: (data: SVGResult) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(text: string): SVGResult; static getStrokeStyle( diff --git a/types/three/examples/jsm/loaders/TDSLoader.d.ts b/types/three/examples/jsm/loaders/TDSLoader.d.ts index 6efec915a..b104ff89c 100644 --- a/types/three/examples/jsm/loaders/TDSLoader.d.ts +++ b/types/three/examples/jsm/loaders/TDSLoader.d.ts @@ -1,6 +1,6 @@ import { Color, Group, Loader, LoadingManager, Material, Mesh, Texture } from '../../../src/Three.js'; -export class TDSLoader extends Loader { +export class TDSLoader extends Loader { constructor(manager?: LoadingManager); debug: boolean; group: Group; @@ -9,13 +9,6 @@ export class TDSLoader extends Loader { meshes: Mesh[]; position: number; - load( - url: string, - onLoad: (object: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(arraybuffer: ArrayBuffer, path: string): Group; debugMessage(message: object): void; diff --git a/types/three/examples/jsm/loaders/TGALoader.d.ts b/types/three/examples/jsm/loaders/TGALoader.d.ts index 63cbfe7f4..38c250209 100644 --- a/types/three/examples/jsm/loaders/TGALoader.d.ts +++ b/types/three/examples/jsm/loaders/TGALoader.d.ts @@ -3,12 +3,5 @@ import { DataTexture, DataTextureLoader, LoadingManager } from '../../../src/Thr export class TGALoader extends DataTextureLoader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad?: (texture: DataTexture, texData: object) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): DataTexture; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): DataTexture; } diff --git a/types/three/examples/jsm/loaders/TTFLoader.d.ts b/types/three/examples/jsm/loaders/TTFLoader.d.ts index c572dccca..ad1be6d7f 100644 --- a/types/three/examples/jsm/loaders/TTFLoader.d.ts +++ b/types/three/examples/jsm/loaders/TTFLoader.d.ts @@ -1,15 +1,8 @@ import { Loader, LoadingManager } from '../../../src/Three.js'; -export class TTFLoader extends Loader { +export class TTFLoader extends Loader { constructor(manager?: LoadingManager); reversed: boolean; - load( - url: string, - onLoad: (json: object) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(arraybuffer: ArrayBuffer): object; } diff --git a/types/three/examples/jsm/loaders/TiltLoader.d.ts b/types/three/examples/jsm/loaders/TiltLoader.d.ts index b79301d85..00900250a 100644 --- a/types/three/examples/jsm/loaders/TiltLoader.d.ts +++ b/types/three/examples/jsm/loaders/TiltLoader.d.ts @@ -1,14 +1,7 @@ import { Loader, LoadingManager, Group } from '../../../src/Three.js'; -export class TiltLoader extends Loader { +export class TiltLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (object: Group) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): Group; } diff --git a/types/three/examples/jsm/loaders/USDZLoader.d.ts b/types/three/examples/jsm/loaders/USDZLoader.d.ts index 370afcd7e..bd8adbcca 100644 --- a/types/three/examples/jsm/loaders/USDZLoader.d.ts +++ b/types/three/examples/jsm/loaders/USDZLoader.d.ts @@ -4,16 +4,8 @@ export class USDAParser { parse(text: string): object; } -export class USDZLoader extends Loader { +export class USDZLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (usdz: Mesh) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; - parse(buffer: ArrayBuffer | string): THREE.Group; } diff --git a/types/three/examples/jsm/loaders/VOXLoader.d.ts b/types/three/examples/jsm/loaders/VOXLoader.d.ts index 23df18758..9f0ba50ae 100644 --- a/types/three/examples/jsm/loaders/VOXLoader.d.ts +++ b/types/three/examples/jsm/loaders/VOXLoader.d.ts @@ -6,16 +6,9 @@ export interface Chunk { data: Uint8Array; } -export class VOXLoader extends Loader { +export class VOXLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (chunks: Chunk[]) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer): object[]; } diff --git a/types/three/examples/jsm/loaders/VRMLLoader.d.ts b/types/three/examples/jsm/loaders/VRMLLoader.d.ts index 1beb005a0..ea09f485c 100644 --- a/types/three/examples/jsm/loaders/VRMLLoader.d.ts +++ b/types/three/examples/jsm/loaders/VRMLLoader.d.ts @@ -1,14 +1,7 @@ import { Scene, Loader, LoadingManager } from '../../../src/Three.js'; -export class VRMLLoader extends Loader { +export class VRMLLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (scene: Scene) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: string, path: string): Scene; } diff --git a/types/three/examples/jsm/loaders/VTKLoader.d.ts b/types/three/examples/jsm/loaders/VTKLoader.d.ts index 87bc716f1..0c8ac595e 100644 --- a/types/three/examples/jsm/loaders/VTKLoader.d.ts +++ b/types/three/examples/jsm/loaders/VTKLoader.d.ts @@ -1,14 +1,7 @@ import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js'; -export class VTKLoader extends Loader { +export class VTKLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (geometry: BufferGeometry) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: ArrayBuffer | string, path: string): BufferGeometry; } diff --git a/types/three/examples/jsm/loaders/XYZLoader.d.ts b/types/three/examples/jsm/loaders/XYZLoader.d.ts index e2d81977f..42ea752cc 100644 --- a/types/three/examples/jsm/loaders/XYZLoader.d.ts +++ b/types/three/examples/jsm/loaders/XYZLoader.d.ts @@ -1,14 +1,7 @@ import { BufferGeometry, Loader, LoadingManager } from '../../../src/Three.js'; -export class XYZLoader extends Loader { +export class XYZLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (geometry: BufferGeometry) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; parse(data: string, onLoad: (geometry: BufferGeometry) => void): object; } diff --git a/types/three/examples/jsm/nodes/loaders/NodeLoader.d.ts b/types/three/examples/jsm/nodes/loaders/NodeLoader.d.ts index 4b1f5185b..223b9c438 100644 --- a/types/three/examples/jsm/nodes/loaders/NodeLoader.d.ts +++ b/types/three/examples/jsm/nodes/loaders/NodeLoader.d.ts @@ -5,17 +5,9 @@ export interface NodeLoaderResult { [hash: string]: Node; } -export default class NodeLoader extends Loader { +export default class NodeLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (gltf: NodeLoaderResult) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; - parseNodes(json: AnyJson): NodeLoaderResult; parse(json: AnyJson): Node; setTextures(textures: { [key: string]: Texture }): this; diff --git a/types/three/src/loaders/AnimationLoader.d.ts b/types/three/src/loaders/AnimationLoader.d.ts index 936c527b5..d24003a27 100644 --- a/types/three/src/loaders/AnimationLoader.d.ts +++ b/types/three/src/loaders/AnimationLoader.d.ts @@ -1,16 +1,9 @@ import { LoadingManager } from './LoadingManager.js'; import { Loader } from './Loader.js'; -import { AnimationClip } from './../animation/AnimationClip.js'; +import { AnimationClip } from '../animation/AnimationClip.js'; -export class AnimationLoader extends Loader { +export class AnimationLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (response: AnimationClip[]) => void, - onProgress?: (request: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; - parse(json: any): AnimationClip[]; + parse(json: readonly unknown[]): AnimationClip[]; } diff --git a/types/three/src/loaders/AudioLoader.d.ts b/types/three/src/loaders/AudioLoader.d.ts index 9780072da..e4c1aa7d7 100644 --- a/types/three/src/loaders/AudioLoader.d.ts +++ b/types/three/src/loaders/AudioLoader.d.ts @@ -1,15 +1,6 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -export class AudioLoader extends Loader { +export class AudioLoader extends Loader { constructor(manager?: LoadingManager); - - load( - url: string, - onLoad: (audioBuffer: AudioBuffer) => void, - onProgress?: (request: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } diff --git a/types/three/src/loaders/BufferGeometryLoader.d.ts b/types/three/src/loaders/BufferGeometryLoader.d.ts index 3682232fa..4c671dce7 100644 --- a/types/three/src/loaders/BufferGeometryLoader.d.ts +++ b/types/three/src/loaders/BufferGeometryLoader.d.ts @@ -3,18 +3,8 @@ import { LoadingManager } from './LoadingManager.js'; import { BufferGeometry } from './../core/BufferGeometry.js'; import { InstancedBufferGeometry } from '../core/InstancedBufferGeometry.js'; -export class BufferGeometryLoader extends Loader { +export class BufferGeometryLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad: (bufferGeometry: InstancedBufferGeometry | BufferGeometry) => void, - onProgress?: (request: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): void; - loadAsync( - url: string, - onProgress?: (event: ProgressEvent) => void, - ): Promise; - parse(json: any): InstancedBufferGeometry | BufferGeometry; + parse(json: unknown): InstancedBufferGeometry | BufferGeometry; } diff --git a/types/three/src/loaders/CompressedTextureLoader.d.ts b/types/three/src/loaders/CompressedTextureLoader.d.ts index 426150419..8f58fe621 100644 --- a/types/three/src/loaders/CompressedTextureLoader.d.ts +++ b/types/three/src/loaders/CompressedTextureLoader.d.ts @@ -2,15 +2,6 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; import { CompressedTexture } from './../textures/CompressedTexture.js'; -export class CompressedTextureLoader extends Loader { +export class CompressedTextureLoader extends Loader { constructor(manager?: LoadingManager); - - load( - url: string, - onLoad: (texture: CompressedTexture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): CompressedTexture; - - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } diff --git a/types/three/src/loaders/CubeTextureLoader.d.ts b/types/three/src/loaders/CubeTextureLoader.d.ts index 90e3ff8ce..a8ddc43b6 100644 --- a/types/three/src/loaders/CubeTextureLoader.d.ts +++ b/types/three/src/loaders/CubeTextureLoader.d.ts @@ -2,15 +2,6 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; import { CubeTexture } from './../textures/CubeTexture.js'; -export class CubeTextureLoader extends Loader { +export class CubeTextureLoader extends Loader { constructor(manager?: LoadingManager); - - load( - urls: string[], - onLoad?: (texture: CubeTexture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): CubeTexture; - - loadAsync(urls: string[], onProgress?: (event: ProgressEvent) => void): Promise; } diff --git a/types/three/src/loaders/DataTextureLoader.d.ts b/types/three/src/loaders/DataTextureLoader.d.ts index 99c285af0..946b116ce 100644 --- a/types/three/src/loaders/DataTextureLoader.d.ts +++ b/types/three/src/loaders/DataTextureLoader.d.ts @@ -2,15 +2,14 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; import { DataTexture } from './../textures/DataTexture.js'; -export class DataTextureLoader extends Loader { +export class DataTextureLoader extends Loader { constructor(manager?: LoadingManager); load( url: string, - onLoad?: (dataTexture: DataTexture, texData: object) => void, + onLoad?: (data: DataTexture, texData: object) => void, onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): DataTexture; - + onError?: (err: unknown) => void, + ): void; loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } diff --git a/types/three/src/loaders/FileLoader.d.ts b/types/three/src/loaders/FileLoader.d.ts index 53b0a093b..f663f18bb 100644 --- a/types/three/src/loaders/FileLoader.d.ts +++ b/types/three/src/loaders/FileLoader.d.ts @@ -1,19 +1,12 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -export class FileLoader extends Loader { +export class FileLoader extends Loader { constructor(manager?: LoadingManager); mimeType: undefined | MimeType; responseType: undefined | string; - load( - url: string, - onLoad?: (response: string | ArrayBuffer) => void, - onProgress?: (request: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): any; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; setMimeType(mimeType: MimeType): FileLoader; setResponseType(responseType: string): FileLoader; } diff --git a/types/three/src/loaders/ImageBitmapLoader.d.ts b/types/three/src/loaders/ImageBitmapLoader.d.ts index df60a407a..b0ca9ec06 100644 --- a/types/three/src/loaders/ImageBitmapLoader.d.ts +++ b/types/three/src/loaders/ImageBitmapLoader.d.ts @@ -1,7 +1,7 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -export class ImageBitmapLoader extends Loader { +export class ImageBitmapLoader extends Loader { constructor(manager?: LoadingManager); /** @@ -12,12 +12,4 @@ export class ImageBitmapLoader extends Loader { readonly isImageBitmapLoader: true; setOptions(options: object): ImageBitmapLoader; - load( - url: string, - onLoad?: (response: ImageBitmap) => void, - onProgress?: (request: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): any; - - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } diff --git a/types/three/src/loaders/ImageLoader.d.ts b/types/three/src/loaders/ImageLoader.d.ts index 6804b61b5..572130e84 100644 --- a/types/three/src/loaders/ImageLoader.d.ts +++ b/types/three/src/loaders/ImageLoader.d.ts @@ -5,15 +5,6 @@ import { LoadingManager } from './LoadingManager.js'; * A loader for loading an image. * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. */ -export class ImageLoader extends Loader { +export class ImageLoader extends Loader { constructor(manager?: LoadingManager); - - load( - url: string, - onLoad?: (image: HTMLImageElement) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): HTMLImageElement; - - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } diff --git a/types/three/src/loaders/Loader.d.ts b/types/three/src/loaders/Loader.d.ts index 402da66ed..5b92d008d 100644 --- a/types/three/src/loaders/Loader.d.ts +++ b/types/three/src/loaders/Loader.d.ts @@ -3,7 +3,7 @@ import { LoadingManager } from './LoadingManager.js'; /** * Base class for implementing loaders. */ -export class Loader { +export class Loader { constructor(manager?: LoadingManager); /** @@ -32,11 +32,13 @@ export class Loader { */ requestHeader: { [header: string]: string }; - /* - load(): void; - loadAsync(): Promise; - parse(): void; - */ + load( + url: TUrl, + onLoad?: (data: TData) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): void; + loadAsync(url: TUrl, onProgress?: (event: ProgressEvent) => void): Promise; setCrossOrigin(crossOrigin: string): this; setWithCredentials(value: boolean): this; diff --git a/types/three/src/loaders/MaterialLoader.d.ts b/types/three/src/loaders/MaterialLoader.d.ts index b612fcab5..8c10b3f0f 100644 --- a/types/three/src/loaders/MaterialLoader.d.ts +++ b/types/three/src/loaders/MaterialLoader.d.ts @@ -3,7 +3,7 @@ import { LoadingManager } from './LoadingManager.js'; import { Texture } from './../textures/Texture.js'; import { Material } from './../materials/Material.js'; -export class MaterialLoader extends Loader { +export class MaterialLoader extends Loader { constructor(manager?: LoadingManager); /** @@ -11,13 +11,6 @@ export class MaterialLoader extends Loader { */ textures: { [key: string]: Texture }; - load( - url: string, - onLoad: (material: Material) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: Error | ErrorEvent) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; setTextures(textures: { [key: string]: Texture }): this; - parse(json: any): Material; + parse(json: unknown): Material; } diff --git a/types/three/src/loaders/ObjectLoader.d.ts b/types/three/src/loaders/ObjectLoader.d.ts index b2b4ac784..a7609c2e2 100644 --- a/types/three/src/loaders/ObjectLoader.d.ts +++ b/types/three/src/loaders/ObjectLoader.d.ts @@ -8,35 +8,21 @@ import { InstancedBufferGeometry } from '../core/InstancedBufferGeometry.js'; import { BufferGeometry } from '../core/BufferGeometry.js'; import { Source } from '../textures/Source.js'; -export class ObjectLoader extends Loader { +export class ObjectLoader extends Loader { constructor(manager?: LoadingManager); - load( - url: string, - onLoad?: (object: Object3D) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: Error | ErrorEvent) => void, - ): void; - loadAsync( - url: string, - onProgress?: (event: ProgressEvent) => void, - ): // tslint:disable-next-line:no-unnecessary-generics - Promise; - // tslint:disable-next-line:no-unnecessary-generics - parse(json: any, onLoad?: (object: Object3D) => void): T; - // tslint:disable-next-line:no-unnecessary-generics - parseAsync(json: any): Promise; - parseGeometries(json: any): { [key: string]: InstancedBufferGeometry | BufferGeometry }; - parseMaterials(json: any, textures: { [key: string]: Texture }): { [key: string]: Material }; - parseAnimations(json: any): AnimationClip[]; - parseImages(json: any, onLoad?: () => void): { [key: string]: Source }; - parseImagesAsync(json: any): Promise<{ [key: string]: Source }>; - parseTextures(json: any, images: { [key: string]: Source }): { [key: string]: Texture }; - parseObject( - data: any, - geometries: any[], - materials: Material[], - animations: AnimationClip[], - ): // tslint:disable-next-line:no-unnecessary-generics - T; + parse(json: unknown, onLoad?: (object: Object3D) => void): Object3D; + parseAsync(json: unknown): Promise; + parseGeometries(json: unknown): { [key: string]: InstancedBufferGeometry | BufferGeometry }; + parseMaterials(json: unknown, textures: { [key: string]: Texture }): { [key: string]: Material }; + parseAnimations(json: unknown): { [key: string]: AnimationClip }; + parseImages(json: unknown, onLoad?: () => void): { [key: string]: Source }; + parseImagesAsync(json: unknown): Promise<{ [key: string]: Source }>; + parseTextures(json: unknown, images: { [key: string]: Source }): { [key: string]: Texture }; + parseObject( + data: unknown, + geometries: { [key: string]: InstancedBufferGeometry | BufferGeometry }, + materials: { [key: string]: Material }, + animations: { [key: string]: AnimationClip }, + ): Object3D; } diff --git a/types/three/src/loaders/TextureLoader.d.ts b/types/three/src/loaders/TextureLoader.d.ts index 54371dee0..2ad2415f1 100644 --- a/types/three/src/loaders/TextureLoader.d.ts +++ b/types/three/src/loaders/TextureLoader.d.ts @@ -6,15 +6,6 @@ import { Texture } from './../textures/Texture.js'; * Class for loading a texture. * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. */ -export class TextureLoader extends Loader { +export class TextureLoader extends Loader { constructor(manager?: LoadingManager); - - load( - url: string, - onLoad?: (texture: Texture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): Texture; - - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; } From 09a4187b37635ee55be359caa2ce78971765c345 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 30 Jul 2023 14:12:47 -0400 Subject: [PATCH 2/4] Add return types --- types/three/src/loaders/BufferGeometryLoader.d.ts | 2 +- types/three/src/loaders/CompressedTextureLoader.d.ts | 9 ++++++++- types/three/src/loaders/CubeTextureLoader.d.ts | 9 ++++++++- types/three/src/loaders/DataTextureLoader.d.ts | 5 ++--- types/three/src/loaders/ImageLoader.d.ts | 7 +++++++ types/three/src/loaders/MaterialLoader.d.ts | 4 ++-- types/three/src/loaders/TextureLoader.d.ts | 9 ++++++++- 7 files changed, 36 insertions(+), 9 deletions(-) diff --git a/types/three/src/loaders/BufferGeometryLoader.d.ts b/types/three/src/loaders/BufferGeometryLoader.d.ts index 4c671dce7..3b48395e6 100644 --- a/types/three/src/loaders/BufferGeometryLoader.d.ts +++ b/types/three/src/loaders/BufferGeometryLoader.d.ts @@ -1,6 +1,6 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -import { BufferGeometry } from './../core/BufferGeometry.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; import { InstancedBufferGeometry } from '../core/InstancedBufferGeometry.js'; export class BufferGeometryLoader extends Loader { diff --git a/types/three/src/loaders/CompressedTextureLoader.d.ts b/types/three/src/loaders/CompressedTextureLoader.d.ts index 8f58fe621..501109c76 100644 --- a/types/three/src/loaders/CompressedTextureLoader.d.ts +++ b/types/three/src/loaders/CompressedTextureLoader.d.ts @@ -1,7 +1,14 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -import { CompressedTexture } from './../textures/CompressedTexture.js'; +import { CompressedTexture } from '../textures/CompressedTexture.js'; export class CompressedTextureLoader extends Loader { constructor(manager?: LoadingManager); + + load( + url: string, + onLoad?: (data: CompressedTexture) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): CompressedTexture; } diff --git a/types/three/src/loaders/CubeTextureLoader.d.ts b/types/three/src/loaders/CubeTextureLoader.d.ts index a8ddc43b6..6b5ade497 100644 --- a/types/three/src/loaders/CubeTextureLoader.d.ts +++ b/types/three/src/loaders/CubeTextureLoader.d.ts @@ -1,7 +1,14 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -import { CubeTexture } from './../textures/CubeTexture.js'; +import { CubeTexture } from '../textures/CubeTexture.js'; export class CubeTextureLoader extends Loader { constructor(manager?: LoadingManager); + + load( + url: readonly string[], + onLoad?: (data: CubeTexture) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): CubeTexture; } diff --git a/types/three/src/loaders/DataTextureLoader.d.ts b/types/three/src/loaders/DataTextureLoader.d.ts index 946b116ce..637acf461 100644 --- a/types/three/src/loaders/DataTextureLoader.d.ts +++ b/types/three/src/loaders/DataTextureLoader.d.ts @@ -1,6 +1,6 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -import { DataTexture } from './../textures/DataTexture.js'; +import { DataTexture } from '../textures/DataTexture.js'; export class DataTextureLoader extends Loader { constructor(manager?: LoadingManager); @@ -10,6 +10,5 @@ export class DataTextureLoader extends Loader { onLoad?: (data: DataTexture, texData: object) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void, - ): void; - loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise; + ): DataTexture; } diff --git a/types/three/src/loaders/ImageLoader.d.ts b/types/three/src/loaders/ImageLoader.d.ts index 572130e84..d778d3fc8 100644 --- a/types/three/src/loaders/ImageLoader.d.ts +++ b/types/three/src/loaders/ImageLoader.d.ts @@ -7,4 +7,11 @@ import { LoadingManager } from './LoadingManager.js'; */ export class ImageLoader extends Loader { constructor(manager?: LoadingManager); + + load( + url: string, + onLoad?: (data: HTMLImageElement, texData: object) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): HTMLImageElement; } diff --git a/types/three/src/loaders/MaterialLoader.d.ts b/types/three/src/loaders/MaterialLoader.d.ts index 8c10b3f0f..e7edea224 100644 --- a/types/three/src/loaders/MaterialLoader.d.ts +++ b/types/three/src/loaders/MaterialLoader.d.ts @@ -1,7 +1,7 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -import { Texture } from './../textures/Texture.js'; -import { Material } from './../materials/Material.js'; +import { Texture } from '../textures/Texture.js'; +import { Material } from '../materials/Material.js'; export class MaterialLoader extends Loader { constructor(manager?: LoadingManager); diff --git a/types/three/src/loaders/TextureLoader.d.ts b/types/three/src/loaders/TextureLoader.d.ts index 2ad2415f1..68a10ef03 100644 --- a/types/three/src/loaders/TextureLoader.d.ts +++ b/types/three/src/loaders/TextureLoader.d.ts @@ -1,6 +1,6 @@ import { Loader } from './Loader.js'; import { LoadingManager } from './LoadingManager.js'; -import { Texture } from './../textures/Texture.js'; +import { Texture } from '../textures/Texture.js'; /** * Class for loading a texture. @@ -8,4 +8,11 @@ import { Texture } from './../textures/Texture.js'; */ export class TextureLoader extends Loader { constructor(manager?: LoadingManager); + + load( + url: string, + onLoad?: (data: Texture, texData: object) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): Texture; } From bf5edb89154b3c167fd81ac70b2553fe5a7a5a27 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 30 Jul 2023 14:26:27 -0400 Subject: [PATCH 3/4] Get tests passing --- types/three/OTHER_FILES.txt | 1 - .../jsm/loaders/BasisTextureLoader.d.ts | 25 - .../jsm/loaders/HDRCubeTextureLoader.d.ts | 7 + .../three/examples/jsm/loaders/IFCLoader.d.ts | 667 ------------------ .../examples/jsm/loaders/LottieLoader.d.ts | 7 + .../three-examples/webgl_loader_ifc.ts | 59 -- .../three-examples/webgl_loader_pcd.ts | 2 +- types/three/tsconfig.json | 1 - 8 files changed, 15 insertions(+), 754 deletions(-) delete mode 100644 types/three/examples/jsm/loaders/BasisTextureLoader.d.ts delete mode 100644 types/three/examples/jsm/loaders/IFCLoader.d.ts delete mode 100644 types/three/test/integration/three-examples/webgl_loader_ifc.ts diff --git a/types/three/OTHER_FILES.txt b/types/three/OTHER_FILES.txt index c1aada79b..ef389a81c 100644 --- a/types/three/OTHER_FILES.txt +++ b/types/three/OTHER_FILES.txt @@ -55,7 +55,6 @@ examples/jsm/lines/WireframeGeometry2.d.ts examples/jsm/loaders/3DMLoader.d.ts examples/jsm/loaders/3MFLoader.d.ts examples/jsm/loaders/AMFLoader.d.ts -examples/jsm/loaders/BasisTextureLoader.d.ts examples/jsm/loaders/BVHLoader.d.ts examples/jsm/loaders/ColladaLoader.d.ts examples/jsm/loaders/EXRLoader.d.ts diff --git a/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts b/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts deleted file mode 100644 index 8ec17c7a2..000000000 --- a/types/three/examples/jsm/loaders/BasisTextureLoader.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { CompressedTexture, Loader, LoadingManager, WebGLRenderer } from '../../../src/Three.js'; - -export class BasisTextureLoader extends Loader { - constructor(manager?: LoadingManager); - transcoderBinary: ArrayBuffer | null; - transcoderPath: string; - transcoderPending: Promise | null; - - workerConfig: { - format: number; - astcSupported: boolean; - etcSupported: boolean; - dxtSupported: boolean; - pvrtcSupported: boolean; - }; - workerLimit: number; - workerNextTaskID: number; - workerPool: object[]; - workerSourceURL: string; - - detectSupport(renderer: WebGLRenderer): this; - setTranscoderPath(path: string): this; - setWorkerLimit(workerLimit: number): this; - dispose(): void; -} diff --git a/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts b/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts index fe605eb44..7b1ac8eab 100644 --- a/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +++ b/types/three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts @@ -7,5 +7,12 @@ export class HDRCubeTextureLoader extends Loader hdrLoader: RGBELoader; type: TextureDataType; + load( + url: readonly string[], + onLoad?: (data: CubeTexture) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): CubeTexture; + setDataType(type: TextureDataType): this; } diff --git a/types/three/examples/jsm/loaders/IFCLoader.d.ts b/types/three/examples/jsm/loaders/IFCLoader.d.ts deleted file mode 100644 index b2893ab62..000000000 --- a/types/three/examples/jsm/loaders/IFCLoader.d.ts +++ /dev/null @@ -1,667 +0,0 @@ -import { - Loader, - LoadingManager, - Scene, - BufferGeometry, - Material, - Object3D, - Mesh, - BufferAttribute, -} from '../../../src/Three.js'; - -declare class IFCLoader extends Loader { - ifcManager: IFCManager; - - constructor(manager?: LoadingManager); - - parse(buffer: ArrayBuffer): Promise; -} - -export interface LoaderSettings { - COORDINATE_TO_ORIGIN: boolean; - USE_FAST_BOOLS: boolean; - CIRCLE_SEGMENTS_LOW?: number; - CIRCLE_SEGMENTS_MEDIUM?: number; - CIRCLE_SEGMENTS_HIGH?: number; -} - -export class IFCManager { - private state; - private BVH; - private parser; - private subsets; - private properties; - private types; - private hider; - - parse(buffer: ArrayBuffer): Promise; - - /** - * Sets the relative path of web-ifc.wasm file in the project. - * Beware: you **must** serve this file in your page; this means - * that you have to copy this files from *node_modules/web-ifc* - * to your deployment directory. - * - * If you don't use this methods, - * IFC.js assumes that you are serving it in the root directory. - * - * Example if web-ifc.wasm is in dist/wasmDir: - * `ifcLoader.setWasmPath("dist/wasmDir/");` - * - * @param path Relative path to web-ifc.wasm. - */ - setWasmPath(path: string): void; - - /** - * Applies a configuration for [web-ifc](https://ifcjs.github.io/info/docs/Guide/web-ifc/Introduction). - */ - applyWebIfcConfig(settings: LoaderSettings): void; - - /** - * Enables the JSON mode (which consumes way less memory) and eliminates the WASM data. - * Only use this in the following scenarios: - * - If you don't need to access the properties of the IFC - * - If you will provide the properties as JSON. - */ - useJSONData(useJSON?: boolean): void; - - /** - * Adds the properties of a model as JSON data. - * @param modelID ID of the IFC model. - * @param data data as an object where the keys are the expressIDs and the values the properties. - */ - addModelJSONData( - modelID: number, - data: { - [id: number]: JSONObject; - }, - ): void; - - /** - * Completely releases the WASM memory, thus drastically decreasing the memory use of the app. - * Only use this in the following scenarios: - * - If you don't need to access the properties of the IFC - * - If you will provide the properties as JSON. - */ - disposeMemory(): void; - - /** - * Makes object picking a lot faster - * Courtesy of gkjohnson's [work](https://github.com/gkjohnson/three-mesh-bvh). - * Import these objects from his library and pass them as arguments. IFC.js takes care of the rest! - */ - setupThreeMeshBVH(computeBoundsTree: any, disposeBoundsTree: any, acceleratedRaycast: any): void; - - /** - * Closes the specified model and deletes it from the [scene](https://threejs.org/docs/#api/en/scenes/Scene). - * @param modelID ID of the IFC model. - * @param scene Scene where the model is (if it's located in a scene). - */ - close(modelID: number, scene?: Scene): void; - - /** - * Gets the **Express ID** to which the given face belongs. - * This ID uniquely identifies this entity within this IFC file. - * @param geometry The geometry of the IFC model. - * @param faceIndex The index of the face of a geometry.You can easily get this index using the [Raycaster](https://threejs.org/docs/#api/en/core/Raycaster). - */ - getExpressId(geometry: BufferGeometry, faceIndex: number): number | undefined; - - /** - * Returns all items of the specified type. You can import - * the types from *web-ifc*. - * - * Example to get all the standard walls of a project: - * ```js - * import { IFCWALLSTANDARDCASE } from 'web-ifc'; - * const walls = ifcLoader.getAllItemsOfType(IFCWALLSTANDARDCASE); - * ``` - * @param modelID ID of the IFC model. - * @param ifcType type of IFC items to get. - * @param verbose If false (default), this only gets IDs. If true, this also gets the native properties of all the fetched items. - */ - getAllItemsOfType(modelID: number, type: number, verbose: boolean): any[]; - - /** - * Gets the native properties of the given element. - * @param modelID ID of the IFC model. - * @param id Express ID of the element. - * @param recursive Wether you want to get the information of the referenced elements recursively. - */ - getItemProperties(modelID: number, id: number, recursive?: boolean): any; - - /** - * Gets the [property sets](https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifckernel/lexical/ifcpropertyset.htm) - * assigned to the given element. - * @param modelID ID of the IFC model. - * @param id Express ID of the element. - * @param recursive If true, this gets the native properties of the referenced elements recursively. - */ - getPropertySets(modelID: number, id: number, recursive?: boolean): any[]; - - /** - * Gets the properties of the type assigned to the element. - * For example, if applied to a wall (IfcWall), this would get back the information - * contained in the IfcWallType assigned to it, if any. - * @param modelID ID of the IFC model. - * @param id Express ID of the element. - * @param recursive If true, this gets the native properties of the referenced elements recursively. - */ - getTypeProperties(modelID: number, id: number, recursive?: boolean): any[]; - - /** - * Gets the materials assigned to the given element. - * @param modelID ID of the IFC model. - * @param id Express ID of the element. - * @param recursive If true, this gets the native properties of the referenced elements recursively. - */ - getMaterialsProperties(modelID: number, id: number, recursive?: boolean): any[]; - - /** - * Gets the ifc type of the specified item. - * @param modelID ID of the IFC model. - * @param id Express ID of the element. - */ - getIfcType(modelID: number, id: number): string; - - /** - * Gets the spatial structure of the project. The - * [spatial structure](https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifcproductextension/lexical/ifcspatialstructureelement.htm) - * is the hierarchical structure that organizes every IFC project (all physical items - * are referenced to an element of the spatial structure). It is formed by - * one IfcProject that contains one or more IfcSites, that contain one or more - * IfcBuildings, that contain one or more IfcBuildingStoreys, that contain - * one or more IfcSpaces. - * @param modelID ID of the IFC model. - */ - getSpatialStructure(modelID: number): { - expressID: number; - type: string; - children: never[]; - }; - - /** - * Gets the mesh of the subset with the specified [material](https://threejs.org/docs/#api/en/materials/Material). - * If no material is given, this returns the subset with the original materials. - * @param modelID ID of the IFC model. - * @param material Material assigned to the subset (if any). - */ - getSubset(modelID: number, material?: Material): Mesh | null; - - /** - * Removes the specified subset. - * @param modelID ID of the IFC model. - * @param parent The parent where the subset is (can be any `THREE.Object3D`). - * @param material Material assigned to the subset, if any. - */ - removeSubset(modelID: number, parent?: Object3D, material?: Material): void; - - /** - * Creates a new geometric subset. - * @param config A configuration object with the following options: - * - **scene**: `THREE.Object3D` where the model is located. - * - **modelID**: ID of the model. - * - **ids**: Express IDs of the items of the model that will conform the subset. - * - **removePrevious**: wether to remove the previous subset of this model with this material. - * - **material**: (optional) wether to apply a material to the subset - */ - createSubset(config: HighlightConfigOfModel): void | Mesh; - - /** - * Hides the selected items in the specified model - * @param modelID ID of the IFC model. - * @param ids Express ID of the elements. - */ - hideItems(modelID: number, ids: number[]): void; - - /** - * Hides all the items of the specified model - * @param modelID ID of the IFC model. - */ - hideAllItems(modelID: number): void; - - /** - * Shows all the items of the specified model - * @param modelID ID of the IFC model. - * @param ids Express ID of the elements. - */ - showItems(modelID: number, ids: number[]): void; - - /** - * Shows all the items of the specified model - * @param modelID ID of the IFC model. - */ - showAllItems(modelID: number): void; -} - -/** - * Represents an IFC model. This object is returned by the `IFCLoader` after loading an IFC. - * @param geometry `THREE.Buffergeometry`, see Three.js documentation. - * @param materials `THREE.Material[]`, see Three.js documentation. - * @param manager contains all the logic to work with IFC. - */ -export class IFCModel extends Mesh { - modelID: number; - ifcManager: IFCManager | null; - /** - * @deprecated `IfcModel` is already a mesh; you can place it in the scene directly. - */ - mesh: this; - - setIFCManager(manager: IFCManager): void; - - /** - * @deprecated Use `IfcModel.ifcManager.setWasmPath` instead. - * - * Sets the relative path of web-ifc.wasm file in the project. - * Beware: you **must** serve this file in your page; this means - * that you have to copy this files from *node_modules/web-ifc* - * to your deployment directory. - * - * If you don't use this methods, - * IFC.js assumes that you are serving it in the root directory. - * - * Example if web-ifc.wasm is in dist/wasmDir: - * `ifcLoader.setWasmPath("dist/wasmDir/");` - * - * @param path Relative path to web-ifc.wasm. - */ - setWasmPath(path: string): void; - - /** - * @deprecated Use `IfcModel.ifcManager.close` instead. - * - * Closes the specified model and deletes it from the [scene](https://threejs.org/docs/#api/en/scenes/Scene). - * @param scene Scene where the model is (if it's located in a scene). - */ - close(scene?: Scene): void; - - /** - * @deprecated Use `IfcModel.ifcManager.getExpressId` instead. - * - * Gets the **Express ID** to which the given face belongs. - * This ID uniquely identifies this entity within this IFC file. - * @param geometry The geometry of the IFC model. - * @param faceIndex The index of the face of a geometry.You can easily get this index using the [Raycaster](https://threejs.org/docs/#api/en/core/Raycaster). - */ - getExpressId(geometry: BufferGeometry, faceIndex: number): number | undefined; - - /** - * @deprecated Use `IfcModel.ifcManager.getAllItemsOfType` instead. - * - * Returns all items of the specified type. You can import - * the types from *web-ifc*. - * - * Example to get all the standard walls of a project: - * ```js - * import { IFCWALLSTANDARDCASE } from 'web-ifc'; - * const walls = ifcLoader.getAllItemsOfType(IFCWALLSTANDARDCASE); - * ``` - * @param ifcType The type of IFC items to get. - * @param verbose If false (default), this only gets IDs. If true, this also gets the native properties of all the fetched items. - */ - getAllItemsOfType(type: number, verbose: boolean): any[]; - - /** - * @deprecated Use `IfcModel.ifcManager.getItemProperties` instead. - * - * Gets the native properties of the given element. - * @param id Express ID of the element. - * @param recursive Wether you want to get the information of the referenced elements recursively. - */ - getItemProperties(id: number, recursive?: boolean): any; - - /** - * @deprecated Use `IfcModel.ifcManager.getPropertySets` instead. - * - * Gets the [property sets](https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifckernel/lexical/ifcpropertyset.htm) - * assigned to the given element. - * @param id Express ID of the element. - * @param recursive If true, this gets the native properties of the referenced elements recursively. - */ - getPropertySets(id: number, recursive?: boolean): any[]; - - /** - * @deprecated Use `IfcModel.ifcManager.getTypeProperties` instead. - * - * Gets the properties of the type assigned to the element. - * For example, if applied to a wall (IfcWall), this would get back the information - * contained in the IfcWallType assigned to it, if any. - * @param id Express ID of the element. - * @param recursive If true, this gets the native properties of the referenced elements recursively. - */ - getTypeProperties(id: number, recursive?: boolean): any[]; - - /** - * @deprecated Use `IfcModel.ifcManager.getIfcType` instead. - * - * Gets the ifc type of the specified item. - * @param id Express ID of the element. - */ - getIfcType(id: number): string; - - /** - * @deprecated Use `IfcModel.ifcManager.getSpatialStructure` instead. - * - * Gets the spatial structure of the project. The - * [spatial structure](https://standards.buildingsmart.org/IFC/DEV/IFC4_2/FINAL/HTML/schema/ifcproductextension/lexical/ifcspatialstructureelement.htm) - * is the hierarchical structure that organizes every IFC project (all physical items - * are referenced to an element of the spatial structure). It is formed by - * one IfcProject that contains one or more IfcSites, that contain one or more - * IfcBuildings, that contain one or more IfcBuildingStoreys, that contain - * one or more IfcSpaces. - */ - getSpatialStructure(): { - expressID: number; - type: string; - children: never[]; - }; - - /** - * @deprecated Use `IfcModel.ifcManager.getSubset` instead. - * - * Gets the mesh of the subset with the specified [material](https://threejs.org/docs/#api/en/materials/Material). - * If no material is given, this returns the subset with the original materials. - * @param material Material assigned to the subset, if any. - */ - getSubset(material?: Material): Mesh | null; - - /** - * @deprecated Use `IfcModel.ifcManager.removeSubset` instead. - * - * Removes the specified subset. - * @param parent The parent where the subset is (can be any `THREE.Object3D`). - * @param material Material assigned to the subset, if any. - */ - removeSubset(parent?: Object3D, material?: Material): void; - - /** - * @deprecated Use `IfcModel.ifcManager.createSubset` instead. - * - * Creates a new geometric subset. - * @param config A configuration object with the following options: - * - **scene**: `THREE.Object3D` where the model is located. - * - **ids**: Express IDs of the items of the model that will conform the subset. - * - **removePrevious**: Wether to remove the previous subset of this model with this material. - * - **material**: (optional) Wether to apply a material to the subset - */ - createSubset(config: HighlightConfig): void | Mesh; - - /** - * @deprecated Use `IfcModel.ifcManager.hideItems` instead. - * - * Hides the selected items in the specified model - * @param ids Express ID of the elements. - */ - hideItems(ids: number[]): void; - - /** - * @deprecated Use `IfcModel.ifcManager.hideAllItems` instead. - * - * Hides all the items of the specified model - */ - hideAllItems(): void; - - /** - * @deprecated Use `IfcModel.ifcManager.showItems` instead. - * - * Hides all the items of the specified model - * @param ids Express ID of the elements. - */ - showItems(ids: number[]): void; - - /** - * @deprecated Use `IfcModel.ifcManager.showAllItems` instead. - * - * Shows all the items of the specified model - */ - showAllItems(): void; -} - -export const IdAttrName = 'expressID'; -export interface IdAttributeByMaterial { - [id: number]: number; -} -export interface IdAttributesByMaterials { - [materialID: string]: IdAttributeByMaterial; -} -export function merge(geoms: BufferGeometry[], createGroups?: boolean): BufferGeometry; -export function newFloatAttr(data: any[], size: number): BufferAttribute; -export function newIntAttr(data: any[], size: number): BufferAttribute; - -export interface HighlightConfig { - scene: Object3D; - ids: number[]; - removePrevious: boolean; - material?: Material; -} - -export interface HighlightConfigOfModel extends HighlightConfig { - modelID: number; -} - -export const DEFAULT = 'default'; -export interface SelectedItems { - [matID: string]: { - ids: Set; - mesh: Mesh; - }; -} -export interface MapFaceindexID { - [key: number]: number; -} -export interface IdGeometries { - [expressID: number]: BufferGeometry; -} -export interface GeometriesByMaterial { - material: Material; - geometries: IdGeometries; -} - -export interface GeometriesByMaterials { - [materialID: string]: GeometriesByMaterial; -} - -export interface TypesMap { - [key: number]: number; -} - -export interface IfcModel { - modelID: number; - mesh: IfcMesh; - items: GeometriesByMaterials; - types: TypesMap; - jsonData: { - [id: number]: JSONObject; - }; -} - -export interface JSONObject { - expressID: number; - type: string; - - [key: string]: any; -} - -export interface IfcState { - models: { - [modelID: number]: IfcModel; - }; - api: IfcAPI; - useJSON: boolean; - webIfcSettings?: LoaderSettings; -} - -export interface IfcMesh extends Mesh { - modelID: number; -} - -export interface Node { - expressID: number; - type: string; - children: Node[]; -} - -export interface pName { - name: number; - relating: string; - related: string; - key: string; -} - -export const PropsNames: { - aggregates: { - name: number; - relating: string; - related: string; - key: string; - }; - spatial: { - name: number; - relating: string; - related: string; - key: string; - }; - psets: { - name: number; - relating: string; - related: string; - key: string; - }; - materials: { - name: number; - relating: string; - related: string; - key: string; - }; - type: { - name: number; - relating: string; - related: string; - key: string; - }; -}; - -export interface IfcGeometry { - GetVertexData(): number; - - GetVertexDataSize(): number; - - GetIndexData(): number; - - GetIndexDataSize(): number; -} - -export interface RawLineData { - ID: number; - type: number; - arguments: any[]; -} - -export interface Vector { - get(index: number): T; - - size(): number; -} - -export interface FlatMesh { - geometries: Vector; - expressID: number; -} - -export interface PlacedGeometry { - color: Color; - geometryExpressID: number; - flatTransformation: number[]; -} - -export interface Color { - x: number; - y: number; - z: number; - w: number; -} - -export class IfcAPI { - wasmModule: any; - fs: any; - - /** - * Initializes the WASM module (WebIFCWasm), required before using any other functionality - */ - Init(): Promise; - - /** - * Opens a model and returns a modelID number - * @param data Buffer containing IFC data (bytes) - * @param settings Settings for loading the model - */ - OpenModel(data: string | Uint8Array, settings?: LoaderSettings): number; - - /** - * Creates a new model and returns a modelID number - * @param settings Settings for generating data the model - */ - CreateModel(settings?: LoaderSettings): number; - - ExportFileAsIFC(modelID: number): Uint8Array; - - /** - * Opens a model and returns a modelID number - * @param modelID Model handle retrieved by OpenModel, model must not be closed - * @param data Buffer containing IFC data (bytes) - */ - GetGeometry(modelID: number, geometryExpressID: number): IfcGeometry; - - GetLine(modelID: number, expressID: number, flatten?: boolean): any; - - WriteLine(modelID: number, lineObject: any): void; - - FlattenLine(modelID: number, line: any): void; - - GetRawLineData(modelID: number, expressID: number): RawLineData; - - WriteRawLineData(modelID: number, data: RawLineData): any; - - GetLineIDsWithType(modelID: number, type: number): Vector; - - GetAllLines(modelID: number): Vector; - - SetGeometryTransformation(modelID: number, transformationMatrix: number[]): void; - - GetVertexArray(ptr: number, size: number): Float32Array; - - GetIndexArray(ptr: number, size: number): Uint32Array; - - getSubArray(heap: any, startPtr: any, sizeBytes: any): any; - - /** - * Closes a model and frees all related memory - * @param modelID Model handle retrieved by OpenModel, model must not be closed - */ - CloseModel(modelID: number): void; - - StreamAllMeshes(modelID: number, meshCallback: (mesh: FlatMesh) => void): void; - - /** - * Checks if a specific model ID is open or closed - * @param modelID Model handle retrieved by OpenModel - */ - IsModelOpen(modelID: number): boolean; - - /** - * Load all geometry in a model - * @param modelID Model handle retrieved by OpenModel - */ - LoadAllGeometry(modelID: number): Vector; - - /** - * Load geometry for a single element - * @param modelID Model handle retrieved by OpenModel - */ - GetFlatMesh(modelID: number, expressID: number): FlatMesh; - - SetWasmPath(path: string): void; -} - -export { IFCLoader }; diff --git a/types/three/examples/jsm/loaders/LottieLoader.d.ts b/types/three/examples/jsm/loaders/LottieLoader.d.ts index 9f5b96dbb..b3ff39db7 100644 --- a/types/three/examples/jsm/loaders/LottieLoader.d.ts +++ b/types/three/examples/jsm/loaders/LottieLoader.d.ts @@ -3,5 +3,12 @@ import { CanvasTexture, Loader, LoadingManager } from '../../../src/Three.js'; export class LottieLoader extends Loader { constructor(manager?: LoadingManager); + load( + url: string, + onLoad?: (data: CanvasTexture) => void, + onProgress?: (event: ProgressEvent) => void, + onError?: (err: unknown) => void, + ): CanvasTexture; + setQuality(value: number): void; } diff --git a/types/three/test/integration/three-examples/webgl_loader_ifc.ts b/types/three/test/integration/three-examples/webgl_loader_ifc.ts deleted file mode 100644 index 7e3c0580a..000000000 --- a/types/three/test/integration/three-examples/webgl_loader_ifc.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'; - -import { IFCLoader } from 'three/examples/jsm/loaders/IFCLoader'; - -// Scene -const scene = new THREE.Scene(); -scene.background = new THREE.Color(0x8cc7de); - -// Renderer -const container = document.querySelector('#container')!; -const renderer = new THREE.WebGLRenderer({ antialias: true }); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); -renderer.setAnimationLoop(animation); -container.appendChild(renderer.domElement); - -// Camera -const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000); -camera.position.z = -70; -camera.position.y = 25; -camera.position.x = 90; -camera.lookAt(0, 0, 0); -const controls = new OrbitControls(camera, renderer.domElement); - -// Initial cube -const geometry = new THREE.BoxGeometry(); -const material = new THREE.MeshPhongMaterial({ color: 0xffffff }); -const cube = new THREE.Mesh(geometry, material); -scene.add(cube); - -// Lights -const directionalLight1 = new THREE.DirectionalLight(0xffeeff, 0.8); -directionalLight1.position.set(1, 1, 1); -scene.add(directionalLight1); -const directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.8); -directionalLight2.position.set(-1, 0.5, -1); -scene.add(directionalLight2); -const ambientLight = new THREE.AmbientLight(0xffffee, 0.25); -scene.add(ambientLight); - -// Window resize support -window.addEventListener('resize', () => { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -}); - -// Setup IFC Loader -const ifcLoader = new IFCLoader(); - -// Load IFC file -ifcLoader.load('models/ifc/rac_advanced_sample_project.ifc', geometry => scene.add(geometry)); - -// Animation -function animation() { - controls.update(); - renderer.render(scene, camera); -} diff --git a/types/three/test/integration/three-examples/webgl_loader_pcd.ts b/types/three/test/integration/three-examples/webgl_loader_pcd.ts index 83eac65f6..48fbc3595 100644 --- a/types/three/test/integration/three-examples/webgl_loader_pcd.ts +++ b/types/three/test/integration/three-examples/webgl_loader_pcd.ts @@ -59,7 +59,7 @@ function pcdLoaderLoad( url: string, onLoad: (points: THREE.Points) => void, onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, + onError?: (event: unknown) => void, ) { const scope = pcdLoader; diff --git a/types/three/tsconfig.json b/types/three/tsconfig.json index 805798837..be29187ab 100644 --- a/types/three/tsconfig.json +++ b/types/three/tsconfig.json @@ -34,7 +34,6 @@ "test/integration/three-examples/webgl_lights_spotlight.ts", "test/integration/three-examples/webgl_lines_fat.ts", "test/integration/three-examples/webgl_loader_gltf.ts", - "test/integration/three-examples/webgl_loader_ifc.ts", "test/integration/three-examples/webgl_loader_ldraw.ts", "test/integration/three-examples/webgl_loader_mmd.ts", "test/integration/three-examples/webgl_loader_obj_mtl.ts", From 7867e7ef05516b4e597080afad1c237d4a330c53 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 30 Jul 2023 14:33:09 -0400 Subject: [PATCH 4/4] Fix --- types/three/src/loaders/ImageLoader.d.ts | 2 +- types/three/src/loaders/TextureLoader.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/three/src/loaders/ImageLoader.d.ts b/types/three/src/loaders/ImageLoader.d.ts index d778d3fc8..b5e0caf12 100644 --- a/types/three/src/loaders/ImageLoader.d.ts +++ b/types/three/src/loaders/ImageLoader.d.ts @@ -10,7 +10,7 @@ export class ImageLoader extends Loader { load( url: string, - onLoad?: (data: HTMLImageElement, texData: object) => void, + onLoad?: (data: HTMLImageElement) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void, ): HTMLImageElement; diff --git a/types/three/src/loaders/TextureLoader.d.ts b/types/three/src/loaders/TextureLoader.d.ts index 68a10ef03..24ff85a2d 100644 --- a/types/three/src/loaders/TextureLoader.d.ts +++ b/types/three/src/loaders/TextureLoader.d.ts @@ -11,7 +11,7 @@ export class TextureLoader extends Loader { load( url: string, - onLoad?: (data: Texture, texData: object) => void, + onLoad?: (data: Texture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void, ): Texture;