glTFLoader.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. [page:Loader] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">
  14. A loader for loading a <em>.gltf</em> resource in <em>JSON</em> format.
  15. <br /><br />
  16. The <a href="https://www.khronos.org/gltf">glTF file format</a> is a JSON file format to enable rapid delivery and loading of 3D content.
  17. </div>
  18. <h2>Constructor</h2>
  19. <h3>[name]( )</h3>
  20. <div>
  21. Creates a new [name].
  22. </div>
  23. <h2>Properties</h2>
  24. <h2>Methods</h2>
  25. <h3>[method:Object3D load]( [page:String url], [page:Function callback] )</h3>
  26. <div>
  27. [page:String url] — required<br />
  28. [page:Function callback] — Will be called when load completes. The argument will be an [page:Object] containing the loaded .[page:Object3D scene], .[page:Array cameras] and .[page:Array animations].<br />
  29. </div>
  30. <div>
  31. Begin loading from url and call the callback function with the parsed response content.
  32. </div>
  33. <h2>Notes</h2>
  34. <div>
  35. This class is often used with [page:glTFAnimator THREE.glTFAnimator] to animate parsed animations.
  36. </div>
  37. <h2>Example</h2>
  38. <code>
  39. // instantiate a loader
  40. var loader = new THREE.glTFLoader();
  41. // load a glTF resource
  42. loader.load(
  43. // resource URL
  44. 'models/gltf/duck/duck.json',
  45. // Function when resource is loaded
  46. function ( object ) {
  47. scene.add( object.scene );
  48. }
  49. );
  50. </code>
  51. [example:webgl_loader_gltf]
  52. <h2>Source</h2>
  53. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/gltf/glTFLoader.js examples/js/loaders/gltf/glTFLoader.js]
  54. </body>
  55. </html>