mrdoob/three.js — pull request #4533 by sgrif (2014-03-05 19:11:27+00:00)
Title: Allow for texture files to be loaded from arbitrary locations

Due to the nature of the web as a platform, it's possible to have texture files live under a directory or file name that can not be known at the time the model file is created. In our particular use case, our texture files are at semi-random locations on Amazon S3, and the URL to load them is an expiring URL (causing the directory to be different for each file, and the file name to be essentially randomized).

The `ImageRegistry` class has been placed between the `Loader` and the actual process of loading an image from a URL. The default behavior of `texturePath + sourceFile` has been moved to this class. The registry can be given an alias for a file name. If no entry exists in the registry for a file, the default behavior will be used. Example:

```javascript
imageRegistry = new THREE.ImageRegistry();
imageRegistry.put('bar.png', 'baz.png');

imageRegistry.get('bar.png') // => 'baz.png'
imageRegistry.get('qux.png') // => 'qux.png'

imageRegistry.texturePath = 'foo/'

imageRegistry.get('bar.png') // => 'foo/baz.png'
imageRegistry.get('qux.png') // => 'foo/qux.png'
```