threex.universalloader
threex.universalloader is a threex game extension for three.js. It provides an universal loader for models in three.js. You give it the url of your models and it will load it with the three.js loader suitable for its format.
Show Don't Tell
- examples/basic.html [view source] : It shows a basic usage of threex.universalloader.
A Screenshot
How To Install It
You can install it via script tag
<script src='threex.universalloader.js'></script>
Or you can install with bower, as you wish.
bower install threex.universalloader
How To Use It
Here is a basic usage. First you create the loader itself
var loader = new THREEx.UniversalLoader()
Then you trigger the loading of your model. Say you want to load a
model at models/monster.dae
var url = 'models/monster.dae'
loader.load(url, function(object3d){
// this function will be notified when the model is loaded
scene.add(object3d)
})
There is a special case for the OBJ/MTL models as they need 2 urls, one for the OBJ, one for the MTL. In this case, just provides both urls in a array like this.
var urls = ['models/monster.obj', 'models/monster.mtl']
loader.load(url, function(object3d){
// this function will be notified when the model is loaded
scene.add(object3d)
})