Three.js r72 no longer supports THREE.LinePieces, how to merge multiple disabled lines using THREE.LineSegments?

I just upgraded to three .js r72 and I get the following warning in the console regarding THREE.LinePieces ...

THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead. 

Lines will appear disconnected, notify the warnings, however, in the following example, if I upgrade THREE.LinePieces to THREE.LineSegments, all disconnected lines are connected.

 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, lineMaterial, THREE.LineSegments); // connected as one line only :( 

Do I intend to create separate geometries (containing two vertices) for each line segment or can I combine several line segments into one geometry, as was the case with LinePieces?

+6
source share
1 answer

The following is a template for creating a set of line segments with a single draw call.

 var line = new THREE.LineSegments( geometry, material ); 

three.js r.72

+10
source

All Articles