LoadingManager.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <div class="desc">Handles and keeps track of loaded and pending data.</div>
  12. <code>
  13. var manager = new THREE.LoadingManager();
  14. manager.onProgress = function ( item, loaded, total ) {
  15. console.log( item, loaded, total );
  16. };
  17. var loader = new THREE.OBJLoader( manager );
  18. loader.load( 'file.obj', function ( object ) {
  19. //
  20. } );
  21. </code>
  22. <h2>Constructor</h2>
  23. <h3>[name]( [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  24. <div>
  25. [page:Function onLoad] — The function that needs to be called when all loaders are done.<br />
  26. [page:Function onProgress] — The function that needs to be called when an item is complete.<br />
  27. [page:Function onError] — The function that needs to be called when an item is errors.
  28. </div>
  29. <div>
  30. Creates a [name].
  31. </div>
  32. <h2>Properties</h2>
  33. <h3>[property:Function onLoad]</h3>
  34. <div>
  35. The function that needs to be called when all loaders are done.
  36. </div>
  37. <h3>[property:Function onProgress]</h3>
  38. <div>
  39. The function that needs to be called when an item is complete. The arguments are url(The url of the item just loaded),<br />
  40. loaded(the amount of items already loaded), total( The total amount of items to be loaded.)
  41. </div>
  42. <h3>[property:Function onError]</h3>
  43. <div>
  44. The function that needs to be called when an item errors.
  45. </div>
  46. <h2>Methods</h2>
  47. <h3>[method:null itemStart]( [page:String url] )</h3>
  48. <div>
  49. [page:String url] — the url to load
  50. </div>
  51. <div>
  52. 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.
  53. </div>
  54. <h3>[method:null itemEnd]( [page:String url] )</h3>
  55. <div>
  56. [page:String url] — the loaded url
  57. </div>
  58. <div>
  59. 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.
  60. </div>
  61. <h2>Example</h2>
  62. [example:webgl_loader_obj]
  63. <h2>Source</h2>
  64. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  65. </body>
  66. </html>