This commit is contained in:
sunzhenyu 2019-11-06 13:34:52 +08:00
parent 3e3cb9bfd2
commit 0a77b1e4f6

View File

@ -194,39 +194,39 @@ export function RailList(){
rightpoints.reverse();
scope.linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
scope.linkrail[linkdata[i].code].lineright.curveType = "centripetal";
for(let n=0,nm=scope.linkrail[linkdata[i].code].lineleft.points.length;n<nm;n++){
var geometry = new THREE.CircleGeometry( 0.05, 16 );
var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
var circle = new THREE.Mesh( geometry, material );
console.log(n);
console.log(scope.linkrail[linkdata[i].code].lineleft.points[n]);
circle.position.x = scope.linkrail[linkdata[i].code].lineleft.points[n].x;
circle.position.y = scope.linkrail[linkdata[i].code].lineleft.points[n].y;
circle.position.z = scope.linkrail[linkdata[i].code].lineleft.points[n].z;
circle.rotation.x = -Math.PI/2;
scene.add( circle );
}
// scope.linkrail[linkdata[i].code].lineright.tension = 0.11;
var points = scope.linkrail[linkdata[i].code].lineleft.getPoints( 50 );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var material;
if(scope.linkrail[linkdata[i].code].type == 0){
material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
}
if(scope.linkrail[linkdata[i].code].type == 1){
material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
}
if(scope.linkrail[linkdata[i].code].type == 2){
material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
}
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
curveObject.position.y = Math.random();
scene.add(curveObject);
//
// for(let n=0,nm=scope.linkrail[linkdata[i].code].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
// var circle = new THREE.Mesh( geometry, material );
// console.log(n);
// console.log(scope.linkrail[linkdata[i].code].lineleft.points[n]);
// circle.position.x = scope.linkrail[linkdata[i].code].lineleft.points[n].x;
// circle.position.y = scope.linkrail[linkdata[i].code].lineleft.points[n].y;
// circle.position.z = scope.linkrail[linkdata[i].code].lineleft.points[n].z;
// circle.rotation.x = -Math.PI/2;
// scene.add( circle );
// }
// // scope.linkrail[linkdata[i].code].lineright.tension = 0.11;
// var points = scope.linkrail[linkdata[i].code].lineleft.getPoints( 50 );
// var geometry = new THREE.BufferGeometry().setFromPoints( points );
// var material;
// if(scope.linkrail[linkdata[i].code].type == 0){
// material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// }
// if(scope.linkrail[linkdata[i].code].type == 1){
// material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
// }
// if(scope.linkrail[linkdata[i].code].type == 2){
// material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
// }
//
//
// // Create the final object to add to the scene
// var curveObject = new THREE.Line( geometry, material );
//
// curveObject.position.y = Math.random();
// scene.add(curveObject);
}
}