VertexNormalsHelper.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>VertexNormalsHelper - 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="Line.html">Line</a> → <a href="LineSegments.html">LineSegments</a> → </p>
  13. <h1 translate="no">VertexNormalsHelper</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Visualizes an object's vertex normals.</p>
  17. <p>Requires that normals have been specified in the geometry as a buffer attribute or
  18. have been calculated using <a href="BufferGeometry.html#computeVertexNormals">BufferGeometry#computeVertexNormals</a>.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
  21. const material = new THREE.MeshStandardMaterial();
  22. const mesh = new THREE.Mesh( geometry, material );
  23. scene.add( mesh );
  24. const helper = new VertexNormalsHelper( mesh, 1, 0xff0000 );
  25. scene.add( helper );
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <h2 class="subsection-title">Import</h2>
  30. <p><span translate="no">VertexNormalsHelper</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 { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js';</code></pre>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="VertexNormalsHelper" translate="no">new <a href="#VertexNormalsHelper">VertexNormalsHelper</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, size : <span class="param-type">number</span>, color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span> )</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new vertex normals helper.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name">
  43. <strong>object</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The object for which to visualize vertex normals.</p>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td class="name">
  51. <strong>size</strong>
  52. </td>
  53. <td class="description last">
  54. <p>The helper's size.</p>
  55. <p>Default is <code>1</code>.</p>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td class="name">
  60. <strong>color</strong>
  61. </td>
  62. <td class="description last">
  63. <p>The helper's color.</p>
  64. <p>Default is <code>0xff0000</code>.</p>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </div>
  70. </div>
  71. <h2 class="subsection-title">Properties</h2>
  72. <div class="member">
  73. <h3 class="name" id="isVertexNormalsHelper" translate="no">.<a href="#isVertexNormalsHelper">isVertexNormalsHelper</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  74. <div class="description">
  75. <p>This flag can be used for type testing.</p>
  76. <p>Default is <code>true</code>.</p>
  77. </div>
  78. </div>
  79. <div class="member">
  80. <h3 class="name" id="matrixAutoUpdate" translate="no">.<a href="#matrixAutoUpdate">matrixAutoUpdate</a><span class="type-signature"> : boolean</span> </h3>
  81. <div class="description">
  82. <p>Overwritten and set to <code>false</code> since the object's world transformation
  83. is encoded in the helper's geometry data.</p>
  84. <p>Default is <code>false</code>.</p>
  85. </div>
  86. <dl class="details">
  87. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LineSegments.html#matrixAutoUpdate">LineSegments#matrixAutoUpdate</a></dt>
  88. </dl>
  89. </div>
  90. <div class="member">
  91. <h3 class="name" id="object" translate="no">.<a href="#object">object</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  92. <div class="description">
  93. <p>The object for which to visualize vertex normals.</p>
  94. </div>
  95. </div>
  96. <div class="member">
  97. <h3 class="name" id="size" translate="no">.<a href="#size">size</a><span class="type-signature"> : number</span> </h3>
  98. <div class="description">
  99. <p>The helper's size.</p>
  100. <p>Default is <code>1</code>.</p>
  101. </div>
  102. </div>
  103. <h2 class="subsection-title">Methods</h2>
  104. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  105. <div class="method">
  106. <div class="description">
  107. <p>Frees the GPU-related resources allocated by this instance. Call this
  108. method whenever this instance is no longer used in your app.</p>
  109. </div>
  110. </div>
  111. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  112. <div class="method">
  113. <div class="description">
  114. <p>Updates the vertex normals preview based on the object's world transform.</p>
  115. </div>
  116. </div>
  117. <h2 class="subsection-title">Source</h2>
  118. <p>
  119. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/VertexNormalsHelper.js" translate="no" target="_blank" rel="noopener">examples/jsm/helpers/VertexNormalsHelper.js</a>
  120. </p>
  121. </article>
  122. </section>
  123. <script src="../scripts/linenumber.js"></script>
  124. <script src="../scripts/page.js"></script>
  125. </body>
  126. </html>
粤ICP备19079148号