NodeLoader.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>NodeLoader - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="Loader.html">Loader</a> → </p>
  13. <h1 translate="no">NodeLoader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for loading node objects in the three.js JSON Object/Scene format.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="NodeLoader" translate="no">new <a href="#NodeLoader">NodeLoader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Constructs a new node loader.</p>
  25. </div>
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name"><code>manager</code></td>
  30. <td class="description last"><p>A reference to a loading manager.</p></td>
  31. </tr>
  32. </tbody>
  33. </table>
  34. </div>
  35. </div>
  36. <h2 class="subsection-title">Properties</h2>
  37. <div class="member">
  38. <h3 class="name" id="nodes" translate="no">.<a href="#nodes">nodes</a><span class="type-signature"> : Object.&lt;string, Node.constructor></span> </h3>
  39. <div class="description">
  40. <p>Represents a dictionary of node types.</p>
  41. </div>
  42. </div>
  43. <div class="member">
  44. <h3 class="name" id="textures" translate="no">.<a href="#textures">textures</a><span class="type-signature"> : Object.&lt;string, <a href="Texture.html">Texture</a>></span> </h3>
  45. <div class="description">
  46. <p>Represents a dictionary of textures.</p>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Methods</h2>
  50. <h3 class="name name-method" id="createNodeFromType" translate="no">.<a href="#createNodeFromType">createNodeFromType</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  51. <div class="method">
  52. <div class="description">
  53. <p>Creates a node object from the given type.</p>
  54. </div>
  55. <table class="params">
  56. <tbody>
  57. <tr>
  58. <td class="name"><code>type</code></td>
  59. <td class="description last"><p>The node type.</p></td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. <dl class="details">
  64. <dt class="tag-returns"><strong>Returns:</strong> The created node instance.</dt>
  65. </dl>
  66. </div>
  67. <h3 class="name name-method" id="load" translate="no">.<a href="#load">load</a><span class="signature">( url : <span class="param-type">string</span>, onLoad : <span class="param-type">function</span>, onProgress : <span class="param-type">function</span>, onError : <span class="param-type">function</span> )</span> </h3>
  68. <div class="method">
  69. <div class="description">
  70. <p>Loads the node definitions from the given URL.</p>
  71. </div>
  72. <table class="params">
  73. <tbody>
  74. <tr>
  75. <td class="name"><code>url</code></td>
  76. <td class="description last"><p>The path/URL of the file to be loaded.</p></td>
  77. </tr>
  78. <tr>
  79. <td class="name"><code>onLoad</code></td>
  80. <td class="description last"><p>Will be called when load completes.</p></td>
  81. </tr>
  82. <tr>
  83. <td class="name"><code>onProgress</code></td>
  84. <td class="description last"><p>Will be called while load progresses.</p></td>
  85. </tr>
  86. <tr>
  87. <td class="name"><code>onError</code></td>
  88. <td class="description last"><p>Will be called when errors are thrown during the loading process.</p></td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. <dl class="details">
  93. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
  94. </dl>
  95. </div>
  96. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( json : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
  97. <div class="method">
  98. <div class="description">
  99. <p>Parses the node from the given JSON.</p>
  100. </div>
  101. <table class="params">
  102. <tbody>
  103. <tr>
  104. <td class="name"><code>json</code></td>
  105. <td class="description last"><p>The JSON definition</p>
  106. <h6>Properties</h6>
  107. <table class="params">
  108. <tbody>
  109. <tr>
  110. <td class="name"><code>type</code></td>
  111. <td class="description last"><p>The node type.</p></td>
  112. </tr>
  113. <tr>
  114. <td class="name"><code>uuid</code></td>
  115. <td class="description last"><p>The node UUID.</p></td>
  116. </tr>
  117. <tr>
  118. <td class="name"><code>nodes</code></td>
  119. <td class="description last"><p>The node dependencies.</p></td>
  120. </tr>
  121. <tr>
  122. <td class="name"><code>meta</code></td>
  123. <td class="description last"><p>The meta data.</p></td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. </td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. <dl class="details">
  132. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
  133. </dl>
  134. <dl class="details">
  135. <dt class="tag-returns"><strong>Returns:</strong> The parsed node.</dt>
  136. </dl>
  137. </div>
  138. <h3 class="name name-method" id="parseNodes" translate="no">.<a href="#parseNodes">parseNodes</a><span class="signature">( json : <span class="param-type">Array.&lt;Object></span> )</span><span class="type-signature"> : Object.&lt;string, <a href="Node.html">Node</a>></span> </h3>
  139. <div class="method">
  140. <div class="description">
  141. <p>Parse the node dependencies for the loaded node.</p>
  142. </div>
  143. <table class="params">
  144. <tbody>
  145. <tr>
  146. <td class="name"><code>json</code></td>
  147. <td class="description last"><p>The JSON definition</p></td>
  148. </tr>
  149. </tbody>
  150. </table>
  151. <dl class="details">
  152. <dt class="tag-returns"><strong>Returns:</strong> A dictionary with node dependencies.</dt>
  153. </dl>
  154. </div>
  155. <h3 class="name name-method" id="setNodes" translate="no">.<a href="#setNodes">setNodes</a><span class="signature">( value : <span class="param-type">Object.&lt;string, Node.constructor></span> )</span><span class="type-signature"> : <a href="NodeLoader.html">NodeLoader</a></span> </h3>
  156. <div class="method">
  157. <div class="description">
  158. <p>Defines the dictionary of node types.</p>
  159. </div>
  160. <table class="params">
  161. <tbody>
  162. <tr>
  163. <td class="name"><code>value</code></td>
  164. <td class="description last"><p>The node library defined as <code>&lt;classname,class&gt;</code>.</p></td>
  165. </tr>
  166. </tbody>
  167. </table>
  168. <dl class="details">
  169. <dt class="tag-returns"><strong>Returns:</strong> A reference to this loader.</dt>
  170. </dl>
  171. </div>
  172. <h3 class="name name-method" id="setTextures" translate="no">.<a href="#setTextures">setTextures</a><span class="signature">( value : <span class="param-type">Object.&lt;string, Texture></span> )</span><span class="type-signature"> : <a href="NodeLoader.html">NodeLoader</a></span> </h3>
  173. <div class="method">
  174. <div class="description">
  175. <p>Defines the dictionary of textures.</p>
  176. </div>
  177. <table class="params">
  178. <tbody>
  179. <tr>
  180. <td class="name"><code>value</code></td>
  181. <td class="description last"><p>The texture library defines as <code>&lt;uuid,texture&gt;</code>.</p></td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. <dl class="details">
  186. <dt class="tag-returns"><strong>Returns:</strong> A reference to this loader.</dt>
  187. </dl>
  188. </div>
  189. <h2 class="subsection-title">Source</h2>
  190. <p>
  191. <a href="https://github.com/mrdoob/three.js/blob/master/src/loaders/nodes/NodeLoader.js" target="_blank" rel="noopener" translate="no">src/loaders/nodes/NodeLoader.js</a>
  192. </p>
  193. </article>
  194. </section>
  195. <script src="../scripts/linenumber.js"></script>
  196. <script src="../scripts/page.js"></script>
  197. </body>
  198. </html>
粤ICP备19079148号