2015-04-30 58 views

回答

0

我找到了解決方案。不確定這是否是最好的方式,因爲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; 
}