123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../" />
- <script src="list.js"></script>
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- [page:Loader] →
- <h1>[name]</h1>
- <div class="desc">A loader for loading objects in JSON format.</div>
- <h2>Constructor</h2>
- <h3>[name]()</h3>
- <div>
- Creates a new [name].
- </div>
- <h2>Properties</h2>
- <h3>[property:boolean withCredentials]</h3>
- <div>
- If true, the ajax request will use cookies.
- </div>
- <h2>Methods</h2>
- <h3>[method:null load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
- <div>
- [page:String url] — required<br />
- [page:Function callback] — required. Will be called when load completes. The arguments will be the loaded [page:Object3D] and the loaded [page:Array materials].<br />
- [page:String texturePath] — optional. If not specified, textures will be assumed to be in the same folder as the Javascript model file.
- </div>
- <h3>[method:Object3D parse]( [page:Object json], [page:String texturePath] )</h3>
- <div>
- [page:String json] — JSON object to parse.<br />
- [page:String texturePath] — Base path for textures.
- </div>
- <div>
- Parse a <em>JSON</em> structure and return an [page:Object] containing the parsed .[page:Geometry] and .[page:Array materials].
- </div>
- <h2>Example</h2>
- <code>
- // instantiate a loader
- var loader = new THREE.JSONLoader();
- // load a resource
- loader.load(
- // resource URL
- 'models/animated/monster/monster.js',
- // Function when resource is loaded
- function ( geometry, materials ) {
- var material = new THREE.MeshFaceMaterial( materials );
- var object = new THREE.Mesh( geometry, material );
- scene.add( object );
- }
- );
- </code>
- [example:webgl_loader_json_blender]
- <h2>Source</h2>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </body>
- </html>
|