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>Example</h2>
  14. <code>
  15. // instantiate a loader
  16. var loader = new THREE.OBJLoader();
  17. // load a resource
  18. loader.load(
  19. // resource URL
  20. 'models/monster.obj',
  21. // Function when resource is loaded
  22. function ( object ) {
  23. scene.add( object );
  24. }
  25. );
  26. </code>
  27. [example:webgl_loader_obj]
  28. <h2>Constructor</h2>
  29. <h3>[name]( [page:LoadingManager manager] )</h3>
  30. <div>
  31. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  32. </div>
  33. <div>
  34. Creates a new [name].
  35. </div>
  36. <h2>Properties</h2>
  37. <h2>Methods</h2>
  38. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  39. <div>
  40. [page:String url] — required<br />
  41. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D].<br />
  42. [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 />
  43. [page:Function onError] — Will be called when load errors.<br />
  44. </div>
  45. <div>
  46. Begin loading from url and call onLoad with the parsed response content.
  47. </div>
  48. <h3>[method:Object3D parse]( [page:String text] )</h3>
  49. <div>
  50. [page:String text] — The textual <em>obj</em> structure to parse.
  51. </div>
  52. <div>
  53. Returns an [page:Object3D]. It contains the parsed meshes as [page:Mesh] and lines as [page:LineSegments].<br />
  54. All geometry is created as [page:BufferGeometry]. Default materials are created as [page:MeshPhongMaterial].<br />
  55. If an <em>obj</em> object or group uses multiple materials while declaring faces geometry groups and a [page:MultiMaterial] is used.
  56. </div>
  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>