为什么使用拉伸测量法在路径上进行切割

时间:2015-12-04 10:00:48

标签: three.js

请看一下这段代码:

var container, renderer, scene, camera, controls;

init();
animate();

function init() {

// renderer
renderer = new THREE.WebGLRenderer({
    antialias: false
});
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0xccccff);
container = document.createElement('div');
document.body.appendChild(container);
container.appendChild(renderer.domElement);

// scene
scene = new THREE.Scene();

// camera
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.set(0, 200, 800);
camera.lookAt(scene.position);

// (camera) controls
// mouse controls: left button to rotate, 
//    mouse wheel to zoom, right button to pan
controls = new THREE.OrbitControls(camera, renderer.domElement);

// light    
var light = new THREE.PointLight(0xffffff);
light.position.set(100, 250, 250);
scene.add(light);
points=[{x:-67.74507292442851,y:-20,z:-38.89656263112556},{x:-63.193961813166325,y:-20,z:-21.274660408897844},{x:-63.193961813166325,y:-20,z:-21.274660408897844},{x:-60.499704035464674,y:-20,z:-11.244011520013576},{x:-60.499704035464674,y:-20,z:-11.244011520013576},{x:-58.22414847996293,y:-20,z:-2.6879226311252244},{x:-56.20345514655734,y:-20,z:5.322032924450468},{x:-55.65732181330936,y:-20,z:7.7614284799912845},{x:-55.65732181330936,y:-20,z:7.7614284799912845},{x:-54.346601813255496,y:-20,z:13.605055146650152},{x:-54.07353514650216,y:-20,z:15.48011292444749},{x:-54.07353514650216,y:-20,z:17.045695146662183},{x:-53.87328625760145,y:-20,z:18.50205070222728},{x:-53.47278847980002,y:-20,z:19.95840625776004},{x:-51.76157070220344,y:-20,z:24.45490403556808},{x:-49.140130702095725,y:-20,z:30.189304035545018},{x:-46.79175736874135,y:-20,z:34.46734847998919},{x:-46.79175736874135,y:-20,z:34.46734847998919},{x:-44.29774847994041,y:-20,z:38.98205070222806},{x:-43.533161813134534,y:-20,z:40.420201813329996},{x:-43.533161813134534,y:-20,z:40.420201813329996}];
var sp1= new THREE.SplineCurve3(points); 
var pts= sp1.getPoints(500); 
var sp= new THREE.SplineCurve3(pts); 
this.roadCurve=sp;
var extrudeSettings = {
steps           : 100,
amount          : 100,
bevelEnabled    : true,
extrudePath     : sp,
curveSegments :10,            
bevelThickness:10,
bevelSize     :10,
bevelSegments :10

};

var pts = [];
var pts = [
new THREE.Vector2(  0,-5)
,new THREE.Vector2(  0,0)
,new THREE.Vector2(0,5)
]               ;
var shape = new THREE.Shape( pts );
//console.log(shape);
var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );


 var material = new THREE.MeshBasicMaterial( {color: 0xCC6699} );     
 var mesh = new THREE.Mesh(geometry, material);
 this.roadThickPath  = mesh;
//mesh.rotation.z=-Math.PI/2;
mesh.scale.x=2;
mesh.scale.z=2;
//mesh.scale.multiplyScalar(10);
scene.add(mesh);
}

function animate() {
controls.update();
renderer.render(scene, camera);
requestAnimationFrame(animate);
} 

我给了一点积分。当它被渲染时,会在场边进行削减。 为什么会出现削减?当我走很长的道路然后削减更多如何纠正?

0 个答案:

没有答案