ExtrudeGeometry.html 3.2 KB
Newer Older
M
r85  
Mr.doob 已提交
1 2 3 4
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
M
r96  
Mr.doob 已提交
5
		<base href="../../../" />
M
r85  
Mr.doob 已提交
6 7 8 9 10 11 12 13 14
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:Geometry] &rarr;

		<h1>[name]</h1>

M
r92  
Mr.doob 已提交
15
		<p class="desc">Creates extruded geometry from a path shape.</p>
M
r85  
Mr.doob 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

		<iframe id="scene" src="scenes/geometry-browser.html#ExtrudeGeometry"></iframe>

		<script>

		// iOS iframe auto-resize workaround

		if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {

			var scene = document.getElementById( 'scene' );

			scene.style.width = getComputedStyle( scene ).width;
			scene.style.height = getComputedStyle( scene ).height;
			scene.setAttribute( 'scrolling', 'no' );

		}

		</script>

		<h2>Example</h2>


		<code>
		var length = 12, width = 8;

		var shape = new THREE.Shape();
		shape.moveTo( 0,0 );
		shape.lineTo( 0, width );
		shape.lineTo( length, width );
		shape.lineTo( length, 0 );
		shape.lineTo( 0, 0 );

		var extrudeSettings = {
			steps: 2,
M
r93  
Mr.doob 已提交
50
			depth: 16,
M
r85  
Mr.doob 已提交
51 52 53
			bevelEnabled: true,
			bevelThickness: 1,
			bevelSize: 1,
M
r104  
Mr.doob 已提交
54
			bevelOffset: 0,
M
r85  
Mr.doob 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67
			bevelSegments: 1
		};

		var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
		var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
		var mesh = new THREE.Mesh( geometry, material ) ;
		scene.add( mesh );
		</code>


		<h2>Constructor</h2>


M
r91  
Mr.doob 已提交
68
		<h3>[name]([param:Array shapes], [param:Object options])</h3>
M
r92  
Mr.doob 已提交
69
		<p>
M
r85  
Mr.doob 已提交
70 71 72 73 74 75
		shapes — Shape or an array of shapes. <br />
		options — Object that can contain the following parameters.

			<ul>
				<li>curveSegments — int. Number of points on the curves. Default is 12.</li>
				<li>steps — int. Number of points used for subdividing segments along the depth of the extruded spline. Default is 1.</li>
M
r93  
Mr.doob 已提交
76
				<li>depth — float. Depth to extrude the shape. Default is 100.</li>
M
r85  
Mr.doob 已提交
77 78 79
				<li>bevelEnabled — bool. Apply beveling to the shape. Default is true.</li>
				<li>bevelThickness — float. How deep into the original shape the bevel goes. Default is 6.</li>
				<li>bevelSize — float. Distance from the shape outline that the bevel extends. Default is bevelThickness - 2.</li>
M
r104  
Mr.doob 已提交
80
				<li>bevelOffset — float. Distance from the shape outline that the bevel starts. Default is 0.</li>
M
r85  
Mr.doob 已提交
81
				<li>bevelSegments — int. Number of bevel layers. Default is 3.</li>
M
r92  
Mr.doob 已提交
82
				<li>extrudePath — THREE.CurvePath. A 3D spline path along which the shape should be extruded.</li>
M
r85  
Mr.doob 已提交
83 84 85
				<li>UVGenerator —  Object. object that provides UV generator functions</li>
			</ul>

M
r92  
Mr.doob 已提交
86 87
		</p>
		<p>
M
r85  
Mr.doob 已提交
88
			This object extrudes a 2D shape to a 3D geometry.
M
r92  
Mr.doob 已提交
89
		</p>
M
r85  
Mr.doob 已提交
90

M
r92  
Mr.doob 已提交
91
		<p>
M
r85  
Mr.doob 已提交
92 93 94
			When creating a Mesh with this geometry, if you'd like to have a separate material used for its face
			and its extruded sides, you can use an array of materials. The first material will be
			applied to the face; the second material will be applied to the sides.
M
r92  
Mr.doob 已提交
95
		</p>
M
r85  
Mr.doob 已提交
96

M
r94  
Mr.doob 已提交
97 98 99 100 101 102 103
		<h2>Properties</h2>

		<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>

M
r85  
Mr.doob 已提交
104 105 106 107 108
		<h2>Source</h2>

		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
	</body>
</html>