提交 0de29f2d 编写于 作者: Z zz85

Just adjusting some formatting in ExtrudeGeometry

上级 a513d010
......@@ -341,6 +341,7 @@
//splineShape.debug( document.getElementById("debug") );
// TODO 3d path?
var extrudePath = new THREE.Path();
extrudePath.moveTo( 0, 0 );
......@@ -348,8 +349,19 @@
extrudePath.quadraticCurveTo( 80, 60, 160, 10 );
extrudePath.quadraticCurveTo( 240, -40, 320, 10 );
extrudeSettings.extrudePath = extrudePath;
// QUICK HACK, conversion from 2d to 3d spline
// Still broken and need fixes.
var apath = new THREE.SplineCurve3();
var tmpPoints = extrudePath.getPoints();
for (t in tmpPoints) {
var tmpPt = tmpPoints[t];
apath.points.push(new THREE.Vector3(tmpPt.x, tmpPt.y,0 ));
}
extrudeSettings.extrudePath = apath;
extrudeSettings.bevelEnabled = false;
extrudeSettings.steps = 20;
var splineShape3d = splineShape.extrude( extrudeSettings );
var splinePoints = splineShape.createPointsGeometry( );
......
......@@ -411,6 +411,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
var normal = new THREE.Vector3();
var position2 = new THREE.Vector3();
var lastBinormal = new THREE.Vector3(1, 0, 0);
var cx, cy;
// Back facing vertices
......@@ -434,8 +435,8 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
binormal.cross(tangent, normal).normalize();
lastBinormal = binormal;
var cx = vert.x;
var cy = vert.y;
cx = vert.x;
cy = vert.y;
position2.copy(splinePt);
position2.x += cx * normal.x + cy * binormal.x;
......@@ -469,18 +470,18 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
tangent = extrudePath.getTangentAt((s - 1)/steps );
normal.cross(lastBinormal, tangent).normalize();
binormal.cross(tangent, normal).normalize();
lastBinormal = binormal;
normal.cross(lastBinormal, tangent).normalize();
binormal.cross(tangent, normal).normalize();
lastBinormal = binormal;
var cx = vert.x;
var cy = vert.y;
cx = vert.x;
cy = vert.y;
position2.copy(splinePt);
position2.x += cx * normal.x + cy * binormal.x;
position2.y += cx * normal.y + cy * binormal.y;
position2.z += cx * normal.z + cy * binormal.z;
v( position2.x, position2.y, position2.z );
position2.copy(splinePt);
position2.x += cx * normal.x + cy * binormal.x;
position2.y += cx * normal.y + cy * binormal.y;
position2.z += cx * normal.z + cy * binormal.z;
v( position2.x, position2.y, position2.z );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册