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