ExtrudeBufferGeometry.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:BufferGeometry] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">Creates extruded BufferGeometry from a path shape.</p>
  14. <iframe id="scene" src="scenes/geometry-browser.html#ExtrudeBufferGeometry"></iframe>
  15. <script>
  16. // iOS iframe auto-resize workaround
  17. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  18. var scene = document.getElementById( 'scene' );
  19. scene.style.width = getComputedStyle( scene ).width;
  20. scene.style.height = getComputedStyle( scene ).height;
  21. scene.setAttribute( 'scrolling', 'no' );
  22. }
  23. </script>
  24. <h2>Example</h2>
  25. <code>
  26. var length = 12, width = 8;
  27. var shape = new THREE.Shape();
  28. shape.moveTo( 0,0 );
  29. shape.lineTo( 0, width );
  30. shape.lineTo( length, width );
  31. shape.lineTo( length, 0 );
  32. shape.lineTo( 0, 0 );
  33. var extrudeSettings = {
  34. steps: 2,
  35. amount: 16,
  36. bevelEnabled: true,
  37. bevelThickness: 1,
  38. bevelSize: 1,
  39. bevelSegments: 1
  40. };
  41. var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
  42. var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  43. var mesh = new THREE.Mesh( geometry, material ) ;
  44. scene.add( mesh );
  45. </code>
  46. <h2>Constructor</h2>
  47. <h3>[name]([param:Array shapes], [param:Object options])</h3>
  48. <p>
  49. shapes — Shape or an array of shapes. <br />
  50. options — Object that can contain the following parameters.
  51. <ul>
  52. <li>curveSegments — int. Number of points on the curves. Default is 12.</li>
  53. <li>steps — int. Number of points used for subdividing segments along the depth of the extruded spline. Default is 1.</li>
  54. <li>amount — int. Depth to extrude the shape. Default is 100.</li>
  55. <li>bevelEnabled — bool. Apply beveling to the shape. Default is true.</li>
  56. <li>bevelThickness — float. How deep into the original shape the bevel goes. Default is 6.</li>
  57. <li>bevelSize — float. Distance from the shape outline that the bevel extends. Default is bevelThickness - 2.</li>
  58. <li>bevelSegments — int. Number of bevel layers. Default is 3.</li>
  59. <li>extrudePath — THREE.CurvePath. A 3D spline path along which the shape should be extruded.</li>
  60. <li>UVGenerator — Object. object that provides UV generator functions</li>
  61. </ul>
  62. </p>
  63. <p>
  64. This object extrudes a 2D shape to a 3D geometry.
  65. </p>
  66. <p>
  67. When creating a Mesh with this geometry, if you'd like to have a separate material used for its face
  68. and its extruded sides, you can use an array of materials. The first material will be
  69. applied to the face; the second material will be applied to the sides.
  70. </p>
  71. <h2>Source</h2>
  72. [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js src/geometries/ExtrudeGeometry.js]
  73. </body>
  74. </html>