VertexTangentsHelper.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr; [page:Line] &rarr; [page:LineSegments] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. Visualizes an object's vertex tangents.
  14. Requires that tangents have been specified in a [page:BufferAttribute custom attribute] or
  15. have been calculated using [page:BufferGeometry.computeTangents computeTangents].<br /><br />
  16. </p>
  17. <h2>Import</h2>
  18. <p>
  19. [name] is an add-on, and must be imported explicitly.
  20. See [link:#manual/introduction/Installation Installation / Addons].
  21. </p>
  22. <code>
  23. import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js';
  24. </code>
  25. <h2>Code Example</h2>
  26. <code>
  27. const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
  28. const material = new THREE.MeshStandardMaterial();
  29. const mesh = new THREE.Mesh( geometry, material );
  30. const helper = new VertexTangentsHelper( mesh, 1, 0x00ffff );
  31. scene.add( mesh );
  32. scene.add( helper );
  33. </code>
  34. <h2>Examples</h2>
  35. <p>
  36. [example:webgl_helpers WebGL / helpers]
  37. </p>
  38. <h2>Constructor</h2>
  39. <h3>[name]( [param:Object3D object], [param:Number size], [param:Hex color] )</h3>
  40. <p>
  41. [page:Object3D object] -- object for which to render vertex tangents.<br />
  42. [page:Number size] -- (optional) length of the arrows. Default is *1*.<br />
  43. [page:Hex color] -- (optional) hex color of the arrows. Default is *0x00ffff*.
  44. </p>
  45. <h2>Properties</h2>
  46. <p>See the base [page:LineSegments] class for common properties.</p>
  47. <h3>[property:Object matrixAutoUpdate]</h3>
  48. <p>
  49. See [page:Object3D.matrixAutoUpdate]. Set to `false` here as the helper is using the
  50. object's [page:Object3D.matrixWorld matrixWorld].
  51. </p>
  52. <h3>[property:Object3D object]</h3>
  53. <p>The object for which the vertex tangents are being visualized.</p>
  54. <h3>[property:Number size]</h3>
  55. <p>Length of the arrows. Default is *1*.</p>
  56. <h2>Methods</h2>
  57. <p>See the base [page:LineSegments] class for common methods.</p>
  58. <h3>[method:undefined update]()</h3>
  59. <p>Updates the vertex tangents preview based on the object's world transform.</p>
  60. <h3>[method:undefined dispose]()</h3>
  61. <p>
  62. Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
  63. </p>
  64. <h2>Source</h2>
  65. <p>
  66. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/VertexTangentsHelper.js examples/jsm/helpers/VertexTangentsHelper.js]
  67. </p>
  68. </body>
  69. </html>