我想要的是将多行合并为一行以提高性能(行可以是直线,折线(闭合),圆弧,圆,椭圆)。遇到问题#1370,描述的是相同的dpatro。
我找到了什么我找到了解决方案:here,我的代码如下:
case "Line":
var startPoint = me.stripStringToPoint(entity.StartPoint);
var endPoint = me.stripStringToPoint(entity.EndPoint);
var p1 = new THREE.Vector3(startPoint[0],startPoint[1],startPoint[2]);
var p2 = new THREE.Vector3(endPoint[0],endPoint[1],endPoint[2]);
geometry.vertices.push(p1);
geometry.vertices.push(p2);
var line = new THREE.LineSegments(geometry, material);
return line;
break;
case "Polyline":
var vertices = entity.Vertices;
var color = me.stripStringToColor(entity.Color);
for (var j = 0, len1 = vertices.length; j < len1; j = j + 2) {
var p = new THREE.Vector3(entity.Vertices[j], entity.Vertices[j + 1],0);
geometry.vertices.push(p);
}
if ( entity.Closed === true && geometry.vertices.length >0) {
geometry.vertices.push(new THREE.Vector3(entity.Vertices[0], entity.Vertices[1],0));
}
var line = new THREE.LineSegments(geometry, material);//
return line;
var mergeGeometry = new THREE.Geometry();
mergeGeometry.merge(line.geometry, line.matrix);
scene.add(new THREE.LineSegments(mergeGeometry,material ));
我在使用r.72时使用three.js r.73,这是否重要?需要你的帮助〜