2
0

BabylonLoader.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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>Constructor</h2>
  14. <h3>[name]( [page:LoadingManager manager] )</h3>
  15. <div>
  16. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  17. </div>
  18. <div>
  19. Creates a new [name].
  20. </div>
  21. <h2>Properties</h2>
  22. <h2>Methods</h2>
  23. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  24. <div>
  25. [page:String url] — required<br />
  26. [page:function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D].<br />
  27. [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 />
  28. [page:function onError] — Will be called when load errors.<br />
  29. </div>
  30. <div>
  31. Begin loading from url and call onLoad with the parsed response content.
  32. </div>
  33. <h3>[method:Object3D parse]( [page:Object json] )</h3>
  34. <div>
  35. [page:Object json] — The <em>JSON</em> structure to parse.
  36. </div>
  37. <div>
  38. Parse a <em>JSON</em> structure and return an [page:Object3D object] or a [page:Scene scene].<br />
  39. Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshPhongMaterial].<br />
  40. Lights are parsed accordingly.
  41. </div>
  42. <h2>Example</h2>
  43. <code>
  44. // instantiate a loader
  45. var loader = new THREE.BabylonLoader();
  46. // load a Babylon resource
  47. loader.load(
  48. // resource URL
  49. 'models/babylon/skull.babylon',
  50. // Function when resource is loaded
  51. function ( object ) {
  52. scene.add( object );
  53. },
  54. // Function called when download progresses
  55. function ( xhr ) {
  56. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  57. },
  58. // Function called when download errors
  59. function ( xhr ) {
  60. console.log( 'An error happened' );
  61. }
  62. );
  63. </code>
  64. [example:webgl_loader_babylon]
  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>