ExtrudeGeometry.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html lang="it">
  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:BufferGeometry] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">Crea una geometria estrusa da una forma di tracciato (path shape).</p>
  13. <iframe id="scene" src="scenes/geometry-browser.html#ExtrudeGeometry"></iframe>
  14. <script>
  15. // iOS iframe auto-resize workaround
  16. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  17. const scene = document.getElementById( 'scene' );
  18. scene.style.width = getComputedStyle( scene ).width;
  19. scene.style.height = getComputedStyle( scene ).height;
  20. scene.setAttribute( 'scrolling', 'no' );
  21. }
  22. </script>
  23. <h2>Codice di Esempio</h2>
  24. <code>
  25. const length = 12, width = 8;
  26. const shape = new THREE.Shape();
  27. shape.moveTo( 0,0 );
  28. shape.lineTo( 0, width );
  29. shape.lineTo( length, width );
  30. shape.lineTo( length, 0 );
  31. shape.lineTo( 0, 0 );
  32. const extrudeSettings = {
  33. steps: 2,
  34. depth: 16,
  35. bevelEnabled: true,
  36. bevelThickness: 1,
  37. bevelSize: 1,
  38. bevelOffset: 0,
  39. bevelSegments: 1
  40. };
  41. const geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
  42. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  43. const mesh = new THREE.Mesh( geometry, material ) ;
  44. scene.add( mesh );
  45. </code>
  46. <h2>Costruttore</h2>
  47. <h3>[name]([param:Array shapes], [param:Object options])</h3>
  48. <p>
  49. shapes — Shape o un array di shape. <br />
  50. options — Oggetto che può contenere i seguenti parametri.
  51. <ul>
  52. <li>curveSegments — int. Numero di punti sulle curve. Il valore predefinito è 12.</li>
  53. <li>steps — int. Numero di punti utilizzati per suddividere i segmenti lungo la profondità della spline estrusa. Il valore predefinito è 1.</li>
  54. <li>depth — float. Profondità per estrudere la forma. Il valore predefinito è 1.</li>
  55. <li>bevelEnabled — bool. Applica la smussatura alla forma. Il valore predefinito è true.</li>
  56. <li>bevelThickness — float. Quanto in profondità nella forma originale va la smussatura. Il valore predefinito è 0.2.</li>
  57. <li>bevelSize — float. Distanza dal contorno della forma a cui si estende lo smusso. Il valore predefinito è bevelThickness - 0.1.</li>
  58. <li>bevelOffset — float. Distanza dal contorno della forma a cui inizia lo smusso. Il valore predefinito è 0.</li>
  59. <li>bevelSegments — int. Numero di strati di smusso. Il valore predefinito è 3.</li>
  60. <li>extrudePath — THREE.Curve. Un path spline 3D lungo il quale deve essere eatrusa la forma. Smussi non supportati per l'estrusione del percorso.</li>
  61. <li>UVGenerator — Object. Oggetto che fornisce le funzioni di generatore UV</li>
  62. </ul>
  63. </p>
  64. <p>
  65. Questo oggetto estrude una forma 2D in una geometria 3D.
  66. </p>
  67. <p>
  68. Quando viene creata una Mesh con questa geometria, se desideri utilizzare un materiale separato per
  69. la sua faccia e i suoi lati estrusi, puoi utilizzare l'array dei materiali. Il primo materiale
  70. sarà applicato alla faccia; il secondo materiale sarà applicato ai lati.
  71. </p>
  72. <h2>Proprietà</h2>
  73. <p>Vedi la classe base [page:BufferGeometry] per le proprietà comuni.</p>
  74. <h3>[property:Object parameters]</h3>
  75. <p>
  76. Un oggetto con una proprietà per ognuno dei parametri del costruttore. Qualsiasi modifica dopo l'istanziazione non cambia la geometria.
  77. </p>
  78. <h2>Metodi</h2>
  79. <p>Vedi la classe base [page:BufferGeometry] per i metodi comuni.</p>
  80. <h2>Source</h2>
  81. <p>
  82. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  83. </p>
  84. </body>
  85. </html>