var mesh = ''
function createLines(arr) {
if(mesh){
scene.remove(mesh)
}
var line = new THREE.Geometry();
line.vertices = []
$.each(arr, function(index,content) {
var a = scene.getObjectByName(content)
line.vertices.push( a.position );
});
makeLine( line, 3 );
}
var resolution = new THREE.Vector2( window.innerWidth, window.innerHeight );
function makeLine( geo, c ) {
var g = new MeshLine();
g.setGeometry( geo );
var material = new MeshLineMaterial( {
useMap: false,
color: new THREE.Color( 0xed6a5a ),
opacity: 1,
resolution: resolution,
sizeAttenuation: !false,
lineWidth: 0.5,
near: camera.near,
far: camera.far
});
mesh = new THREE.Mesh( g.geometry, material );
scene.add( mesh );
}
//arr为line在场景中经过的模型名称的数组
createLines(arr)
页面中需要引入<script src="js/THREE.MeshLine.js"></script>
THREE.MeshLine.js下载
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。