Loader.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. <h1>[name]</h1>
  11. <p class="desc">Base class for implementing loaders.</p>
  12. <h2>Constructor</h2>
  13. <h3>[name]( [param:LoadingManager manager] )</h3>
  14. <p>
  15. [page:LoadingManager manager] — The [page:LoadingManager loadingManager]
  16. for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  17. </p>
  18. <p>Creates a new [name].</p>
  19. <h2>Properties</h2>
  20. <h3>[property:String crossOrigin]</h3>
  21. <p>
  22. The crossOrigin string to implement CORS for loading the url from a
  23. different domain that allows CORS. Default is `anonymous`.
  24. </p>
  25. <h3>[property:Boolean withCredentials]</h3>
  26. <p>
  27. Whether the XMLHttpRequest uses credentials. See
  28. [page:.setWithCredentials]. Default is `false`.
  29. </p>
  30. <h3>[property:LoadingManager manager]</h3>
  31. <p>
  32. The [page:LoadingManager loadingManager] the loader is using. Default is
  33. [page:DefaultLoadingManager].
  34. </p>
  35. <h3>[property:String path]</h3>
  36. <p>
  37. The base path from which the asset will be loaded. Default is the empty
  38. string.
  39. </p>
  40. <h3>[property:String resourcePath]</h3>
  41. <p>
  42. The base path from which additional resources like textures will be
  43. loaded. Default is the empty string.
  44. </p>
  45. <h3>[property:Object requestHeader]</h3>
  46. <p>
  47. The [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header]
  48. used in HTTP request. See [page:.setRequestHeader].
  49. Default is empty object.
  50. </p>
  51. <h2>Methods</h2>
  52. <h3>[method:undefined load]()</h3>
  53. <p>
  54. This method needs to be implement by all concrete loaders. It holds the
  55. logic for loading the asset from the backend.
  56. </p>
  57. <h3>
  58. [method:Promise loadAsync]( [param:String url], [param:Function onProgress] )
  59. </h3>
  60. <p>
  61. [page:String url] — A string containing the path/URL of the file to be
  62. loaded.<br />
  63. [page:Function onProgress] (optional) — A function to be called while the
  64. loading is in progress. The argument will be the ProgressEvent instance,
  65. which contains .[page:Boolean lengthComputable], .[page:Integer total] and
  66. .[page:Integer loaded]. If the server does not set the Content-Length
  67. header; .[page:Integer total] will be 0.<br />
  68. </p>
  69. <p>
  70. This method is equivalent to [page:.load], but returns a
  71. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise].
  72. </p>
  73. <p>
  74. [page:Function onLoad] is handled by
  75. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve Promise.resolve]
  76. and [page:Function onError] is handled by
  77. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject Promise.reject].
  78. </p>
  79. <h3>[method:undefined parse]()</h3>
  80. <p>
  81. This method needs to be implement by all concrete loaders. It holds the
  82. logic for parsing the asset into three.js entities.
  83. </p>
  84. <h3>[method:this setCrossOrigin]( [param:String crossOrigin] )</h3>
  85. <p>
  86. [page:String crossOrigin] — The crossOrigin string to implement CORS for
  87. loading the url from a different domain that allows CORS.
  88. </p>
  89. <h3>[method:this setWithCredentials]( [param:Boolean value] )</h3>
  90. <p>
  91. Whether the XMLHttpRequest uses credentials such as cookies, authorization
  92. headers or TLS client certificates. See
  93. [link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
  94. Note that this has no effect if you are loading files locally or from the
  95. same domain.
  96. </p>
  97. <h3>[method:this setPath]( [param:String path] )</h3>
  98. <p>[page:String path] — Set the base path for the asset.</p>
  99. <h3>[method:this setResourcePath]( [param:String resourcePath] )</h3>
  100. <p>
  101. [page:String resourcePath] — Set the base path for dependent resources
  102. like textures.
  103. </p>
  104. <h3>[method:this setRequestHeader]( [param:Object requestHeader] )</h3>
  105. <p>
  106. [page:Object requestHeader] - key: The name of the header whose value is
  107. to be set. value: The value to set as the body of the header.<br /><br />
  108. Set the
  109. [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request.
  110. </p>
  111. <h2>Source</h2>
  112. <p>
  113. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  114. </p>
  115. </body>
  116. </html>