OBJLoader.html 2.3 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 an <em>.obj</em> resource.</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].<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:String text] )</h3>
  34. <div>
  35. [page:String text] — The textual <em>obj</em> structure to parse.
  36. </div>
  37. <div>
  38. Returns an [page:Object3D]. It contains the parsed meshes as [page:Mesh] and lines as [page:LineSegments].<br />
  39. All geometry is created as [page:BufferGeometry]. Default materials are created as [page:MeshPhongMaterial].<br />
  40. If an <em>obj</em> object or group uses multiple materials while declaring faces geometry groups and an [page:MultiMaterial] is used.
  41. </div>
  42. <h2>Example</h2>
  43. <code>
  44. // instantiate a loader
  45. var loader = new THREE.OBJLoader();
  46. // load a resource
  47. loader.load(
  48. // resource URL
  49. 'models/monster.obj',
  50. // Function when resource is loaded
  51. function ( object ) {
  52. scene.add( object );
  53. }
  54. );
  55. </code>
  56. [example:webgl_loader_obj]
  57. <h2>Source</h2>
  58. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/OBJLoader.js examples/js/loaders/OBJLoader.js]
  59. </body>
  60. </html>