Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用多个材质绘制一条直线_Javascript_Three.js_Line - Fatal编程技术网

Javascript 使用多个材质绘制一条直线

Javascript 使用多个材质绘制一条直线,javascript,three.js,line,Javascript,Three.js,Line,我需要一次画150000多条线,以便在3J上啮合。最快的方法是添加所有顶点并将对象绘制为一条直线: for (var n=0; n < nodeNos.length; n++) { var thisNodeNo = nodeNos[n]; elemGeo.vertices.push(new THREE.Vector3(meshNodes[thisNodeNo].x, meshNodes[thisNodeNo].y, meshNodes[thisNodeNo].z));

我需要一次画150000多条线,以便在3J上啮合。最快的方法是添加所有顶点并将对象绘制为一条直线:

for (var n=0; n < nodeNos.length; n++) {
    var thisNodeNo = nodeNos[n];
    elemGeo.vertices.push(new THREE.Vector3(meshNodes[thisNodeNo].x, meshNodes[thisNodeNo].y, meshNodes[thisNodeNo].z));        
}

var lineMat = new THREE.LineBasicMaterial({
     linewidth: 1,
     color: 0xffffff
});

var line = new THREE.Line(elemGeo, lineMat);
for(var n=0;n
我可以更改线条的颜色,但由于这不支持rgba(我需要线条的部分透明),因此没有帮助


你知道如何用不同的材料分割这条线吗

使用three.js r.72和
BufferGeometry.addGroup()
,您就可以做到这一点。但是使用
THREE.Line
THREE.LineSegments
渲染单独的线同样容易。您可以使用THREE.LineSegments或仅使用颜色渲染单独的材质吗?