HTMLMesh.html 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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">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"><code>dom</code></td>
  41. <td class="description last"><p>The DOM element to display as a plane mesh.</p></td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Methods</h2>
  48. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  49. <div class="method">
  50. <div class="description">
  51. <p>Frees the GPU-related resources allocated by this instance and removes all event listeners.
  52. Call this method whenever this instance is no longer used in your app.</p>
  53. </div>
  54. </div>
  55. <h2 class="subsection-title">Source</h2>
  56. <p>
  57. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/interactive/HTMLMesh.js" target="_blank" rel="noopener" translate="no">examples/jsm/interactive/HTMLMesh.js</a>
  58. </p>
  59. </article>
  60. </section>
  61. <script src="../scripts/linenumber.js"></script>
  62. <script src="../scripts/page.js"></script>
  63. </body>
  64. </html>
粤ICP备19079148号