[name]

Class for loading a .tga [page:DataTexture texture].

Constructor

[name]( [page:LoadingManager manager] )

[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
Creates a new [name].

Methods

[method:DataTexture load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )

[page:String url] — required
[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:DataTexture].
[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.
[page:Function onError] — Will be called when load errors.
Begin loading from url and pass the loaded [page:DataTexture texture] to onLoad. The [page:DataTexture texture] is also directly returned for immediate use (but may not be fully loaded).

Example

// instantiate a loader var loader = new THREE.TGALoader(); // load a resource var texture = loader.load( // resource URL 'textures/crate_grey8.tga' // Function when resource is loaded function ( texture ) { console.log( 'Texture is loaded' ); }, // Function called when download progresses function ( xhr ) { console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); }, // Function called when download errors function ( xhr ) { console.log( 'An error happened' ); } ); var material = new THREE.MeshPhongMaterial( { color: 0xffffff, map: texture } ); [example:webgl_materials_texture_tga]

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/TGALoader.js examples/js/loaders/TGALoader.js]