You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.5 KiB

2 years ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:BufferGeometry] &rarr;
<h1>[name]</h1>
<p class="desc">
[name] is a geometry class for a rectangular cuboid with a given 'width', 'height', and 'depth'.
On creation, the cuboid is centred on the origin, with each edge parallel to one of the axes.
</p>
<iframe id="scene" src="scenes/geometry-browser.html#BoxGeometry"></iframe>
<script>
// iOS iframe auto-resize workaround
if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
const scene = document.getElementById( 'scene' );
scene.style.width = getComputedStyle( scene ).width;
scene.style.height = getComputedStyle( scene ).height;
scene.setAttribute( 'scrolling', 'no' );
}
</script>
<h2>Code Example</h2>
<code>const geometry = new THREE.BoxGeometry( 1, 1, 1 );
const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );
</code>
<h2>Constructor</h2>
<h3>[name]([param:Float width], [param:Float height], [param:Float depth], [param:Integer widthSegments], [param:Integer heightSegments], [param:Integer depthSegments])</h3>
<p>
width — Width; that is, the length of the edges parallel to the X axis. Optional; defaults to 1.<br />
height — Height; that is, the length of the edges parallel to the Y axis. Optional; defaults to 1.<br />
depth — Depth; that is, the length of the edges parallel to the Z axis. Optional; defaults to 1.<br />
widthSegments — Number of segmented rectangular faces along the width of the sides. Optional; defaults to 1.<br />
heightSegments — Number of segmented rectangular faces along the height of the sides. Optional; defaults to 1.<br />
depthSegments — Number of segmented rectangular faces along the depth of the sides. Optional; defaults to 1.<br />
</p>
<h2>Properties</h2>
<p>See the base [page:BufferGeometry] class for common properties.</p>
<h3>[property:Object parameters]</h3>
<p>
An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
</p>
<h2>Methods</h2>
<p>See the base [page:BufferGeometry] class for common methods.</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</p>
</body>
</html>