BabylonLoader.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. <p class="desc">A loader for loading a <em>.babylon</em> resource. <br />
  13. The <a href="https://doc.babylonjs.com/generals/file_format_map_(.babylon)"> .babylon </a> file format used by
  14. <a href="https://www.babylonjs.com/">Babylon.js</a>.
  15. </p>
  16. <h2>Example</h2>
  17. <code>
  18. // instantiate a loader
  19. var loader = new THREE.BabylonLoader();
  20. // load a Babylon resource
  21. loader.load(
  22. // resource URL
  23. 'models/babylon/skull.babylon',
  24. // called when resource is loaded
  25. function ( object ) {
  26. scene.add( object );
  27. },
  28. // called when loading is in progress
  29. function ( xhr ) {
  30. console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
  31. },
  32. // called when loading has errors
  33. function ( xhr ) {
  34. console.log( 'An error happened' );
  35. }
  36. );
  37. </code>
  38. [example:webgl_loader_babylon]
  39. <h2>Constructor</h2>
  40. <h3>[name]( [param:LoadingManager manager] )</h3>
  41. <p>
  42. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  43. </p>
  44. <p>
  45. Creates a new [name].
  46. </p>
  47. <h2>Properties</h2>
  48. <h2>Methods</h2>
  49. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  50. <p>
  51. [page:String url] — A string containing the path/URL of the <em>.babylon</em> file.<br />
  52. [page:function onLoad] — (optional) A function to be called after loading is successfully completed. The function receives the loaded [page:Object3D] as an argument.<br />
  53. [page:function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.<br />
  54. [page:function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  55. </p>
  56. <p>
  57. Begin loading from url and call onLoad with the parsed response content.
  58. </p>
  59. <h3>[method:Object3D parse]( [param:Object json] )</h3>
  60. <p>
  61. [page:Object json] — The <em>JSON</em> structure to parse.
  62. </p>
  63. <p>
  64. Parse a <em>JSON</em> structure and return an [page:Object3D object] or a [page:Scene scene].<br />
  65. Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshPhongMaterial].<br />
  66. Lights are parsed accordingly.
  67. </p>
  68. <h2>Source</h2>
  69. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/BabylonLoader.js examples/js/loaders/BabylonLoader.js]
  70. </body>
  71. </html>