BoxGeometry.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../../list.js"></script>
  6. <script src="../../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../../page.css" />
  8. </head>
  9. <body>
  10. [page:Geometry] &rarr;
  11. <h1>[name]</h1>
  12. <div class="desc">BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.</div>
  13. <iframe src='../../../scenes/geometry-browser.html#BoxGeometry'></iframe>
  14. <h2>Example</h2>
  15. <code>var geometry = new THREE.BoxGeometry( 1, 1, 1 );
  16. var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
  17. var cube = new THREE.Mesh( geometry, material );
  18. scene.add( cube );
  19. </code>
  20. <h2>Constructor</h2>
  21. <h3>[name]([page:Float width], [page:Float height], [page:Float depth], [page:Integer widthSegments], [page:Integer heightSegments], [page:Integer depthSegments])</h3>
  22. <div>
  23. width — Width of the sides on the X axis.<br />
  24. height — Height of the sides on the Y axis.<br />
  25. depth — Depth of the sides on the Z axis.<br />
  26. widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.<br />
  27. heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.<br />
  28. depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1.
  29. </div>
  30. <h2>Properties</h2>
  31. <h3>.parameters</h3>
  32. <div>
  33. <p>Using the above example code above as our basis:</p>
  34. <code>
  35. geometry.parameters; // outputs an object {width: 1, height: 1, depth: 1, widthSegments: undefined, heightSegments: undefined}
  36. cube.geometry.parameters; // as above
  37. cube.geometry.parameters.width; // === 1
  38. cube.geometry.parameters.widthSegments // === undefined.
  39. </code>
  40. </div>
  41. <h2>Source</h2>
  42. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  43. </body>
  44. </html>