OBJLoader2.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 the loader
  16. var loader = new THREE.OBJLoader2();
  17. // function called on successful load
  18. var intergrateIntoScene = function ( object ) {
  19. scene.add( object );
  20. };
  21. // load a resource from provided URL
  22. loader.load( 'obj/female02/female02.obj', intergrateIntoScene );
  23. </code>
  24. [example:webgl_loader_obj2]
  25. <h2>Constructor</h2>
  26. <h3>[name]( [page:LoadingManager manager] )</h3>
  27. <div>
  28. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  29. </div>
  30. <div>
  31. Use [name] to load OBJ data from files or to parse OBJ data from arraybuffer or text.
  32. </div>
  33. <h2>Properties</h2>
  34. <h2>Methods</h2>
  35. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError], [page:Boolean useArrayBuffer] )</h3>
  36. <div>
  37. [page:String url] — URL of the file to load<br />
  38. [page:Function onLoad] — Called after loading was successfully completed. The argument will be the loaded [page:Object3D].<br />
  39. [page:Function onProgress] — Called to report progress of loading. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  40. [page:Function onError] Called after an error occurred during loading.<br />
  41. [page:boolean useArrayBuffer] — Set this to false to force string based parsing<br />
  42. </div>
  43. <div>
  44. Use this convenient method to load an OBJ file at the given URL. Per default the fileLoader uses an arraybuffer
  45. </div>
  46. <h3>[method:Object3D parse]( [page:ArrayBuffer arrayBuffer] )</h3>
  47. <div>
  48. [page:ArrayBuffer arrayBuffer] — OBJ data as Uint8Array
  49. </div>
  50. <div>
  51. Default parse function: Parses OBJ file content stored in arrayBuffer and returns the [page:Object3D sceneGraphBaseNode].
  52. </div>
  53. <h3>[method:Object3D parseText]( [page:String test] )</h3>
  54. <div>
  55. [page:String text] — OBJ data as string
  56. </div>
  57. <div>
  58. Legacy parse function: Parses OBJ file content stored in string and returns the [page:Object3D sceneGraphBaseNode].
  59. </div>
  60. <h3>[method:null setMaterials] ( Array of [page:Material materials] )</h3>
  61. <div>
  62. Array of [page:Material materials] — Array of [page:Material Materials] from MTLLoader
  63. </div>
  64. <div>
  65. Set materials loaded by MTLLoader or any other supplier of an Array of [page:Material Materials].
  66. </div>
  67. <h3>[method:null setPath] ( [page:String path] )</h3>
  68. <div>
  69. [page:String path] — The basePath
  70. </div>
  71. <div>
  72. Base path to use.
  73. </div>
  74. <h3>[method:null setSceneGraphBaseNode] ( [page:Object3D sceneGraphBaseNode] )</h3>
  75. <div>
  76. [page:Object3D sceneGraphBaseNode] — Scenegraph object where meshes will be attached
  77. </div>
  78. <div>
  79. Set the node where the loaded objects will be attached.
  80. </div>
  81. <h3>[method:null setDebug]( [page:Boolean parserDebug], [page:Boolean meshCreatorDebug] )</h3>
  82. <div>
  83. [page:Boolean parserDebug] — Internal Parser will produce debug output<br>
  84. [page:Boolean meshCreatorDebug] — Internal MeshCreator will produce debug output
  85. </div>
  86. <div>
  87. Allows to set debug mode for the parser and the meshCreator.
  88. </div>
  89. <h2>Source</h2>
  90. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/OBJLoader2.js examples/js/loaders/OBJLoader2.js]
  91. </body>
  92. </html>