Skip to content

Conversation

@linbingquan
Copy link
Contributor

related: #20370

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 17, 2020

It seems you can now delete the load() definition of KTX2Loader.

load(
url: string,
onLoad: ( texture: CompressedTexture ) => void,
onProgress?: ( event: ProgressEvent ) => void,
onError?: ( event: ErrorEvent ) => void
): CompressedTexture;

@linbingquan
Copy link
Contributor Author

linbingquan commented Sep 17, 2020

I am confused, I see the function is return CompressedTexture in L154.

load( url, onLoad, onProgress, onError ) {
var scope = this;
var texture = new CompressedTexture();
var bufferPending = new Promise( function ( resolve, reject ) {
new FileLoader( scope.manager )
.setPath( scope.path )
.setResponseType( 'arraybuffer' )
.load( url, resolve, onProgress, reject );
} );
this.initModule();
Promise.all( [ bufferPending, this.basisModulePending ] ).then( function ( [ buffer ] ) {
scope.parse( buffer, function ( _texture ) {
texture.copy( _texture );
texture.needsUpdate = true;
if ( onLoad ) onLoad( texture );
}, onError );
} );
return texture;
}

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 17, 2020

Why is this confusing for you^^?

@linbingquan
Copy link
Contributor Author

Why is this confusing for you^^?

Excuse me, This PR changed is right now?

and you want me to commit this change like it.

diff --git a/examples/jsm/loaders/KTX2Loader.d.ts b/examples/jsm/loaders/KTX2Loader.d.ts
index 1f1d25867..4a0c84ba7 100644
--- a/examples/jsm/loaders/KTX2Loader.d.ts
+++ b/examples/jsm/loaders/KTX2Loader.d.ts
@@ -17,7 +17,7 @@ export class KTX2Loader extends CompressedTextureLoader {
 		onLoad: ( texture: CompressedTexture ) => void,
 		onProgress?: ( event: ProgressEvent ) => void,
 		onError?: ( event: ErrorEvent ) => void
-	): CompressedTexture;
+	): void;
 
 	parse(
 		buffer: ArrayBuffer,

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 17, 2020

No, you can delete the entire method definition. Because it's identical to its upper class.

@mrdoob mrdoob added this to the r121 milestone Sep 17, 2020
@linbingquan
Copy link
Contributor Author

No, you can delete the entire method definition. Because it's identical to its upper class.

Thanks for your reply.

@mrdoob mrdoob merged commit a3acfb9 into mrdoob:dev Sep 17, 2020
@mrdoob
Copy link
Owner

mrdoob commented Sep 17, 2020

Thanks!

@linbingquan linbingquan deleted the dev-fix-ts branch September 25, 2020 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants