|
@@ -10,12 +10,52 @@
|
|
|
<body>
|
|
|
<h1>[name]</h1>
|
|
|
|
|
|
- <div class="desc">Handles and keeps track of loaded and pending data.</div>
|
|
|
+ <div class="desc">
|
|
|
+ Handles and keeps track of loaded and pending data. A default global instance of this class
|
|
|
+ is created and used by loaders if not supplied manually - see [page:DefaultLoadingManager].<br /><br />
|
|
|
+
|
|
|
+ In general that should be sufficient, however there are times when it can be useful to have seperate loaders -
|
|
|
+ for example if you want to show seperate loading bars for objects and textures.
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <h2>Example</h2>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ [example:webgl_loader_babylon WebGL / loader / babylon]<br />
|
|
|
+ [example:webgl_loader_fbx WebGL / loader / fbx]<br />
|
|
|
+ [example:webgl_loader_obj WebGL / loader / obj]<br />
|
|
|
+ [example:webgl_materials_reflectivity WebGL / materials / reflectivity]<br />
|
|
|
+ [example:webgl_postprocessing_outline WebGL / postprocesing / outline]<br />
|
|
|
+ [example:webgl_terrain_dynamic WebGL / terrain / dynamic]
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
<code>
|
|
|
var manager = new THREE.LoadingManager();
|
|
|
- manager.onProgress = function ( item, loaded, total ) {
|
|
|
+ manager.onStart = function ( url, itemsLoaded, itemsTotal ) {
|
|
|
+
|
|
|
+ console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ manager.onLoad = function ( ) {
|
|
|
+
|
|
|
+ console.log( 'Loading complete!');
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ manager.onProgress = function ( url, itemsLoaded, itemsTotal ) {
|
|
|
+
|
|
|
+ console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ manager.onError = function ( url ) {
|
|
|
|
|
|
- console.log( item, loaded, total );
|
|
|
+ console.log( 'There was an error loading ' + url );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -32,57 +72,81 @@
|
|
|
|
|
|
<h3>[name]( [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
|
|
|
<div>
|
|
|
- [page:Function onLoad] — The function that needs to be called when all loaders are done.<br />
|
|
|
- [page:Function onProgress] — The function that needs to be called when an item is complete.<br />
|
|
|
- [page:Function onError] — The function that needs to be called when an item is errors.
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- Creates a [name].
|
|
|
+ [page:Function onLoad] — (optional) this function will be called when all loaders are done.<br />
|
|
|
+ [page:Function onProgress] — (optional) this function will be called when an item is complete.<br />
|
|
|
+ [page:Function onError] — (optional) this function will be called a loader encounters errors. <br />
|
|
|
+
|
|
|
+ Creates a new [name].
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<h2>Properties</h2>
|
|
|
|
|
|
+ <h3>[property:Function onStart]</h3>
|
|
|
+ <div>
|
|
|
+ This function will be called when loading starts.
|
|
|
+ The arguments are:<br />
|
|
|
+ [page:String url] — The url of the item just loaded.<br />
|
|
|
+ [page:Integer itemsLoaded] — the number of items already loaded so far.<br />
|
|
|
+ [page:Iteger itemsTotal] — the total amount of items to be loaded.<br /><br />
|
|
|
+
|
|
|
+ By default this is undefined.
|
|
|
+ </div>
|
|
|
+
|
|
|
<h3>[property:Function onLoad]</h3>
|
|
|
<div>
|
|
|
- The function that needs to be called when all loaders are done.
|
|
|
+ This function will be called when all loading is completed. By default this is undefined,
|
|
|
+ unless passed in the constructor.
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Function onProgress]</h3>
|
|
|
<div>
|
|
|
- The function that needs to be called when an item is complete. The arguments are url(The url of the item just loaded),<br />
|
|
|
- loaded(the amount of items already loaded), total( The total amount of items to be loaded.)
|
|
|
+ This function will be called when an item is complete.
|
|
|
+ The arguments are:<br />
|
|
|
+ [page:String url] — The url of the item just loaded.<br />
|
|
|
+ [page:Integer itemsLoaded] — the number of items already loaded so far.<br />
|
|
|
+ [page:Iteger itemsTotal] — the total amount of items to be loaded.<br /><br />
|
|
|
+
|
|
|
+ By default this is undefined, unless passed in the constructor.
|
|
|
</div>
|
|
|
|
|
|
<h3>[property:Function onError]</h3>
|
|
|
<div>
|
|
|
- The function that needs to be called when an item errors.
|
|
|
+ This function will be called when any item errors, with the argument:<br />
|
|
|
+ [page:String url] — The url of the item that errored.<br /><br />
|
|
|
+
|
|
|
+ By default this is undefined, unless passed in the constructor.
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<h2>Methods</h2>
|
|
|
|
|
|
- <h3>[method:null itemStart]( [page:String url] )</h3>
|
|
|
<div>
|
|
|
- [page:String url] — the url to load
|
|
|
+ <em>Note: The following methods are designed to be called internally by loaders. You shouldn't call
|
|
|
+ them directly.</em>
|
|
|
</div>
|
|
|
+
|
|
|
+ <h3>[method:null itemStart]( [page:String url] )</h3>
|
|
|
<div>
|
|
|
- This should be called by any loader used by the manager when the loader starts loading an url. These shouldn't be called outside a loader.
|
|
|
+ [page:String url] — the url to load<br /><br />
|
|
|
+
|
|
|
+ This should be called by any loader used by the manager when the loader starts loading an url.
|
|
|
</div>
|
|
|
|
|
|
<h3>[method:null itemEnd]( [page:String url] )</h3>
|
|
|
<div>
|
|
|
- [page:String url] — the loaded url
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- This should be called by any loader used by the manager when the loader ended loading an url. These shouldn't be called outside a loader.
|
|
|
- </div>
|
|
|
+ [page:String url] — the loaded url<br /><br />
|
|
|
|
|
|
+ This should be called by any loader used by the manager when the loader ended loading an url.
|
|
|
+ </div>
|
|
|
|
|
|
- <h2>Example</h2>
|
|
|
|
|
|
- [example:webgl_loader_obj]
|
|
|
+ <h3>[method:null itemError]( [page:String url] )</h3>
|
|
|
+ <div>
|
|
|
+ [page:String url] — the loaded url<br /><br />
|
|
|
|
|
|
+ This should be called by any loader used by the manager when the loader errors loading an url.
|
|
|
+ </div>
|
|
|
|
|
|
<h2>Source</h2>
|
|
|
|