MTLLoader.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. <p class="desc">A loader for loading an <em>.mtl</em> resource, used internaly by [page:OBJLoader].<br />
  13. The Material Template Library format (MTL) or .MTL File Format is a companion file format to .OBJ that describes surface shading
  14. (material) properties of objects within one or more .OBJ files.
  15. </p>
  16. <h2>Constructor</h2>
  17. <h3>[name]( [param:LoadingManager loadingManager] )</h3>
  18. <p>
  19. [page:LoadingManager loadingManager] — LoadingManager to use. Defaults to [page:DefaultLoadingManager DefaultLoadingManager]<br />
  20. </p>
  21. <p>
  22. Creates a new [name].
  23. </p>
  24. <h2>Properties</h2>
  25. <h2>Methods</h2>
  26. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  27. <p>
  28. [page:String url] — A string containing the path/URL of the <em>.mtl</em> file.<br />
  29. [page:Function onLoad] — (optional) A function to be called after the loading is successfully completed. The function receives the loaded [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.<br />
  30. [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.<br />
  31. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  32. </p>
  33. <p>
  34. Begin loading from url and return the loaded material.
  35. </p>
  36. <h3>[method:MTLLoader setPath]( [param:String path] )</h3>
  37. <p>
  38. [page:String path] — required<br />
  39. </p>
  40. <p>
  41. Set base path for MTL file.
  42. </p>
  43. <h3>[method:MTLLoader setResourcePath]( [param:String path] )</h3>
  44. <p>
  45. [page:String path] — required<br />
  46. </p>
  47. <p>
  48. Set base path for additional resources like textures. If set, this path will be used as the base path.
  49. </p>
  50. <h3>[method:MTLLoader setCrossOrigin]( [param:String value] )</h3>
  51. <p>
  52. [page:String value] — required<br />
  53. </p>
  54. <p>
  55. If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
  56. attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
  57. </p>
  58. <h3>[method:MTLLoader setMaterialOptions]( [param:Object options] )</h3>
  59. <p>
  60. [page:Object options] — required
  61. <ul>
  62. <li>side: Which side to apply the material. THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide</li>
  63. <li>wrap: What type of wrapping to apply for textures. THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping</li>
  64. <li>normalizeRGB: RGBs need to be normalized to 0-1 from 0-255. Default: false, assumed to be already normalized</li>
  65. <li>ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. Default: false</li>
  66. <li>invertTrProperty: Use values 1 of Tr field for fully opaque. This option is useful for obj exported from 3ds MAX, vcglib or meshlab. Default: false</li>
  67. </ul>
  68. </p>
  69. <p>
  70. Set of options on how to construct the materials
  71. </p>
  72. <h3>[method:MTLLoaderMaterialCreator parse]( [param:String text, param:String path] )</h3>
  73. <p>
  74. [page:String text] — The textual <em>mtl</em> structure to parse.
  75. [page:String path] — The path to the MTL file.
  76. </p>
  77. <p>
  78. Parse a <em>mtl</em> text structure and return a [page:MTLLoaderMaterialCreator] instance.<br />
  79. </p>
  80. <h2>Source</h2>
  81. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/[name].js examples/js/loaders/[name].js]
  82. </body>
  83. </html>