|
| 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] → |
| 12 | + <h1>[name]</h1> |
| 13 | + |
| 14 | + <div class="desc"> |
| 15 | + A loader for loading a <em>.gltf</em> resource in <em>JSON</em> format. |
| 16 | + <br /><br /> |
| 17 | + 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. |
| 18 | + </div> |
| 19 | + |
| 20 | + |
| 21 | + <h2>Constructor</h2> |
| 22 | + |
| 23 | + <h3>[name]( [page:LoadingManager manager] )</h3> |
| 24 | + <div> |
| 25 | + [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager]. |
| 26 | + </div> |
| 27 | + <div> |
| 28 | + Creates a new [name]. |
| 29 | + </div> |
| 30 | + |
| 31 | + <h2>Properties</h2> |
| 32 | + |
| 33 | + |
| 34 | + <h2>Methods</h2> |
| 35 | + |
| 36 | + <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3> |
| 37 | + <div> |
| 38 | + [page:String url] — required<br /> |
| 39 | + [page:Function onLoad] — Will be called when load completes. The argument will be the loaded JSON response returned from [page:Function parse].<br /> |
| 40 | + [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br /> |
| 41 | + [page:Function onError] — Will be called when load errors.<br /> |
| 42 | + </div> |
| 43 | + <div> |
| 44 | + Begin loading from url and call the callback function with the parsed response content. |
| 45 | + </div> |
| 46 | + |
| 47 | + <h3>[method:null setPath]( [page:String path] )</h3> |
| 48 | + <div> |
| 49 | + [page:String path] — Base path for loading additional resources e.g. textures, GLSL shaders, .bin data. |
| 50 | + </div> |
| 51 | + <div> |
| 52 | + Set the base path for additional resources. |
| 53 | + </div> |
| 54 | + |
| 55 | + <h3>[method:null setCrossOrigin]( [page:String value] )</h3> |
| 56 | + <div> |
| 57 | + [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. |
| 58 | + </div> |
| 59 | + |
| 60 | + <h3>[method:null parse]( [page:Object json], [page:Function callBack], [page:String path] )</h3> |
| 61 | + <div> |
| 62 | + [page:Object json] — <em>JSON</em> object to parse.<br /> |
| 63 | + [page:Function callBack] — Will be called when parse completes.<br /> |
| 64 | + [page:String path] — The base path from which to find subsequent glTF resources such as textures, GLSL shaders and .bin data files.<br /> |
| 65 | + </div> |
| 66 | + <div> |
| 67 | + Parse a glTF-based <em>JSON</em> structure and fire [page:Function callback] when complete. The argument to [page:Function callback] will be an [page:object] that contains loaded parts: .[page:Scene scene], .[page:Array cameras], .[page:Array animations] and .[page:Array shaders] |
| 68 | + </div> |
| 69 | + |
| 70 | + |
| 71 | + <h2>Notes</h2> |
| 72 | + |
| 73 | + <div> |
| 74 | + When using custom shaders provided within a glTF file [page:THREE.GLTFLoader.Shaders] should be updated on each render loop. See [example:webgl_loader_gltf] demo source code for example usage. |
| 75 | + </div> |
| 76 | + |
| 77 | + <div> |
| 78 | + This class is often used with [page:THREE.GLTFLoader.Animations THREE.GLTFLoader.Animations] to animate parsed animations. See [example:webgl_loader_gltf] demo source code for example usage. |
| 79 | + </div> |
| 80 | + |
| 81 | + <h2>Example</h2> |
| 82 | + |
| 83 | + <code> |
| 84 | + // instantiate a loader |
| 85 | + var loader = new THREE.GLTFLoader(); |
| 86 | + |
| 87 | + // load a glTF resource |
| 88 | + loader.load( |
| 89 | + // resource URL |
| 90 | + 'models/gltf/duck/duck.json', |
| 91 | + // Function when resource is loaded |
| 92 | + function ( object ) { |
| 93 | + scene.add( object.scene ); |
| 94 | + } |
| 95 | + ); |
| 96 | + </code> |
| 97 | + |
| 98 | + [example:webgl_loader_gltf] |
| 99 | + |
| 100 | + |
| 101 | + <h2>Source</h2> |
| 102 | + |
| 103 | + [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/GLTFLoader.js examples/js/loaders/GLTFLoader.js] |
| 104 | + </body> |
| 105 | +</html> |
0 commit comments