title: three.js order of loading resources
body: <p>I have a <strong>obj</strong> model that I'm loading via <a href="http://threejs.org/docs/#Reference/Loaders/LoadingManager" rel="nofollow">THREE.LoadingManager</a> and a few textures. When I'm opening the page with clear cache - I'm always getting model without textures. I can see them after pressing F5. My code looks like this:</p>
  
  <pre><code>var manager = new THREE.LoadingManager();    
  var loader = new THREE.TextureLoader(manager);
  var textures_loaded = 0;
  
  var id;
  for (id in materials) {
      loader.load('images/' + materials[id].unique_id + '.jpg', function(t) {
          t.magFilter = THREE.NearestFilter;
          t.minFilter = THREE.LinearMipMapLinearFilter;
  
          var re = /images\/(\d+)\.jpg/g;
          var result = re.exec(t.image.currentSrc);
  
          material = materials.filter(function(obj) {
              return obj.unique_id == result[1];
          }).shift();
  
          material.setTexture(t);
          textures_loaded += 1;
  
          if (textures_loaded == materials.length) {
              mainLoop();
          }
      });
  }
  
  var loader = new THREE.OBJLoader(manager);
  loader.load('obj/' + model.model_name, function (object) {
          object.traverse(function(child) {
              if (child instanceof THREE.Mesh) {
                  var mesh = model.meshes.filter(function(mesh) {
                      return mesh.name == child.name;
                  }).shift();
  
                  child.material.map = mesh.material.texture;
                  child.geometry.buffersNeedUpdate;
                  child.geometry.uvsNeedUpdate;
              }
          });
  
          scene.add(object);
      }
  );
  </code></pre>
  
  <p>I'm running <strong>mainLoop</strong> only after all textures are loaded. But sometimes model loads faster. How can I control order of loading objects using <strong>THREE.LoadingManager</strong> ?. How can I show model only after everything is loaded ?</p>