ExtrudeGeometry.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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:Geometry] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">Creates extruded geometry from a path shape.</div>
  14. <iframe id="scene" src="scenes/geometry-browser.html#ExtrudeGeometry"></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.ExtrudeGeometry( 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]([page:Array shapes], [page:Object options])</h3>
  48. <div>
  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</li>
  53. <li>steps — int. number of points used for subdividing segements of extrude spline</li>
  54. <li>amount — int. Depth to extrude the shape</li>
  55. <li>bevelEnabled — bool. turn on bevel</li>
  56. <li>bevelThickness — float. how deep into the original shape bevel goes</li>
  57. <li>bevelSize — float. how far from shape outline is bevel</li>
  58. <li>bevelSegments — int. number of bevel layers</li>
  59. <li>extrudePath — THREE.CurvePath. 3d spline path to extrude shape along. (creates Frames if frames aren't defined)</li>
  60. <li>frames — THREE.TubeGeometry.FrenetFrames. containing arrays of tangents, normals, binormals</li>
  61. <li>material — int. material index for front and back faces</li>
  62. <li>extrudeMaterial — int. material index for extrusion and beveled faces</li>
  63. <li>UVGenerator — Object. object that provides UV generator functions</li>
  64. </ul>
  65. </div>
  66. <div>
  67. This object extrudes an 2D shape to an 3D geometry.
  68. </div>
  69. <h2>Properties</h2>
  70. <h2>Methods</h2>
  71. <h3>[method:null addShapeList]([page:Array shapes], [page:Object options])</h3>
  72. <div>
  73. shapes — An Array of shapes to add. <br />
  74. options — Object that can contain the following parameters.
  75. <ul>
  76. <li>curveSegments — int. number of points on the curves</li>
  77. <li>steps — int. number of points used for subdividing segements of extrude spline</li>
  78. <li>amount — int. Depth to extrude the shape</li>
  79. <li>bevelEnabled — bool. turn on bevel</li>
  80. <li>bevelThickness — float. how deep into the original shape bevel goes</li>
  81. <li>bevelSize — float. how far from shape outline is bevel</li>
  82. <li>bevelSegments — int. number of bevel layers</li>
  83. <li>extrudePath — THREE.Curve. curve to extrude shape along</li>
  84. <li>frames — Object. containing arrays of tangents, normals, binormals</li>
  85. <li>material — int. material index for front and back faces</li>
  86. <li>extrudeMaterial — int. material index for extrusion and beveled faces</li>
  87. <li>UVGenerator — Object. object that provides UV generator functions</li>
  88. </ul>
  89. </div>
  90. <div>Adds the shapes to the list to extrude.</div>
  91. <h3>[method:null addShape]([page:Shape shape], [page:Object options])</h3>
  92. <div>
  93. shape — A shape to add. <br />
  94. options — Object that can contain the following parameters.
  95. <ul>
  96. <li>curveSegments — int. number of points on the curves</li>
  97. <li>steps — int. number of points used for subdividing segements of extrude spline</li>
  98. <li>amount — int. Depth to extrude the shape</li>
  99. <li>bevelEnabled — bool. turn on bevel</li>
  100. <li>bevelThickness — float. how deep into the original shape bevel goes</li>
  101. <li>bevelSize — float. how far from shape outline is bevel</li>
  102. <li>bevelSegments — int. number of bevel layers</li>
  103. <li>extrudePath — THREE.Curve. curve to extrude shape along</li>
  104. <li>frames — Object. containing arrays of tangents, normals, binormals</li>
  105. <li>material — int. material index for front and back faces</li>
  106. <li>extrudeMaterial — int. material index for extrusion and beveled faces</li>
  107. <li>UVGenerator — Object. object that provides UV generator functions</li>
  108. </ul>
  109. </div>
  110. <div>Add the shape to the list to extrude.</div>
  111. <h2>Source</h2>
  112. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  113. </body>
  114. </html>