DecalGeometry.html 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>DecalGeometry - 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="BufferGeometry.html">BufferGeometry</a> → </p>
  13. <h1 translate="no">DecalGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class can be used to create a decal mesh that serves different kinds of purposes e.g.
  17. adding unique details to models, performing dynamic visual environmental changes or covering seams.</p>
  18. <p>Please not that decal projections can be distorted when used around corners. More information at
  19. this GitHub issue: <a href="https://github.com/mrdoob/three.js/issues/21187" target="_blank" rel="noopener">Decal projections without distortions</a>.</p>
  20. <p>Reference: <a href="http://blog.wolfire.com/2009/06/how-to-project-decals/" target="_blank" rel="noopener">How to project decals</a></p></div>
  21. <h2>Code Example</h2>
  22. <div translate="no"><pre><code class="language-js">const geometry = new DecalGeometry( mesh, position, orientation, size );
  23. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  24. const mesh = new THREE.Mesh( geometry, material );
  25. scene.add( mesh );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <h2 class="subsection-title">Import</h2>
  30. <p><span translate="no">DecalGeometry</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>
  31. <pre><code class="language-js">import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js';</code></pre>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="DecalGeometry" translate="no">new <a href="#DecalGeometry">DecalGeometry</a><span class="signature">( mesh : <span class="param-type"><a href="Mesh.html">Mesh</a></span>, position : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, orientation : <span class="param-type"><a href="Euler.html">Euler</a></span>, size : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new decal geometry.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name">
  43. <strong>mesh</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The base mesh the decal should be projected on.</p>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td class="name">
  51. <strong>position</strong>
  52. </td>
  53. <td class="description last">
  54. <p>The position of the decal projector.</p>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td class="name">
  59. <strong>orientation</strong>
  60. </td>
  61. <td class="description last">
  62. <p>The orientation of the decal projector.</p>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="name">
  67. <strong>size</strong>
  68. </td>
  69. <td class="description last">
  70. <p>The scale of the decal projector.</p>
  71. </td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. <h2 class="subsection-title">Source</h2>
  78. <p>
  79. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/DecalGeometry.js" translate="no" target="_blank" rel="noopener">examples/jsm/geometries/DecalGeometry.js</a>
  80. </p>
  81. </article>
  82. </section>
  83. <script src="../scripts/linenumber.js"></script>
  84. <script src="../scripts/page.js"></script>
  85. </body>
  86. </html>
粤ICP备19079148号