增加三维沙盘行车高度行驶数据更新,修改三维设备站台贴图获取,修改三维编辑器区段连接获取

This commit is contained in:
sunzhenyu 2020-09-17 18:12:37 +08:00
parent 465248872f
commit d409476963
12 changed files with 135 additions and 72 deletions

View File

@ -986,23 +986,26 @@ export function SectionList() {
}
console.log(scope.sections.datalist);
for(let i=0;i<section2d.length;i++){
if(section2d[i].type == "01" || section2d[i].type == "03"){
scope.sections.datalist[section2d[i].code].rsection = section2d[i].rightSectionCode;
scope.sections.datalist[section2d[i].code].lsection = section2d[i].leftSectionCode;
scope.sections.datalist[section2d[i].code].points = section2d[i].points;
scope.sections.datalist[section2d[i].code].pointslength = section2d[i].points.length-1;
if(section2d[i].standTrack == true){
if(scope.sections.datalist[section2d[i].code]){
scope.sections.datalist[section2d[i].code].rsection = section2d[i].rightSectionCode;
scope.sections.datalist[section2d[i].code].lsection = section2d[i].leftSectionCode;
scope.sections.datalist[section2d[i].code].points = section2d[i].points;
scope.sections.datalist[section2d[i].code].pointslength = section2d[i].points.length-1;
if(section2d[i].standTrack == true){
scope.sections.datalist[section2d[i].code].standLeftX = section2d[i].points[0].x;
scope.sections.datalist[section2d[i].code].standLeftY = section2d[i].points[0].y;
scope.sections.datalist[section2d[i].code].standRightLeftX = section2d[i].points[1].x;
scope.sections.datalist[section2d[i].code].standRightRightY = section2d[i].points[1].y;
scope.sections.datalist[section2d[i].code].leftStopPointOffset = section2d[i].leftStopPointOffset;
scope.sections.datalist[section2d[i].code].rightStopPointOffset = section2d[i].leftStopPointOffset+124;
scope.sections.datalist[section2d[i].code].standLeftX = section2d[i].points[0].x;
scope.sections.datalist[section2d[i].code].standLeftY = section2d[i].points[0].y;
scope.sections.datalist[section2d[i].code].standRightLeftX = section2d[i].points[1].x;
scope.sections.datalist[section2d[i].code].standRightRightY = section2d[i].points[1].y;
scope.sections.datalist[section2d[i].code].leftStopPointOffset = section2d[i].leftStopPointOffset;
scope.sections.datalist[section2d[i].code].rightStopPointOffset = section2d[i].leftStopPointOffset+124;
}
}
}
}

View File

@ -15,6 +15,10 @@ export function SectionModel(data) {
this.isStandTrack = null;
this.rsection = null;
this.lsection = null;
this.type = null;
//指向模型
this.mesh = null;

View File

@ -277,10 +277,10 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
function setpsdstationmap(stationlist){
for(let i=0,leni=stationlist.length;i<leni;i++){
psdtexturemap[stationlist[i].direction1.code] = stationlist[i].code;
psdtexturemap[stationlist[i].direction2.code] = stationlist[i].code;
psdtexturemap[stationlist[i].direction1.name] = stationlist[i].code;
psdtexturemap[stationlist[i].direction2.name] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[0].code] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[1].code] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[0].name] = stationlist[i].code;
psdtexturemap[stationlist[i].stands[1].name] = stationlist[i].code;
}
}

View File

@ -114,7 +114,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// 地图模型数据
let mapdata = new Jl3ddata();
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 400);
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 0.1, 400);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
@ -143,8 +143,8 @@ 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(50, dom.clientWidth/dom.clientHeight, 1, 50);
cameracctv.position.set( 0, -1,30 );
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 0.1, 50);
cameracctv.position.set( 0, -0.4,29 );
// cameracctv.rotation.y = Math.PI/2;
camera.add(cameracctv);

View File

@ -508,23 +508,28 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.position.x = pos.x;
// trainmodel.children[0].position.z = pos.z;
if(data.right == "0"){
if(-trainmodel.children[0].position.z != pos.z){
if(-trainmodel.children[0].position.z != pos.z || trainmodel.children[0].position.y != pos.y){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
let newRotationZ = trainmodel.children[0].rotation.z;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
trainmodel.children[0].rotation.y = -newRotationZ;
let rotas = {
posr:pos,
rota:trainmodel.children[0].rotation.z
roty:trainmodel.children[0].rotation.y,
rotz:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = pos.z + trainmodel.children[0].position.z;
trainmodel.children[0].position.z -= offsetz;
let offsety = pos.y - trainmodel.children[0].position.y;
trainmodel.children[0].position.y += offsetz;
// trainmodel.position.z = point.z;
}
@ -537,6 +542,9 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) + parseFloat(trainmodel.children[rs].position.z);
trainmodel.children[rs].position.z -= offsetz;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].position.y);
trainmodel.children[rs].position.y += offsety;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
@ -547,7 +555,8 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -565,7 +574,12 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}else{
//
if(trainmodel.children[0].position.z < pos.z){
let rotas = {
posr:null,
roty:null,
rotz:null,
};
if(trainmodel.children[0].position.z < pos.z ){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
@ -574,12 +588,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:pos,
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
rotas.posr = pos;
// rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
trainmodel.children[0].position.z += offsetz;
@ -592,26 +604,56 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:pos,
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
rotas.posr = pos;
// rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
trainmodel.children[0].position.z += offsetz;
}
if(trainmodel.children[0].position.y != pos.y){
if(rotas.posr == null){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
rotas.posr = pos;
rotas.roty = trainmodel.children[0].rotation.y;
rotas.rotz = trainmodel.children[0].rotation.z;
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
trainmodel.children[0].position.z += offsetz;
let offsety = parseFloat(pos.y) - parseFloat(trainmodel.children[0].position.y);
trainmodel.children[0].position.y += offsety;
}else{
rotas.roty = trainmodel.children[0].rotation.y;
let offsety = parseFloat(rotas.posr.y) - parseFloat(trainmodel.children[0].position.y);
trainmodel.children[0].position.y += offsety;
}
}
if(rotas.posr!= null){
trainmodel.children[1].rotalist.push(rotas);
}
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].matrixWorld.elements[13]);
trainmodel.children[rs].position.y += offsety;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
@ -620,8 +662,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.children[rs+1].rotalist.push(asd);
}
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
if(trainmodel.children[rs].rotalist[0].roty != null){
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
}
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{

View File

@ -166,8 +166,8 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) {
function setpsdstationmap(stationlist){
for(let i=0,leni=stationlist.length;i<leni;i++){
psdtexturemap[stationlist[i].direction1.code] = stationlist[i].code;
psdtexturemap[stationlist[i].direction2.code] = stationlist[i].code;
psdtexturemap[stationlist[i].stand[0].code] = stationlist[i].code;
psdtexturemap[stationlist[i].stand[1].code] = stationlist[i].code;
}
}
this.startAnimate = function(){

View File

@ -278,7 +278,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
@ -290,8 +290,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz;
// let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
// trainlisttest.list[code].children[0].position.y += offsety;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
}
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
@ -299,8 +299,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
if(trainlisttest.list[code].children[rs].rotalist[0]){
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
trainlisttest.list[code].children[rs].position.z += offsetz;
// let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
// trainlisttest.list[code].children[rs].position.y += offsety;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
@ -316,7 +316,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
}
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
// trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -369,7 +369,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = {
posr:point,
@ -379,8 +379,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
trainlisttest.list[code].children[0].position.z -= offsetz;
// let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
// trainlisttest.list[code].children[0].position.y += offsety;
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
trainlisttest.list[code].children[0].position.y += offsety;
// trainlisttest.list[code].position.z = point.z;
}
@ -392,8 +392,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
trainlisttest.list[code].children[rs].position.z -= offsetz;
// let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
// trainlisttest.list[code].children[rs].position.y += offsety;
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
@ -402,8 +402,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
}
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
// trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;

View File

@ -116,8 +116,8 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
};
var shape = new THREE.Shape();
len = closedSpline.getLength();
if(newsection.railpoint[0].y != newsection.railpoint[2].y){
console.log(newsection);
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{

View File

@ -15,6 +15,10 @@ export function SectionModel(data) {
this.isStandTrack = null;
this.rsection = null;
this.lsection = null;
this.type = null;
//指向模型
this.mesh = null;

View File

@ -156,7 +156,7 @@ export function StationStandListN() {
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
console.log(standsdata[i]);
// console.log(standsdata[i]);
if(standsdata[i].code != "Station96090"){
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
@ -211,7 +211,7 @@ export function StationStandListN() {
for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
let key = psddata[n].code;

View File

@ -69,14 +69,22 @@ export function TrainListN() {
selectmesh = assetloader.modellist[n].mesh;
scope.trainmesh = assetloader.modellist[n].mesh
ntracks1 = assetloader.modellist[n].animations.slice(16,27);
// ntracks1 = assetloader.modellist[n].animations.slice(16,27);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
//
// ntracks2 = assetloader.modellist[n].animations.slice(0,15);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = assetloader.modellist[n].animations.slice(0,15);
ntracks2 = assetloader.modellist[n].animations.slice(6,13);
fclip = new THREE.AnimationClip("four",2,ntracks2);
ntracks1 = assetloader.modellist[n].animations.slice(0,5);
tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0;
}
}
@ -202,21 +210,21 @@ export function TrainListN() {
selectmesh = assetloader.modellist[n].mesh
ntracks1 = assetloader.modellist[n].animations.slice(16,27);
// ntracks1 = assetloader.modellist[n].animations.slice(16,27);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
//
// ntracks2 = assetloader.modellist[n].animations.slice(0,15);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = assetloader.modellist[n].animations.slice(0,15);
ntracks2 = assetloader.modellist[n].animations.slice(6,13);
fclip = new THREE.AnimationClip("four",2,ntracks2);
// ntracks2 = assetloader.modellist[n].animations.slice(6,13);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
//
// ntracks1 = assetloader.modellist[n].animations.slice(0,5);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks1 = assetloader.modellist[n].animations.slice(0,5);
tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0;
}
}

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛