VTKLoader.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>VTKLoader - 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">VTKLoader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for the VTK format.</p>
  17. <p>This loader only supports the <code>POLYDATA</code> dataset format so far. Other formats
  18. (structured points, structured grid, rectilinear grid, unstructured grid, appended)
  19. are not supported.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const loader = new VTKLoader();
  22. const geometry = await loader.loadAsync( 'models/vtk/liver.vtk' );
  23. geometry.computeVertexNormals();
  24. const mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial() );
  25. scene.add( mesh );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <h2 class="subsection-title">Import</h2>
  30. <p><span translate="no">VTKLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  31. <pre><code class="language-js">import { VTKLoader } from 'three/addons/loaders/VTKLoader.js';</code></pre>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="VTKLoader" translate="no">new <a href="#VTKLoader">VTKLoader</a><span class="signature">( manager : <span class="param-type">LoadingManager</span> )</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new VTK loader.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name"><code>manager</code></td>
  43. <td class="description last"><p>The loading manager.</p></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Methods</h2>
  50. <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">onProgressCallback</span>, onError : <span class="param-type">onErrorCallback</span> )</span> </h3>
  51. <div class="method">
  52. <div class="description">
  53. <p>Starts loading from the given URL and passes the loaded VRML asset
  54. to the <code>onLoad()</code> callback.</p>
  55. </div>
  56. <table class="params">
  57. <tbody>
  58. <tr>
  59. <td class="name"><code>url</code></td>
  60. <td class="description last"><p>The path/URL of the file to be loaded. This can also be a data URI.</p></td>
  61. </tr>
  62. <tr>
  63. <td class="name"><code>onLoad</code></td>
  64. <td class="description last"><p>Executed when the loading process has been finished.</p></td>
  65. </tr>
  66. <tr>
  67. <td class="name"><code>onProgress</code></td>
  68. <td class="description last"><p>Executed while the loading is in progress.</p></td>
  69. </tr>
  70. <tr>
  71. <td class="name"><code>onError</code></td>
  72. <td class="description last"><p>Executed when errors occur.</p></td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. <dl class="details">
  77. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#load">Loader#load</a></dt>
  78. </dl>
  79. </div>
  80. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( data : <span class="param-type">ArrayBuffer</span> )</span><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  81. <div class="method">
  82. <div class="description">
  83. <p>Parses the given VTK data and returns the resulting geometry.</p>
  84. </div>
  85. <table class="params">
  86. <tbody>
  87. <tr>
  88. <td class="name"><code>data</code></td>
  89. <td class="description last"><p>The raw VTK data as an array buffer</p></td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. <dl class="details">
  94. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Loader.html#parse">Loader#parse</a></dt>
  95. </dl>
  96. <dl class="details">
  97. <dt class="tag-returns"><strong>Returns:</strong> The parsed geometry.</dt>
  98. </dl>
  99. </div>
  100. <h2 class="subsection-title">Source</h2>
  101. <p>
  102. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/VTKLoader.js" target="_blank" rel="noopener" translate="no">examples/jsm/loaders/VTKLoader.js</a>
  103. </p>
  104. </article>
  105. </section>
  106. <script src="../scripts/linenumber.js"></script>
  107. <script src="../scripts/page.js"></script>
  108. </body>
  109. </html>
粤ICP备19079148号