ObjectLoader.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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">A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the <em>.type</em> attributes of objects to map them to their original classes.</div>
  13. <h2>Constructor</h2>
  14. <h3>[name]( [page:LoadingManager manager] )</h3>
  15. <div>
  16. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  17. </div>
  18. <div>
  19. Creates a new [name].
  20. </div>
  21. <h2>Properties</h2>
  22. <h2>Methods</h2>
  23. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  24. <div>
  25. [page:String url] — required<br />
  26. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
  27. [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  28. [page:Function onError] — Will be called when load errors.<br />
  29. </div>
  30. <div>
  31. Begin loading from url and call onLoad with the parsed response content.
  32. </div>
  33. <h3>[method:Object3D parse]( [page:Object json] )</h3>
  34. <div>
  35. [page:Object json] — required. The JSON source to parse<br />
  36. </div>
  37. <div>
  38. Parse a <em>JSON</em> content and return a threejs object.
  39. </div>
  40. <h3>[method:null setCrossOrigin]( [page:String value] )</h3>
  41. <div>
  42. [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
  43. </div>
  44. <h2>Example</h2>
  45. <code>
  46. // instantiate a loader
  47. var loader = new THREE.ObjectLoader();
  48. // assuming we loaded a JSON structure from elsewhere
  49. var object = loader.parse( a_json_object );
  50. scene.add( object );
  51. </code>
  52. [example:webgl_loader_msgpack]
  53. <h2>Source</h2>
  54. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  55. </body>
  56. </html>