javascript – three.js r72不再支持THREE.LinePieces,如何将多个断开的行与THREE.LineSegments合并?

我刚刚更新到three.js r72,我在控制台中收到了关于THREE.LinePieces的以下警告……
THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead.

这些行将显示为断开连接,并显示警告,但是,对于以下示例,如果我将THREE.LinePieces更新为THREE.LineSegments,则所有断开的行都将连接.

var lineMaterial = new THREE.LineBasicMaterial({color: 0x000000,linewidth: 1});
var lineGeom = new THREE.Geometry();
var xstrt = 0;
for (nn=0; nn<numLines; nn++)
{
    lineGeom.vertices.push(new THREE.Vector3(xstrt,-5,0));
    lineGeom.vertices.push(new THREE.Vector3(xstrt,5,0));
    xstrt += 5;
}
var Line  = new THREE.Line(lineGeom,lineMaterial,THREE.LinePieces); // seperate lines,but with warnings
//var Line  = new THREE.Line(lineGeom,THREE.LineSegments); // connected as one line only :(

我是否希望为每个线段创建单独的几何图形(包含两个顶点),或者可以将多个线段合并为一个几何图形,就像我使用LinePieces一样?

解决方法

以下是使用单个绘制调用创建线段集合的模式.
var line = new THREE.LineSegments( geometry,material );

three.js r.72

相关文章

kindeditor4.x代码高亮功能默认使用的是prettify插件,prett...
这一篇我将介绍如何让kindeditor4.x整合SyntaxHighlighter代...
js如何实现弹出form提交表单?(图文+视频)
js怎么获取复选框选中的值
js如何实现倒计时跳转页面
如何用js控制图片放大缩小