VertexNormalsHelper.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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">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">Object3D</span>, size : <span class="param-type">number</span>, color : <span class="param-type">number | Color | 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"><code>object</code></td>
  43. <td class="description last"><p>The object for which to visualize vertex normals.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>size</code></td>
  47. <td class="description last"><p>The helper's size.<br/>Default is <code>1</code>.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>color</code></td>
  51. <td class="description last"><p>The helper's color.<br/>Default is <code>0xff0000</code>.</p></td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. <h2 class="subsection-title">Properties</h2>
  58. <div class="member">
  59. <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>
  60. <div class="description">
  61. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="matrixAutoUpdate" translate="no">.<a href="#matrixAutoUpdate">matrixAutoUpdate</a><span class="type-signature"> : boolean</span> </h3>
  66. <div class="description">
  67. <p>Overwritten and set to <code>false</code> since the object's world transformation
  68. is encoded in the helper's geometry data.<br/>Default is <code>false</code>.</p>
  69. </div>
  70. <dl class="details">
  71. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="LineSegments.html#matrixAutoUpdate">LineSegments#matrixAutoUpdate</a></dt>
  72. </dl>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="object" translate="no">.<a href="#object">object</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  76. <div class="description">
  77. <p>The object for which to visualize vertex normals.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="size" translate="no">.<a href="#size">size</a><span class="type-signature"> : number</span> </h3>
  82. <div class="description">
  83. <p>The helper's size.<br/>Default is <code>1</code>.</p>
  84. </div>
  85. </div>
  86. <h2 class="subsection-title">Methods</h2>
  87. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  88. <div class="method">
  89. <div class="description">
  90. <p>Frees the GPU-related resources allocated by this instance. Call this
  91. method whenever this instance is no longer used in your app.</p>
  92. </div>
  93. </div>
  94. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  95. <div class="method">
  96. <div class="description">
  97. <p>Updates the vertex normals preview based on the object's world transform.</p>
  98. </div>
  99. </div>
  100. <h2 class="subsection-title">Source</h2>
  101. <p>
  102. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/VertexNormalsHelper.js" target="_blank" rel="noopener" translate="no">examples/jsm/helpers/VertexNormalsHelper.js</a>
  103. </p>
  104. </article>
  105. </section>
  106. <script src="../scripts/linenumber.js"></script>
  107. <script src="../scripts/page.js"></script>
  108. </body>
  109. </html>
粤ICP备19079148号