Forum Replies Created
-
AuthorPosts
-
DzynekParticipant
Thank you for the answer :)
I inserting this function at the beginning document ATI2.js:
// preloader ImageLoader() fix THREE.ImageLoader.prototype = { load: function ( url, onLoad, onProgress, onError ) { var scope = this; var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' ); image.onload = function () { image.onload = null; URL.revokeObjectURL( image.src ); if ( onLoad ) onLoad( image ); scope.manager.itemEnd( url ); }; image.onerror = onError; var loader = new THREE.FileLoader(); loader.setPath( this.path ); loader.setResponseType( 'blob' ); loader.setWithCredentials( this.withCredentials ); loader.load( url, function ( blob ) { image.src = URL.createObjectURL( blob ); }, onProgress, onError ); scope.manager.itemStart( url ); return image; }, setCrossOrigin: function ( value ) { this.crossOrigin = value; return this; }, setWithCredentials: function ( value ) { this.withCredentials = value; return this; }, setPath: function ( value ) { this.path = value; return this; } }
Preloader work but, there was a problem when the image does not have time to load and (fast) hits the button again
I would be grateful for the solution
I attach an example
DzynekParticipantI forgot to add a file
DzynekParticipantHi
I tried to add a preloader function (ATI2.js, line 130) but unfortunately it does not work
var loader = new v3d.ImageLoader(); loader.load( diffuseURL, function(image) { obj.material.map.image = image; obj.material.map.needsUpdate = true; }, function ( xht ) { console.log( (xht.loaded / xht.total * 100) + '% loaded' ); }, function ( xhr ) { console.log( 'An error happened' ); } )
-
AuthorPosts