GLTFExporter.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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">
  13. An exporter for *glTF* 2.0.
  14. <br /><br />
  15. <a href="https://www.khronos.org/gltf">glTF</a> (GL Transmission Format) is an
  16. <a href="https://github.com/KhronosGroup/glTF/tree/master/specification/2.0">open format specification</a>
  17. for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf)
  18. or binary (.glb) format. External files store textures (.jpg, .png, ...) and additional binary
  19. data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials,
  20. textures, skins, skeletons, morph targets, animations, lights, and/or cameras.
  21. </div>
  22. <h2>Example</h2>
  23. <code>
  24. // Instantiate a exporter
  25. var exporter = new THREE.GLTFExporter( defaultOptions );
  26. // Parse the input and generate the glTF output
  27. exporter.parse( scene, function ( gltf ) {
  28. console.log( gltf );
  29. downloadJSON( gltf );
  30. }, options );
  31. </code>
  32. [example:misc_exporter_gltf]
  33. <h2>Constructor</h2>
  34. <h3>[name]( )</h3>
  35. <div>
  36. </div>
  37. <div>
  38. Creates a new [name].
  39. </div>
  40. <h2>Methods</h2>
  41. <h3>[method:null parse]( [page:Object input], [page:Function onCompleted], [page:Object options] )</h3>
  42. <div>
  43. [page:Object input] — Scenes or objects to export. Valid options:<br />
  44. <ul>
  45. <li>
  46. Export scenes
  47. <code>
  48. exporter.parse( scene1, ...)
  49. exporter.parse( [ scene1, scene2 ], ...)
  50. </code>
  51. </li>
  52. <li>
  53. Export objects (It will create a new Scene to hold all the objects)
  54. <code>
  55. exporter.parse( object1, ...)
  56. exporter.parse( [ object1, object2 ], ...)
  57. </code>
  58. </li>
  59. <li>
  60. Mix scenes and objects (It will export the scenes as usual but it will create a new scene to hold all the single objects).
  61. <code>
  62. exporter.parse( [ scene1, object1, object2, scene2 ], ...)
  63. </code>
  64. </ul>
  65. [page:Function onCompleted] — Will be called when the export completes. The argument will be the generated glTF JSON or binary ArrayBuffer.<br />
  66. [page:Options options] - Export options<br />
  67. <ul>
  68. <li>trs - bool. Export position, rotation and scale instead of matrix per node. Default is false</li>
  69. <li>onlyVisible - bool. Export only visible objects. Default is true.</li>
  70. <li>truncateDrawRange - bool. Export just the attributes within the drawRange, if defined, instead of exporting the whole array. Default is true.</li>
  71. <li>binary - bool. Export in binary (.glb) format, returning an ArrayBuffer. Default is false.</li>
  72. </ul>
  73. </div>
  74. <div>
  75. Generates a .gltf (JSON) or .glb (binary) output from the input (Scene or Objects)
  76. </div>
  77. <h2>Source</h2>
  78. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/exporters/GLTFExporter.js examples/js/exporters/GLTFExporter.js]
  79. </body>
  80. </html>