ShapeGeometry.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 a one-sided polygonal geometry from one or more path shapes. Similar to [page:ExtrudeGeometry].</div>
  14. <iframe id="scene" src="scenes/geometry-browser.html#ShapeGeometry"></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 = 16, width = 12;
  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 geometry = new THREE.ShapeGeometry( shape );
  34. var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  35. var mesh = new THREE.Mesh( geometry, material ) ;
  36. scene.add( mesh );
  37. </code>
  38. <h2>Constructor</h2>
  39. <h3>[name]([page:Array shapes], [page:Object options])</h3>
  40. <div>
  41. shapes — [page:Array] of shapes, or a single [page:Shape shape] <br />
  42. options — Optional options [page:Object object]
  43. <ul>
  44. <li>curveSegments - [page:Integer] - Not used at the moment - defaults to 12</li>
  45. <li>material - [page:Integer] - index of the material in a material list</li>
  46. <li>UVGenerator - A UV generator, defaults to [page:ExtrudeGeometry]'s WorldUVGenerator</li>
  47. </ul>
  48. </div>
  49. <h2>Methods</h2>
  50. <h3>.addShapeList([page:Array shapes], [page:Object options]) [page:this]</h3>
  51. <div>
  52. shapes — [page:Array] of [page:Shape shapes] <br />
  53. options — See options in constructor
  54. </div>
  55. <div>
  56. Adds a list of shapes to the geometry.
  57. </div>
  58. <h3>[method:null addShape]([page:Shape shape], [page:Object options])</h3>
  59. <div>
  60. shape — [page:Shape] <br />
  61. options — See options in constructor
  62. </div>
  63. <div>
  64. Adds a single shape to the geometry
  65. </div>
  66. <h2>Source</h2>
  67. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  68. </body>
  69. </html>