BoxGeometry.html 2.5 KB

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