Three.js:从平面三维平面三角形形状中挤出三角形网格

时间:2015-08-14 22:20:23

标签: javascript canvas 3d three.js mesh

尝试从Vector3三角形中挤出三角形网格。我在extrudeSettings中呼叫var triangleGeometry = new THREE.Geometry(extrudeSettings);,但它没有挤出。我在这里做错了什么?

Here's a plunker

以下是相关的JS:

   drawTriangle(
       new THREE.Vector3(0, 0, 0),
       new THREE.Vector3(4, 0, 0),
       new THREE.Vector3(2, 3.4641, 0)
   );

   var extrudeSettings = {
                    steps           : 100,
                    bevelEnabled    : false,
                    extrudePath     : closedSpline
   };

   function drawTriangle (vertex1, vertex2, vertex3) {
      var triangleGeometry = new THREE.Geometry(extrudeSettings);
      var triangleMaterial = new THREE.MeshBasicMaterial({
      color: 0x000000,
      wireframe: true,
      wireframeLinewidth: 1
   });

   var triangle = new THREE.Mesh(triangleGeometry, triangleMaterial);

   triangleGeometry.vertices = [vertex1, vertex2, vertex3];
   triangleGeometry.faces.push(new THREE.Face3(0, 1, 2));

   THREE.GeometryUtils.center(triangleGeometry);

   scene.add(triangle);

0 个答案:

没有答案