TubePainter.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TubePainter - 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. <h1 translate="no">TubePainter</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This module can be used to paint tube-like meshes
  16. along a sequence of points. This module is used in a XR
  17. painter demo.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const painter = new TubePainter();
  20. scene.add( painter.mesh );
  21. </code></pre></div>
  22. </header>
  23. <article>
  24. <h2 class="subsection-title">Import</h2>
  25. <p><span translate="no">TubePainter</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  26. <pre><code class="language-js">import { TubePainter } from 'three/addons/misc/TubePainter.js';</code></pre>
  27. <div class="container-overview">
  28. <h2>Constructor</h2>
  29. <h3 class="name name-method" id="TubePainter" translate="no">new <a href="#TubePainter">TubePainter</a><span class="signature">()</span> </h3>
  30. <div class="method">
  31. </div>
  32. </div>
  33. <h2 class="subsection-title">Properties</h2>
  34. <div class="member">
  35. <h3 class="name" id="mesh" translate="no">.<a href="#mesh">mesh</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  36. <div class="description">
  37. <p>The &quot;painted&quot; tube mesh. Must be added to the scene.</p>
  38. </div>
  39. </div>
  40. <h2 class="subsection-title">Methods</h2>
  41. <h3 class="name name-method" id="lineTo" translate="no">.<a href="#lineTo">lineTo</a><span class="signature">( position : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
  42. <div class="method">
  43. <div class="description">
  44. <p>Draw a stroke from the current position to the given one.
  45. This method extends the tube while drawing with the XR
  46. controllers.</p>
  47. </div>
  48. <table class="params">
  49. <tbody>
  50. <tr>
  51. <td class="name">
  52. <strong>position</strong>
  53. </td>
  54. <td class="description last">
  55. <p>The destination position.</p>
  56. </td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. </div>
  61. <h3 class="name name-method" id="moveTo" translate="no">.<a href="#moveTo">moveTo</a><span class="signature">( position : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
  62. <div class="method">
  63. <div class="description">
  64. <p>Moves the current painting position to the given value.</p>
  65. </div>
  66. <table class="params">
  67. <tbody>
  68. <tr>
  69. <td class="name">
  70. <strong>position</strong>
  71. </td>
  72. <td class="description last">
  73. <p>The new painting position.</p>
  74. </td>
  75. </tr>
  76. </tbody>
  77. </table>
  78. </div>
  79. <h3 class="name name-method" id="setColor" translate="no">.<a href="#setColor">setColor</a><span class="signature">( color : <span class="param-type"><a href="Color.html">Color</a></span> )</span> </h3>
  80. <div class="method">
  81. <div class="description">
  82. <p>Sets the color of newly rendered tube segments.</p>
  83. </div>
  84. <table class="params">
  85. <tbody>
  86. <tr>
  87. <td class="name">
  88. <strong>color</strong>
  89. </td>
  90. <td class="description last">
  91. <p>The color.</p>
  92. </td>
  93. </tr>
  94. </tbody>
  95. </table>
  96. </div>
  97. <h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( size : <span class="param-type">number</span> )</span> </h3>
  98. <div class="method">
  99. <div class="description">
  100. <p>Sets the size of newly rendered tube segments.</p>
  101. </div>
  102. <table class="params">
  103. <tbody>
  104. <tr>
  105. <td class="name">
  106. <strong>size</strong>
  107. </td>
  108. <td class="description last">
  109. <p>The size.</p>
  110. </td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. </div>
  115. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  116. <div class="method">
  117. <div class="description">
  118. <p>Updates the internal geometry buffers so the new painted
  119. segments are rendered.</p>
  120. </div>
  121. </div>
  122. <h2 class="subsection-title">Source</h2>
  123. <p>
  124. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/TubePainter.js" translate="no" target="_blank" rel="noopener">examples/jsm/misc/TubePainter.js</a>
  125. </p>
  126. </article>
  127. </section>
  128. <script src="../scripts/linenumber.js"></script>
  129. <script src="../scripts/page.js"></script>
  130. </body>
  131. </html>
粤ICP备19079148号