function waitReady( event ) {

			if ( event.type === 'load' ) {

				if ( event.content instanceof THREE.MTLLoader.MaterialCreator ) {

					// MTL file is loaded

					mtlDone = true;
					materialsCreator = event.content;
					materialsCreator.preload();

				} else {

					// OBJ file is loaded

					if ( event.target.status === 200 || event.target.status === 0 ) {

						var objContent = event.target.responseText;

						if ( mtlfileurl ) {

							// Parse with passed in MTL file

							obj3d = scope.parse( objContent );

						} else {

							// No passed in MTL file, look for mtlfile in obj file

							obj3d = scope.parse( objContent, function( mtlfile ) {

								mtlDone = false;
								mtlLoader.load( mtlLoader.baseUrl + mtlfile );

							} );

						}

					} else {

						// Error loading OBJ file....

						scope.dispatchEvent( {
							type: 'error',
							message: 'Couldn\'t load URL [' + url + ']',
							response: event.target.responseText } );

					}

				}

			} else if ( event.type === 'error' ) {

				// MTL failed to load -- oh well, we will just not have material ...

				mtlDone = true;

			}

			if ( mtlDone && obj3d ) {

				// MTL file is loaded and OBJ file is loaded
				// Apply materials to model

				if ( materialsCreator ) {

					obj3d.traverse( function( object ) {

						if ( object instanceof THREE.Mesh ) {

							if ( object.material.name ) {

								var material = materialsCreator.create( object.material.name );
								if ( material ) {

									object.material = material;

								}

							}

						}

					} );

				}

				// Notify listeners

				scope.dispatchEvent( { type: 'load', content: obj3d } );
			}

		}
Load a Wavefront OBJ file with materials (MTL file)

Loading progress is indicated by the following events:
  "load" event (successful loading): type = 'load', content = THREE.Object3D
  "error" event (error loading): type = 'load', message
  "progress" event (progress loading): type = 'progress', loaded, total

If the MTL file cannot be loaded, then a MeshLambertMaterial is used as a default
@param url - Location of OBJ file to load
@param mtlfileurl - MTL file to load (optional, if not specified, attempts to use MTL specified in OBJ file)
@param options - Options on how to interpret the material (see THREE.MTLLoader.MaterialCreator )