three.js中几何对象

CircleGeometry 、 CubeGeometry、CylinderGeometry 和 ExtrudeGeometry

几何对象是用必要的数据(点、顶点、面等)来描述三维模型。我们将创建平面的圆、立方体和圆柱体。Extrude Geometry是用来制作从路径凸出的形状。我们要做个凸出的三角形:

cube.castShadow = cube.receiveShadow = true;
this.scene.add(cube);

// 添加不规则的物体
var extrudeSettings = {
    amount: 10,
    steps: 10,
    bevelSegments: 10,
    bevelSize: 10,
    bevelThickness: 10
};
var triangleShape = new THREE.Shape();
triangleShape.moveTo(  0, -50 );
triangleShape.lineTo(  -50, 50 );
triangleShape.lineTo( 50, 50 );
triangleShape.lineTo(  0, -50 );

var extrude = new THREE.Mesh(new THREE.ExtrudeGeometry(triangleShape, extrudeSettings), new THREE.MeshLambertMaterial({ color: this.getRandColor() }));
extrude.rotation.y = Math.PI / 2;
extrude.position.x = -300;
extrude.position.y = 150;
extrude.position.z = 300;
extrude.castShadow = extrude.receiveShadow = true;
this.scene.add(extrude);

ExtrudeBufferGeometry

Constructor

ExtrudeBufferGeometry(shapes, options)

shapes — Shape or an array of shapes.
options — Object that can contain the following parameters.可以包含以下参数的对象。

  • curveSegments — int. Number of points on the curves. Default is 12.曲线上的点数。默认是12。
  • steps — int. Number of points used for subdividing segments along the depth of the extruded spline. Default is 1.在挤压样条的深度上细分区段的点数个数。默认值为1。
  • amount — int. Depth to extrude the shape. Default is 100.深度挤压成形。默认是100。
  • bevelEnabled — bool. Apply beveling to the shape. Default is true.将斜面涂在形状上。默认是正确的。
  • bevelThickness — float. How deep into the original shape the bevel goes. Default is 6.斜角的形状有多深。默认是6。
  • bevelSize — float. Distance from the shape outline that the bevel extends. Default is bevelThickness - 2.斜面延伸的形状轮廓的距离。默认是斜面- 2。
  • bevelSegments — int. Number of bevel layers. Default is 3.斜层。默认是3。
  • extrudePath — THREE.CurvePath. A 3D spline path along which the shape should be extruded (creates Frames if frames aren't defined).一个三维的样条路径,在这个过程中,形状应该被挤压出来(如果没有定义帧,就会创建帧)。
  • frames — An object containing arrays of tangents, normals, binormals for each step along the extrudePath.一种包含有切线、法线、双气门的对象,用于每一步的挤压。
  • UVGenerator — Object. object that provides UV generator functions提供UV发生器功能的对象

This object extrudes a 2D shape to a 3D geometry.这个物体将二维形状挤压到三维几何图形中。
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.如果你想要一个单独的材料用于它的面和它的挤压面,你可以使用一系列材料。第一种材料将应用于面部;第二种材料将被应用到两边。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值