[name]
Class for loading a .tga [page:DataTexture texture].
Example
// instantiate a loader
var loader = new v3d.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 v3d.MeshPhongMaterial({
color: 0xffffff,
map: texture
});
[example:webgl_materials_texture_tga]
Constructor
[name]([page:LoadingManager manager])
[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager v3d.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, which contains .[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).
[sourceHint]