MTLLoader.html 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Loader] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">A loader for loading an `.mtl` resource, used internally 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>Import</h2>
  17. <p>
  18. [name] is an add-on, and must be imported explicitly.
  19. See [link:#manual/introduction/Installation Installation / Addons].
  20. </p>
  21. <code>
  22. import { MTLLoader } from 'three/addons/loaders/MTLLoader.js';
  23. </code>
  24. <h2>Constructor</h2>
  25. <h3>[name]( [param:LoadingManager loadingManager] )</h3>
  26. <p>
  27. [page:LoadingManager loadingManager] — LoadingManager to use. Defaults to [page:DefaultLoadingManager DefaultLoadingManager]<br />
  28. </p>
  29. <p>
  30. Creates a new [name].
  31. </p>
  32. <h2>Properties</h2>
  33. <p>See the base [page:Loader] class for common properties.</p>
  34. <h2>Methods</h2>
  35. <p>See the base [page:Loader] class for common methods.</p>
  36. <h3>[method:undefined load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  37. <p>
  38. [page:String url] — A string containing the path/URL of the `.mtl` file.<br />
  39. [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 />
  40. [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. If the server does not set the Content-Length header; .[page:Integer total] will be 0.<br />
  41. [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.<br />
  42. </p>
  43. <p>
  44. Begin loading from url and return the loaded material.
  45. </p>
  46. <h3>[method:this setMaterialOptions]( [param:Object options] )</h3>
  47. <p>
  48. [page:Object options] — required
  49. <ul>
  50. <li>side: Which side to apply the material. THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide</li>
  51. <li>wrap: What type of wrapping to apply for textures. THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping</li>
  52. <li>normalizeRGB: RGBs need to be normalized to 0-1 from 0-255. Default: false, assumed to be already normalized</li>
  53. <li>ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. Default: false</li>
  54. <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>
  55. </ul>
  56. </p>
  57. <p>
  58. Set of options on how to construct the materials
  59. </p>
  60. <h3>[method:MTLLoaderMaterialCreator parse]( [param:String text, param:String path] )</h3>
  61. <p>
  62. [page:String text] — The textual `mtl` structure to parse.
  63. [page:String path] — The path to the MTL file.
  64. </p>
  65. <p>
  66. Parse a `mtl` text structure and return a [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.<br />
  67. </p>
  68. <h2>Source</h2>
  69. <p>
  70. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/[name].js examples/jsm/loaders/[name].js]
  71. </p>
  72. </body>
  73. </html>