glTFLoader.html 1.7 KB

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