复原三维沙盘行车逻辑

This commit is contained in:
sunzhenyu 2020-04-22 13:22:54 +08:00
parent 7ca5fd07dc
commit 1cd2fd370b
2 changed files with 13 additions and 11 deletions

View File

@ -140,10 +140,10 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// controls3.getObject().rotation.x = Math.PI/2;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 40);
cameracctv.position.set( 2, -1,27 );
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 1, 10);
cameracctv.position.set( 0, -1,30 );
cameracctv.rotation.y = Math.PI/2;
// cameracctv.rotation.y = Math.PI/2;
camera.add(cameracctv);

View File

@ -53,6 +53,8 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
let camera = SetCamera(dom);
//定义场景(渲染容器)
let scene = SetScene(project);
let scenesimulation = new THREE.Group();
scene.add(scenesimulation);
//定义镜头操作
let controls = new THREE.OrbitControls(camera);
controls.maxPolarAngle = Math.PI/2;
@ -110,14 +112,14 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
scope.Subscribe.socketon(scope.Subscribe.topic);
SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scene,storemod);
SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
}else{
scope.datatype = "new";
scope.jsonwebworknew = new Worker("../../static/workertest/jsonworkernew.js");
scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
scope.Subscribe.socketon(scope.Subscribe.topic);
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scene,storemod);
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
}
});
@ -187,12 +189,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.webwork.onmessage = function (event) {
//更新列车位置
// if(scope.datatype == "new"){
//
// UpdateTrainNew(camera,trainlisttest);
// }else{
// UpdateTrain(camera,trainlisttest);
// }
if(scope.datatype == "new"){
UpdateTrainNew(camera,trainlisttest);
}else{
UpdateTrain(camera,trainlisttest);
}
if(camerarail.moveswitch == true){
// console.log(camerarail.progress);