HTMLMesh.html 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>HTMLMesh - 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="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Mesh.html">Mesh</a> → </p>
  13. <h1 translate="no">HTMLMesh</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class can be used to render a DOM element onto a canvas and use it as a texture
  17. for a plane mesh.</p>
  18. <p>A typical use case for this class is to render the GUI of <code>lil-gui</code> as a texture so it
  19. is compatible for VR.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const gui = new GUI( { width: 300 } ); // create lil-gui instance
  22. const mesh = new HTMLMesh( gui.domElement );
  23. scene.add( mesh );
  24. </code></pre></div>
  25. </header>
  26. <article>
  27. <h2 class="subsection-title">Import</h2>
  28. <p><span translate="no">HTMLMesh</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>
  29. <pre><code class="language-js">import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';</code></pre>
  30. <div class="container-overview">
  31. <h2>Constructor</h2>
  32. <h3 class="name name-method" id="HTMLMesh" translate="no">new <a href="#HTMLMesh">HTMLMesh</a><span class="signature">( dom : <span class="param-type">HTMLElement</span> )</span> </h3>
  33. <div class="method">
  34. <div class="description">
  35. <p>Constructs a new HTML mesh.</p>
  36. </div>
  37. <table class="params">
  38. <tbody>
  39. <tr>
  40. <td class="name">
  41. <strong>dom</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The DOM element to display as a plane mesh.</p>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Methods</h2>
  52. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  53. <div class="method">
  54. <div class="description">
  55. <p>Frees the GPU-related resources allocated by this instance and removes all event listeners.
  56. Call this method whenever this instance is no longer used in your app.</p>
  57. </div>
  58. </div>
  59. <h2 class="subsection-title">Source</h2>
  60. <p>
  61. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/interactive/HTMLMesh.js" translate="no" target="_blank" rel="noopener">examples/jsm/interactive/HTMLMesh.js</a>
  62. </p>
  63. </article>
  64. </section>
  65. <script src="../scripts/linenumber.js"></script>
  66. <script src="../scripts/page.js"></script>
  67. </body>
  68. </html>
粤ICP备19079148号