From 91b76c15b2992ff27242aef127b0913ed9828a43 Mon Sep 17 00:00:00 2001 From: svignaud <153529557+svignaud@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:32:55 +0100 Subject: [PATCH 1/3] Fix KTX2Loader TS type to match the JS code KTX2Loader TS type derives from CompresssedTextureLoader, and overrides its parse method. The actual JS code derives KTX2Loader from Loader and overrides its load method. This change will fix this mismatch. --- types/three/examples/jsm/loaders/KTX2Loader.d.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/types/three/examples/jsm/loaders/KTX2Loader.d.ts b/types/three/examples/jsm/loaders/KTX2Loader.d.ts index 238e4845f..b4d09f6ad 100644 --- a/types/three/examples/jsm/loaders/KTX2Loader.d.ts +++ b/types/three/examples/jsm/loaders/KTX2Loader.d.ts @@ -1,7 +1,7 @@ -import { LoadingManager, CompressedTextureLoader, CompressedTexture, WebGLRenderer } from '../../../src/Three.js'; +import { LoadingManager, Loader, CompressedTexture, WebGLRenderer } from '../../../src/Three.js'; import WebGPURenderer from '../renderers/webgpu/WebGPURenderer.js'; -export class KTX2Loader extends CompressedTextureLoader { +export class KTX2Loader extends Loader { constructor(manager?: LoadingManager); setTranscoderPath(path: string): KTX2Loader; @@ -9,9 +9,10 @@ export class KTX2Loader extends CompressedTextureLoader { detectSupport(renderer: WebGLRenderer | WebGPURenderer): KTX2Loader; dispose(): KTX2Loader; - parse( - buffer: ArrayBuffer, + load( + url: string, onLoad: (texture: CompressedTexture) => void, + onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void, - ): KTX2Loader; + ): CompressedTexture; } From 55bd925cb623accfd9d42c79be62c9333ee75f0b Mon Sep 17 00:00:00 2001 From: svignaud <153529557+svignaud@users.noreply.github.com> Date: Mon, 11 Dec 2023 18:05:24 +0100 Subject: [PATCH 2/3] Update types/three/examples/jsm/loaders/KTX2Loader.d.ts Co-authored-by: Nathan Bierema --- types/three/examples/jsm/loaders/KTX2Loader.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/three/examples/jsm/loaders/KTX2Loader.d.ts b/types/three/examples/jsm/loaders/KTX2Loader.d.ts index b4d09f6ad..5edd99dc8 100644 --- a/types/three/examples/jsm/loaders/KTX2Loader.d.ts +++ b/types/three/examples/jsm/loaders/KTX2Loader.d.ts @@ -1,7 +1,7 @@ import { LoadingManager, Loader, CompressedTexture, WebGLRenderer } from '../../../src/Three.js'; import WebGPURenderer from '../renderers/webgpu/WebGPURenderer.js'; -export class KTX2Loader extends Loader { +export class KTX2Loader extends Loader { constructor(manager?: LoadingManager); setTranscoderPath(path: string): KTX2Loader; From b085b58fc8da5ad9f1eac90b144f122f851a0829 Mon Sep 17 00:00:00 2001 From: svignaud <153529557+svignaud@users.noreply.github.com> Date: Mon, 11 Dec 2023 18:08:07 +0100 Subject: [PATCH 3/3] Removed load method from KTX2Loader. --- types/three/examples/jsm/loaders/KTX2Loader.d.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/types/three/examples/jsm/loaders/KTX2Loader.d.ts b/types/three/examples/jsm/loaders/KTX2Loader.d.ts index 5edd99dc8..d2d076400 100644 --- a/types/three/examples/jsm/loaders/KTX2Loader.d.ts +++ b/types/three/examples/jsm/loaders/KTX2Loader.d.ts @@ -8,11 +8,4 @@ export class KTX2Loader extends Loader { setWorkerLimit(limit: number): KTX2Loader; detectSupport(renderer: WebGLRenderer | WebGPURenderer): KTX2Loader; dispose(): KTX2Loader; - - load( - url: string, - onLoad: (texture: CompressedTexture) => void, - onProgress?: (event: ProgressEvent) => void, - onError?: (event: ErrorEvent) => void, - ): CompressedTexture; }