DecalGeometry.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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">Decal projections without distortions</a>.</p>
  20. <p>Reference: <a href="http://blog.wolfire.com/2009/06/how-to-project-decals/">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">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">Mesh</span>, position : <span class="param-type">Vector3</span>, orientation : <span class="param-type">Euler</span>, size : <span class="param-type">Vector3</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"><code>mesh</code></td>
  43. <td class="description last"><p>The base mesh the decal should be projected on.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>position</code></td>
  47. <td class="description last"><p>The position of the decal projector.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>orientation</code></td>
  51. <td class="description last"><p>The orientation of the decal projector.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>size</code></td>
  55. <td class="description last"><p>Tje scale of the decal projector.</p></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. <h2 class="subsection-title">Source</h2>
  62. <p>
  63. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/DecalGeometry.js" target="_blank" rel="noopener" translate="no">examples/jsm/geometries/DecalGeometry.js</a>
  64. </p>
  65. </article>
  66. </section>
  67. <script src="../scripts/linenumber.js"></script>
  68. <script src="../scripts/page.js"></script>
  69. </body>
  70. </html>
粤ICP备19079148号