我有一条线(点数),我想挤出它。
实现这一目标的简单方法是什么?
答案 0 :(得分:1)
我找到了解决方案。不确定这是否是最佳方式,因为three.js会抛出一个信息来代替使用PlaneBufferGeometry。
function extrudePath( points, depth ) {
var geometry = new THREE.PlaneGeometry(0, 0, points.length - 1, 1);
var vertices = geometry.vertices;
for (var i = 0, l = points.length, p; i < l; i++) {
p = points[i];
vertices[i].x = vertices[i + l].x = p[0];
vertices[i].y = vertices[i + l].y = p[1];
vertices[i].z = p[2];
vertices[i + l].z = p[2] + depth;
}
geometry.computeFaceNormals();
return geometry;
}