TextureLoader.js 559 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. THREE.TextureLoader = function ( crossOrigin ) {
  5. this.crossOrigin = crossOrigin;
  6. };
  7. THREE.TextureLoader.prototype = {
  8. constructor: THREE.TextureLoader,
  9. load: function ( url, onLoad ) {
  10. var texture = new THREE.Texture();
  11. var loader = new THREE.ImageLoader();
  12. loader.crossOrigin = this.crossOrigin;
  13. loader.load( url, function ( image ) {
  14. texture.image = image;
  15. texture.needsUpdate = true;
  16. if ( onLoad !== undefined ) {
  17. onLoad( texture );
  18. }
  19. } );
  20. return texture;
  21. }
  22. };