Loader.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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">Base class for implementing loaders.</p>
  13. <h2>Constructor</h2>
  14. <h3>[name]()</h3>
  15. <p>
  16. Creates a new [name]. This should be called as base class.
  17. </p>
  18. <h2>Properties</h2>
  19. <h3>[property:Function onLoadStart]</h3>
  20. <p>Will be called when load starts.</p>
  21. <p>The default is a function with empty body.</p>
  22. <h3>[property:Function onLoadProgress]</h3>
  23. <p>Will be called while load progresses.</p>
  24. <p>The default is a function with empty body.</p>
  25. <h3>[property:Function onLoadComplete]</h3>
  26. <p>Will be called when load completes.</p>
  27. <p>The default is a function with empty body.</p>
  28. <h3>[property:string crossOrigin]</h3>
  29. <p>
  30. The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
  31. Default is *"anonymous"*.
  32. </p>
  33. <h2>Methods</h2>
  34. <h3>[method:Material createMaterial]( [param:object m], [param:string texturePath] )</h3>
  35. <p>
  36. [page:Object m] — The parameters to create the material. <br />
  37. [page:String texturePath] — The base path of the textures.
  38. </p>
  39. <p>
  40. Creates the Material based on the parameters m.
  41. </p>
  42. <h3>[method:Array initMaterials]( [param:Array materials], [param:string texturePath] )</h3>
  43. <p>
  44. [page:Array materials] — an array of parameters to create materials. <br />
  45. [page:String texturePath] — The base path of the textures.
  46. </p>
  47. <p>
  48. Creates an array of [page:Material] based on the array of parameters m. The index of the parameters decide the correct index of the materials.
  49. </p>
  50. <h2>Handlers</h2>
  51. <p>
  52. *[name].Handlers* is a special object normally used by other loaders like [page:GLTFLoader] or [page:MTLLoader]. It provides an
  53. API that allows the definition of special mappings: What loaders should be used in order to load specific files. A typical use case
  54. is to overwrite the default loader for textures.<br /><br />
  55. Note: It's only possible to use *[name].Handlers* if the respective loader support the usage.
  56. </p>
  57. <h3>[method:null add]( [param:Object regex], [param:Loader loader] )</h3>
  58. <p>
  59. [page:Object regex] — A regular expression.<br />
  60. [page:Loader loader] — The loader.
  61. <p>
  62. Registers a loader with the given regular expression.
  63. </p>
  64. <h3>[method:null get]( [param:String file] )</h3>
  65. <p>
  66. [page:String file] — The file path.
  67. <p>
  68. Can be used to retrieve the registered loader for the given file path.
  69. </p>
  70. <h2>Source</h2>
  71. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  72. </body>
  73. </html>