BabylonLoader.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1>
  12. <div class="desc">A loader for loading a <em>.babylon</em> resource.</div>
  13. <h2>Example</h2>
  14. <code>
  15. // instantiate a loader
  16. var loader = new THREE.BabylonLoader();
  17. // load a Babylon resource
  18. loader.load(
  19. // resource URL
  20. 'models/babylon/skull.babylon',
  21. // Function when resource is loaded
  22. function ( object ) {
  23. scene.add( object );
  24. },
  25. // Function called when download progresses
  26. function ( xhr ) {
  27. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  28. },
  29. // Function called when download errors
  30. function ( xhr ) {
  31. console.log( 'An error happened' );
  32. }
  33. );
  34. </code>
  35. [example:webgl_loader_babylon]
  36. <h2>Constructor</h2>
  37. <h3>[name]( [page:LoadingManager manager] )</h3>
  38. <div>
  39. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  40. </div>
  41. <div>
  42. Creates a new [name].
  43. </div>
  44. <h2>Properties</h2>
  45. <h2>Methods</h2>
  46. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  47. <div>
  48. [page:String url] — required<br />
  49. [page:function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D].<br />
  50. [page:function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  51. [page:function onError] — Will be called when load errors.<br />
  52. </div>
  53. <div>
  54. Begin loading from url and call onLoad with the parsed response content.
  55. </div>
  56. <h3>[method:Object3D parse]( [page:Object json] )</h3>
  57. <div>
  58. [page:Object json] — The <em>JSON</em> structure to parse.
  59. </div>
  60. <div>
  61. Parse a <em>JSON</em> structure and return an [page:Object3D object] or a [page:Scene scene].<br />
  62. Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshPhongMaterial].<br />
  63. Lights are parsed accordingly.
  64. </div>
  65. <h2>Source</h2>
  66. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/BabylonLoader.js examples/js/loaders/BabylonLoader.js]
  67. </body>
  68. </html>