BoxGeometry.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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
  8. type="text/css"
  9. rel="stylesheet"
  10. href="page.css" />
  11. </head>
  12. <body>
  13. [page:BufferGeometry] &rarr;
  14. <h1>[name]</h1>
  15. <p class="desc">
  16. [name] is a geometry class for a rectangular cuboid with a given 'width',
  17. 'height', and 'depth'. On creation, the cuboid is centred on the origin,
  18. with each edge parallel to one of the axes.
  19. </p>
  20. <iframe
  21. id="scene"
  22. src="scenes/geometry-browser.html#BoxGeometry"></iframe>
  23. <script>
  24. // iOS iframe auto-resize workaround
  25. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  26. const scene = document.getElementById( 'scene' );
  27. scene.style.width = getComputedStyle( scene ).width;
  28. scene.style.height = getComputedStyle( scene ).height;
  29. scene.setAttribute( 'scrolling', 'no' );
  30. }
  31. </script>
  32. <h2>Code Example</h2>
  33. <code>
  34. const geometry = new THREE.BoxGeometry( 1, 1, 1 );
  35. const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
  36. const cube = new THREE.Mesh( geometry, material );
  37. scene.add( cube );
  38. </code>
  39. <h2>Constructor</h2>
  40. <h3>
  41. [name]([param:Float width], [param:Float height], [param:Float depth],
  42. [param:Integer widthSegments], [param:Integer heightSegments],
  43. [param:Integer depthSegments])
  44. </h3>
  45. <p>
  46. width — Width; that is, the length of the edges parallel to the X axis.
  47. Optional; defaults to `1`.
  48. <br />
  49. height — Height; that is, the length of the edges parallel to the Y axis.
  50. Optional; defaults to `1`.
  51. <br />
  52. depth — Depth; that is, the length of the edges parallel to the Z axis.
  53. Optional; defaults to `1`.
  54. <br />
  55. widthSegments — Number of segmented rectangular faces along the width of
  56. the sides. Optional; defaults to `1`.
  57. <br />
  58. heightSegments — Number of segmented rectangular faces along the height of
  59. the sides. Optional; defaults to `1`.
  60. <br />
  61. depthSegments — Number of segmented rectangular faces along the depth of
  62. the sides. Optional; defaults to `1`.
  63. <br />
  64. </p>
  65. <h2>Properties</h2>
  66. <p>See the base [page:BufferGeometry] class for common properties.</p>
  67. <h3>[property:Object parameters]</h3>
  68. <p>
  69. An object with a property for each of the constructor parameters. Any
  70. modification after instantiation does not change the geometry.
  71. </p>
  72. <h2>Methods</h2>
  73. <p>See the base [page:BufferGeometry] class for common methods.</p>
  74. <h2>Source</h2>
  75. <p>
  76. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  77. </p>
  78. </body>
  79. </html>